libyui-mga  1.0.7
YMGAWidgetExtensionFactory.h
1 /*
2  Copyright (C) 2013 Angelo Naselli <anaselli at linux dot it>
3 
4  This file is a YExternalWidgetFactory implementation
5 
6  This library is free software; you can redistribute it and/or modify
7  it under the terms of the GNU Lesser General Public License as
8  published by the Free Software Foundation; either version 2.1 of the
9  License, or (at your option) version 3.0 of the License. This library
10  is distributed in the hope that it will be useful, but WITHOUT ANY
11  WARRANTY; without even the implied warranty of MERCHANTABILITY or
12  FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
13  License for more details. You should have received a copy of the GNU
14  Lesser General Public License along with this library; if not, write
15  to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
16  Floor, Boston, MA 02110-1301 USA
17 */
18 
19 /*-/
20 
21  File: YMGAWidgetFactory.h
22 
23  Author: Angelo Naselli <anaselli@linux.it>
24 
25 /-*/
26 
27 #ifndef YMGAWidgetExtensionFactory_h
28 #define YMGAWidgetExtensionFactory_h
29 
30 #include <string>
31 
32 #include <yui/YExternalWidgetFactory.h>
33 #include <yui/YTypes.h>
34 #include <yui/YEvent.h>
35 
36 
37 
38 #include "YMGA_CBTable.h" // YCBTableMode
39 #include "YMGAMsgBox.h" // DLG_BUTTON, DLG_MODE
40 
41 struct stat;
42 
43 class YWidget;
44 class YMGAAboutDialog;
45 
46 /**
47  * Abstract extension widget factory to create widget extensions.
48  *
49  * Refer to the respective widget's documentation (in the header file) for
50  * documentation about the function parameters.
51  **/
52 class YMGAWidgetFactory : public YExternalWidgetFactory
53 {
54 public:
55 
56  /**
57  * creates an About Dialog providing the information passed as arguments
58  * Remember to remove this instance after.
59  * @param appname the application name
60  * @param appver the application version
61  * @param applicense the application license, short-length (e.g. GPLv2, GPLv3, LGPL, LGPLv2+, etc)
62  * @param appauthors the application authors
63  * @param appdescription a brief description of the application
64  * @param applogo the file path to the application logo
65  * @param appicon the file path to the application icon
66  * @param appcredits optional, the credits
67  * @param appinfo optional, other extra information
68  * @return YMGAAboutDialog instance
69  */
70  YMGAAboutDialog * createAboutDialog( const std::string& appname,
71  const std::string& appversion,
72  const std::string& applicense,
73  const std::string& appauthors,
74  const std::string& appdescription,
75  const std::string& applogo,
76  const std::string& appicon = std::string(),
77  const std::string& appcredits = std::string(),
78  const std::string& appinfo = std::string()
79  );
80 
81  /**
82  * creates a check boxed table
83  * @param parent parent widget
84  * @param header_disown YTable header
85  * @param mode check box position (YCBTableCheckBoxOnFirstColumn, YCBTableCheckBoxOnLastColumn)
86  * @return YMGA_CBTable widget instance
87  **/
88  virtual YMGA_CBTable * createCBTable ( YWidget * parent, YTableHeader * header_disown, YCBTableMode mode = YCBTableCheckBoxOnFirstColumn ) = 0;
89 
90 
91  /**
92  * creates a dialog box dialog, use the instance to set dialog information and call show() to use it.
93  * Remember to remove this instance after.
94  * @param button_number one button (such as "ok" for instance) B_ONE or two buttons (such as "ok" and "cancel") B_TWO
95  * @param dialog_mode dialog type (D_NORMAL, D_INFO, D_WARNING)
96  * @return YMGAMessageBox dialog instance
97  **/
100 
101  /**
102  * creates an messagebox dialog, use the instance to set dialog information and call show() to use it.
103  * Remember to remove this instance after.
104  * @param title dialog title
105  * @param text dialog content text
106  * @param useRichText set text using rich text if true
107  * @param btn_label button label (such as Ok, for instance)
108  * @return YMGAMessageBox dialog instance
109  **/
110  YMGAMessageBox* createMessageBox ( const std::string& title, const std::string& text, bool useRichText, const std::string& btn_label );
111 
112  /**
113  * creates an Info messagebox dialog, use the instance to set dialog information and call show() to use it.
114  * Remember to remove this instance after.
115  * @param title dialog title
116  * @param text dialog content text
117  * @param useRichText set text using rich text if true
118  * @param btn_label button label (such as Ok, for instance)
119  * @return YMGAMessageBox dialog instance
120  **/
121  YMGAMessageBox* createInfoBox ( const std::string& title, const std::string& text, bool useRichText, const std::string& btn_label );
122 
123  /**
124  * creates an Warning messagebox dialog, use the instance to set dialog information and call show() to use it.
125  * Remember to remove this instance after.
126  * @param title dialog title
127  * @param text dialog content text
128  * @param useRichText set text using rich text if true
129  * @param btn_label button label (such as Ok, for instance)
130  * @return YMGAMessageBox dialog instance
131  **/
132  YMGAMessageBox* createWarningBox ( const std::string& title, const std::string& text, bool useRichText, const std::string& btn_label );
133 
134 
135  /**
136  * casts useful for bindings from YExternalWidgetFactory* to YMGAWidgetFactory*
137  *
138  **/
139  static YMGAWidgetFactory* getYMGAWidgetFactory ( YExternalWidgetFactory* instance );
140 
141  // event conversions
142  /**
143  * casts useful for bindings from YEvent* to YWidgetEvent*
144  *
145  **/
146  static YWidgetEvent* getYWidgetEvent ( YEvent *event );
147 
148  /**
149  * casts useful for bindings from YEvent* to YKeyEvent*
150  *
151  **/
152  static YKeyEvent* getYKeyEvent ( YEvent *event );
153 
154  /**
155  * casts useful for bindings from YEvent* to YMenuEvent*
156  *
157  **/
158  static YMenuEvent* getYMenuEvent ( YEvent *event );
159 
160  /**
161  * casts useful for bindings from YEvent* to YCancelEvent*
162  *
163  **/
164  static YCancelEvent* getYCancelEvent ( YEvent *event );
165 
166  /**
167  * casts useful for bindings from YEvent* to YDebugEvent*
168  *
169  **/
170  static YDebugEvent* getYDebugEvent ( YEvent *event );
171 
172  /**
173  * casts useful for bindings from YEvent* to YTimeoutEvent*
174  *
175  **/
176  static YTimeoutEvent* getYTimeoutEvent ( YEvent *event );
177 
178 protected:
179 
180  friend class YExternalWidgets;
181 
182  /**
183  * Constructor.
184  *
185  * Use YExternalWidgets::widgetExtensionFactory() to get the singleton for this class.
186  **/
188 
189  /**
190  * Destructor.
191  **/
192  virtual ~YMGAWidgetFactory();
193 
194 }; // class YMGAWidgetFactory
195 
196 
197 #endif // YMGAWidgetExtensionFactory_h
YMGAMessageBox * createMessageBox(const std::string &title, const std::string &text, bool useRichText, const std::string &btn_label)
creates an messagebox dialog, use the instance to set dialog information and call show() to use it...
YMGAMessageBox * createInfoBox(const std::string &title, const std::string &text, bool useRichText, const std::string &btn_label)
creates an Info messagebox dialog, use the instance to set dialog information and call show() to use ...
YMGAMessageBox * createDialogBox(YMGAMessageBox::DLG_BUTTON button_number=YMGAMessageBox::B_ONE, YMGAMessageBox::DLG_MODE dialog_mode=YMGAMessageBox::D_NORMAL)
creates a dialog box dialog, use the instance to set dialog information and call show() to use it...
Abstract extension widget factory to create widget extensions.
static YWidgetEvent * getYWidgetEvent(YEvent *event)
casts useful for bindings from YEvent* to YWidgetEvent*
One button dialog, or button one pressed.
Definition: YMGAMsgBox.h:39
See document of YMGA_CBTable Table: Selection list with multiple columns.
Definition: YMGA_CBTable.h:114
YMGAAboutDialog * createAboutDialog(const std::string &appname, const std::string &appversion, const std::string &applicense, const std::string &appauthors, const std::string &appdescription, const std::string &applogo, const std::string &appicon=std::string(), const std::string &appcredits=std::string(), const std::string &appinfo=std::string())
creates an About Dialog providing the information passed as arguments Remember to remove this instanc...
static YCancelEvent * getYCancelEvent(YEvent *event)
casts useful for bindings from YEvent* to YCancelEvent*
static YMGAWidgetFactory * getYMGAWidgetFactory(YExternalWidgetFactory *instance)
casts useful for bindings from YExternalWidgetFactory* to YMGAWidgetFactory*
Normal dialog.
Definition: YMGAMsgBox.h:46
static YDebugEvent * getYDebugEvent(YEvent *event)
casts useful for bindings from YEvent* to YDebugEvent*
static YTimeoutEvent * getYTimeoutEvent(YEvent *event)
casts useful for bindings from YEvent* to YTimeoutEvent*
virtual ~YMGAWidgetFactory()
Destructor.
static YKeyEvent * getYKeyEvent(YEvent *event)
casts useful for bindings from YEvent* to YKeyEvent*
static YMenuEvent * getYMenuEvent(YEvent *event)
casts useful for bindings from YEvent* to YMenuEvent*
virtual YMGA_CBTable * createCBTable(YWidget *parent, YTableHeader *header_disown, YCBTableMode mode=YCBTableCheckBoxOnFirstColumn)=0
creates a check boxed table
YMGAMessageBox * createWarningBox(const std::string &title, const std::string &text, bool useRichText, const std::string &btn_label)
creates an Warning messagebox dialog, use the instance to set dialog information and call show() to u...