8 #include <yui/Libyui_config.h>
10 #define YUILogComponent "gtk"
11 #include <yui/YUILog.h>
12 #include <yui/YSimpleEventHandler.h>
18 #define RET(a) { return (a); }
23 YGUI (
bool with_threads);
26 static YGUI *ui() {
return (
YGUI *) YUI::ui(); }
29 virtual YWidgetFactory *createWidgetFactory();
30 virtual YOptionalWidgetFactory *createOptionalWidgetFactory();
31 virtual YApplication *createApplication();
34 static void setTextdomain (
const char *domain);
36 virtual void idleLoop (
int fd_ycp);
38 YEvent *waitInput (
unsigned long timeout_ms,
bool block);
40 virtual YEvent *runPkgSelection (YWidget *packageSelector);
45 void makeScreenShot();
50 void toggleRecordMacro();
55 YSimpleEventHandler m_event_handler;
56 void sendEvent (YEvent *event);
57 YEvent *pendingEvent()
const {
return m_event_handler.pendingEvent(); }
58 bool eventPendingFor (YWidget *widget)
const
59 {
return m_event_handler.eventPendingFor (widget); }
64 static gboolean busy_timeout_cb (gpointer data);
67 bool m_no_border, m_fullscreen, m_swsingle;
71 bool setFullscreen()
const {
return m_fullscreen; }
72 bool unsetBorder()
const {
return m_no_border; }
73 bool isSwsingle()
const {
return m_swsingle; }
76 #include <YWidgetFactory.h>
80 virtual YDialog *createDialog (YDialogType dialogType, YDialogColorMode colorMode);
82 virtual YPushButton *createPushButton (YWidget *parent,
const std::string &label);
83 virtual YLabel *createLabel (YWidget *parent,
const std::string &text,
bool isHeading,
bool isOutputField);
84 virtual YInputField *createInputField (YWidget *parent,
const std::string &label,
bool passwordMode);
85 virtual YCheckBox *createCheckBox (YWidget *parent,
const std::string &label,
bool isChecked);
86 virtual YRadioButton *createRadioButton (YWidget *parent,
const std::string &label,
bool isChecked);
87 virtual YComboBox *createComboBox (YWidget *parent,
const std::string & label,
bool editable);
88 virtual YSelectionBox *createSelectionBox (YWidget *parent,
const std::string &label);
89 virtual YTree *createTree (YWidget *parent,
const std::string &label,
bool multiselection,
bool recursiveSelection);
90 virtual YTable *createTable (YWidget *parent, YTableHeader *headers,
bool multiSelection);
91 virtual YProgressBar *createProgressBar (YWidget *parent,
const std::string &label,
int maxValue);
92 virtual YBusyIndicator *createBusyIndicator (YWidget *parent,
const std::string &label,
int timeout);
93 virtual YRichText *createRichText (YWidget *parent,
const std::string &text,
bool plainTextMode);
95 virtual YIntField *createIntField (YWidget *parent,
const std::string &label,
int minVal,
int maxVal,
int initialVal);
96 virtual YMenuButton *createMenuButton (YWidget *parent,
const std::string &label);
97 virtual YMultiLineEdit *createMultiLineEdit (YWidget *parent,
const std::string &label);
98 virtual YImage *createImage (YWidget *parent,
const std::string &imageFileName,
bool animated);
99 virtual YLogView *createLogView (YWidget *parent,
const std::string &label,
int visibleLines,
int storedLines);
100 virtual YMultiSelectionBox *createMultiSelectionBox (YWidget *parent,
const std::string &label);
102 virtual YPackageSelector *createPackageSelector (YWidget * parent,
long ModeFlags);
103 virtual YWidget *createPkgSpecial (YWidget * parent,
const std::string & subwidgetName) RET (NULL)
105 virtual YLayoutBox *createLayoutBox (YWidget *parent, YUIDimension dimension);
106 virtual YButtonBox *createButtonBox (YWidget *parent);
108 virtual YSpacing *createSpacing (YWidget *parent, YUIDimension dim,
bool stretchable, YLayoutSize_t size);
109 virtual YEmpty *createEmpty (YWidget *parent);
110 virtual YAlignment *createAlignment (YWidget *parent, YAlignmentType horAlignment, YAlignmentType vertAlignment);
111 virtual YSquash *createSquash (YWidget *parent,
bool horSquash,
bool vertSquash);
113 virtual YFrame *createFrame (YWidget *parent,
const std::string &label);
114 virtual YCheckBoxFrame *createCheckBoxFrame (YWidget *parent,
const std::string &label,
bool checked);
116 virtual YRadioButtonGroup *createRadioButtonGroup (YWidget *parent);
117 virtual YReplacePoint *createReplacePoint (YWidget *parent);
120 #include <YOptionalWidgetFactory.h>
125 virtual bool hasWizard() RET (
true)
126 virtual YWizard *createWizard (YWidget *parent,
const std::string &backButtonLabel,
127 const std::string &abortButtonLabel,
const std::string &nextButtonLabel,
128 YWizardMode wizardMode);
130 virtual bool hasDumbTab() RET (
true)
131 virtual YDumbTab *createDumbTab (YWidget *parent);
133 virtual bool hasSlider() RET (
true)
134 virtual YSlider *createSlider (YWidget *parent,
const std::string &label,
int minVal,
135 int maxVal,
int initialVal);
137 virtual bool hasDateField() RET (
true)
138 virtual YDateField *createDateField (YWidget *parent,
const std::string &label);
140 virtual bool hasTimeField() RET (
true)
141 virtual YTimeField *createTimeField (YWidget *parent,
const std::string &label);
143 virtual bool hasTimezoneSelector() RET (
true)
144 virtual YTimezoneSelector *createTimezoneSelector (YWidget *parent,
145 const std::string &pixmap,
const std::map <std::string, std::string> &timezones);
147 virtual bool hasBarGraph() RET (
true)
148 virtual YBarGraph *createBarGraph (YWidget *parent);
150 virtual bool hasMultiProgressMeter() RET (
true)
151 virtual YMultiProgressMeter *createMultiProgressMeter (YWidget *parent,
152 YUIDimension dim,
const std::vector<float> &maxValues);
154 virtual bool hasPartitionSplitter() RET (
true)
155 virtual YPartitionSplitter *createPartitionSplitter (YWidget *parent,
156 int usedSize,
int totalFreeSize,
int newPartSize,
int minNewPartSize,
157 int minFreeSize,
const std::string &usedLabel,
const std::string &freeLabel,
158 const std::string &newPartLabel,
const std::string &freeFieldLabel,
159 const std::string &newPartFieldLabel);
161 virtual bool hasDownloadProgress() RET (
true)
162 virtual YDownloadProgress *createDownloadProgress (YWidget *parent,
163 const std::string &label,
const std::string & filename, YFileSize_t expectedFileSize);
165 virtual bool hasContextMenu() RET (
true)
167 virtual bool hasSimplePatchSelector() RET (
true)
168 virtual YWidget *createSimplePatchSelector (YWidget *parent,
long modeFlags);
169 virtual bool hasPatternSelector() RET (
true)
170 virtual YWidget *createPatternSelector (YWidget *parent,
long modeFlags);
173 #include <YApplication.h>
180 virtual std::string glyph (
const std::string &symbolName);
182 virtual std::string askForExistingDirectory (
const std::string &startDir,
183 const std::string &headline);
184 virtual std::string askForExistingFile (
const std::string &startWith,
185 const std::string &filter,
const std::string &headline);
186 virtual std::string askForSaveFileName (
const std::string &startWith,
187 const std::string &filter,
const std::string &headline);
189 virtual void busyCursor() { YGUI::ui()->busyCursor(); }
190 virtual void normalCursor() { YGUI::ui()->normalCursor(); }
192 virtual void makeScreenShot (
const std::string &filename);
195 virtual int deviceUnits (YUIDimension dim,
float layout_units);
196 virtual float layoutUnits (YUIDimension dim,
int device_units);
198 virtual int displayWidth();
199 virtual int displayHeight();
200 virtual int displayDepth();
201 virtual long displayColors();
202 virtual int defaultWidth();
203 virtual int defaultHeight();
205 virtual bool isTextMode() RET (
false)
206 virtual bool leftHandedMouse() RET (
false)
207 virtual bool hasImageSupport() RET (
true)
208 virtual bool hasLocalImageSupport() RET (
true)
209 virtual bool hasAnimationSupport() RET (
true)
210 virtual bool hasIconSupport() RET (
true)
211 virtual bool hasFullUtf8Support() RET (
true)
213 virtual bool richTextSupportsTable() RET (
true)
215 virtual bool richTextSupportsTable() RET (
false)
218 virtual bool openContextMenu (
const YItemCollection &itemCollection);
222 std::map <std::string, int> screenShotNb;
223 std::string screenShotNameTemplate;