1 /*******************************************************************************
2 * Goggles Music Manager *
3 ********************************************************************************
4 * Copyright (C) 2009-2021 by Sander Jansen. All Rights Reserved *
5 * --- *
6 * This program is free software: you can redistribute it and/or modify *
7 * it under the terms of the GNU General Public License as published by *
8 * the Free Software Foundation, either version 3 of the License, or *
9 * (at your option) any later version. *
10 * *
11 * This program is distributed in the hope that it will be useful, *
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14 * GNU General Public License for more details. *
15 * *
16 * You should have received a copy of the GNU General Public License *
17 * along with this program. If not, see http://www.gnu.org/licenses. *
18 ********************************************************************************/
19 #ifndef FXEXT_H
20 #define FXEXT_H
21
22 enum {
23 WINDOWTYPE_NORMAL,
24 WINDOWTYPE_DIALOG,
25 WINDOWTYPE_COMBO,
26 WINDOWTYPE_POPUP_MENU,
27 WINDOWTYPE_DROPDOWN_MENU,
28 WINDOWTYPE_TOOLTIP,
29 };
30
31 extern void ewmh_change_window_type(const FXWindow *,FXuint);
32 extern void ewmh_set_window_icon(const FXWindow *,FXImage *);
33 extern void ewmh_activate_window(const FXWindow*);
34 extern void fix_wm_properties(const FXWindow*);
35
36
37 class GMThreadDialog : public FXTopWindow {
38 FXDECLARE(GMThreadDialog)
39 protected:
40 FXMutex mutex;
41 FXCondition condition;
42 FXuint code = 0;
43 protected:
GMThreadDialog()44 GMThreadDialog(){}
45 private:
46 GMThreadDialog(const GMThreadDialog&);
47 GMThreadDialog &operator=(const GMThreadDialog&);
48 public:
49 long onCmdAccept(FXObject*,FXSelector,void*);
50 long onCmdCancel(FXObject*,FXSelector,void*);
51 long onThreadExec(FXObject*,FXSelector,void*);
52 long onKeyPress(FXObject*,FXSelector,void*);
53 long onKeyRelease(FXObject*,FXSelector,void*);
54 public:
55 enum {
56 ID_CANCEL=FXTopWindow::ID_LAST, /// Closes the dialog, cancel the entry
57 ID_ACCEPT, /// Closes the dialog, accept the entry
58 ID_THREAD_EXEC,
59 ID_LAST
60 };
61 public:
62
63 /// Construct free-floating dialog
64 GMThreadDialog(FXApp* a,const FXString& name,FXuint opts=DECOR_TITLE|DECOR_BORDER,FXint x=0,FXint y=0,FXint w=0,FXint h=0,FXint pl=10,FXint pr=10,FXint pt=10,FXint pb=10,FXint hs=4,FXint vs=4);
65
66 /// Construct dialog which will always float over the owner window
67 GMThreadDialog(FXWindow* owner,const FXString& name,FXuint opts=DECOR_TITLE|DECOR_BORDER,FXint x=0,FXint y=0,FXint w=0,FXint h=0,FXint pl=10,FXint pr=10,FXint pt=10,FXint pb=10,FXint hs=4,FXint vs=4);
68
69 /// Execute from thread using message channel
70 FXuint execute(FXMessageChannel*);
71 };
72
73
74
75
76
77 class GMListBox : public FXListBox {
78 FXDECLARE(GMListBox)
79 protected:
80 GMListBox();
81 private:
82 GMListBox(const GMListBox&);
83 GMListBox& operator=(const GMListBox&);
84 public:
85 GMListBox(FXComposite*,FXObject*tgt=nullptr,FXSelector sel=0,FXuint opts=FRAME_SUNKEN|FRAME_THICK|LISTBOX_NORMAL,FXint x=0,FXint y=0,FXint w=0,FXint h=0,FXint pl=DEFAULT_PAD,FXint pr=DEFAULT_PAD,FXint pt=DEFAULT_PAD,FXint pb=DEFAULT_PAD);
86 virtual void create();
87 };
88
89 class GMComboBox : public FXComboBox {
90 FXDECLARE(GMComboBox)
91 protected:
92 GMComboBox();
93 private:
94 GMComboBox(const GMComboBox&);
95 GMComboBox& operator=(const GMComboBox&);
96 public:
97 GMComboBox(FXComposite *p,FXint cols,FXObject* tgt=nullptr,FXSelector sel=0,FXuint opts=COMBOBOX_NORMAL,FXint x=0,FXint y=0,FXint w=0,FXint h=0,FXint pl=DEFAULT_PAD,FXint pr=DEFAULT_PAD,FXint pt=DEFAULT_PAD,FXint pb=DEFAULT_PAD);
98 virtual void create();
99 };
100
101 class GMScrollArea : public FXScrollArea {
FXDECLARE(GMScrollArea)102 FXDECLARE(GMScrollArea)
103 protected:
104 GMScrollArea(){}
105 private:
106 GMScrollArea(const GMScrollArea&);
107 GMScrollArea& operator=(const GMScrollArea&);
108 public:
109 static void replaceScrollbars(FXScrollArea*);
110 };
111
112
113
114 class GMTreeListBox : public FXTreeListBox {
FXDECLARE(GMTreeListBox)115 FXDECLARE(GMTreeListBox)
116 protected:
117 GMTreeListBox(){}
118 private:
119 GMTreeListBox(const GMTreeListBox&);
120 GMTreeListBox& operator=(const GMTreeListBox&);
121 public:
122 static void replace(FXTreeListBox*);
123 };
124
125
126 class GMTabBook : public FXTabBook {
FXDECLARE(GMTabBook)127 FXDECLARE(GMTabBook)
128 protected:
129 GMTabBook(){}
130 private:
131 GMTabBook(const GMTabBook&);
132 GMTabBook& operator=(const GMTabBook&);
133 public:
134 GMTabBook(FXComposite* p,FXObject* tgt=nullptr,FXSelector sel=0,FXuint opts=TABBOOK_NORMAL,FXint x=0,FXint y=0,FXint w=0,FXint h=0,FXint pl=DEFAULT_SPACING,FXint pr=DEFAULT_SPACING,FXint pt=DEFAULT_SPACING,FXint pb=DEFAULT_SPACING);
135 virtual void setCurrent(FXint panel,FXbool notify=false);
136 };
137
138
139 class GMTabItem : public FXTabItem {
FXDECLARE(GMTabItem)140 FXDECLARE(GMTabItem)
141 protected:
142 GMTabItem(){}
143 private:
144 GMTabItem(const GMTabItem&);
145 GMTabItem& operator=(const GMTabItem&);
146 public:
147 long onPaint(FXObject*,FXSelector,void*);
148 public:
149 /// Construct a tab item
150 GMTabItem(FXTabBar* p,const FXString& text,FXIcon* ic=0,FXuint opts=TAB_TOP_NORMAL,FXint x=0,FXint y=0,FXint w=0,FXint h=0,FXint pl=DEFAULT_PAD,FXint pr=DEFAULT_PAD,FXint pt=DEFAULT_PAD,FXint pb=DEFAULT_PAD);
151
152 // virtual void raise();
153 };
154
155
156
157 class GMHeaderItem : public FXHeaderItem {
FXDECLARE(GMHeaderItem)158 FXDECLARE(GMHeaderItem)
159 friend class GMHeader;
160 protected:
161 GMHeaderItem(){}
162 public:
163 /// Construct new item with given text, icon, size, and user-data
FXHeaderItem(text,ic,s,ptr)164 GMHeaderItem(const FXString& text,FXIcon* ic=nullptr,FXint s=0,void* ptr=nullptr): FXHeaderItem(text,ic,s,ptr) {}
165 };
166
167 class GMHeader : public FXHeader {
168 FXDECLARE(GMHeader)
169 protected:
170 GMHeader();
171 private:
172 GMHeader(const GMHeader&);
173 GMHeader &operator=(const GMHeader&);
174 public:
175 long onPaint(FXObject*,FXSelector,void*);
176 public:
177 GMHeader(FXComposite* p,FXObject* tgt=nullptr,FXSelector sel=0,FXuint opts=HEADER_NORMAL,FXint x=0,FXint y=0,FXint w=0,FXint h=0,FXint pl=DEFAULT_PAD,FXint pr=DEFAULT_PAD,FXint pt=DEFAULT_PAD,FXint pb=DEFAULT_PAD);
178 };
179
180
181 class GMHeaderButton : public FXButton {
182 FXDECLARE(GMHeaderButton)
183 protected:
184 FXuint arrowstate;
185 protected:
186 GMHeaderButton();
187 private:
188 GMHeaderButton(const GMHeaderButton&);
189 GMHeaderButton& operator=(const GMHeaderButton&);
190 public:
191 long onPaint(FXObject*,FXSelector,void*);
192 public:
193 /// Construct button with text and icon
194 GMHeaderButton(FXComposite* p,const FXString& text,FXIcon* ic=nullptr,FXObject* tgt=nullptr,FXSelector sel=0,FXuint opts=BUTTON_NORMAL,FXint x=0,FXint y=0,FXint w=0,FXint h=0,FXint pl=DEFAULT_PAD,FXint pr=DEFAULT_PAD,FXint pt=DEFAULT_PAD,FXint pb=DEFAULT_PAD);
195
196 void setArrowState(FXuint s);
197
198 FXuint getArrowState() const;
199
200 };
201
202
203
204 class GMMenuCommand : public FXMenuCommand {
FXDECLARE(GMMenuCommand)205 FXDECLARE(GMMenuCommand)
206 protected:
207 GMMenuCommand(){}
208 private:
209 GMMenuCommand(const GMMenuCommand&);
210 GMMenuCommand& operator=(const GMMenuCommand&);
211 public:
212 GMMenuCommand(FXComposite* p,const FXString& text,FXIcon* ic=nullptr,FXObject* tgt=nullptr,FXSelector sel=0,FXuint opts=0);
213 };
214
215
216 class GMMenuCheck : public FXMenuCheck {
FXDECLARE(GMMenuCheck)217 FXDECLARE(GMMenuCheck)
218 protected:
219 GMMenuCheck(){}
220 private:
221 GMMenuCheck(const GMMenuCheck&);
222 GMMenuCheck& operator=(const GMMenuCheck&);
223 public:
224 GMMenuCheck(FXComposite* p,const FXString& text,FXObject* tgt=nullptr,FXSelector sel=0,FXuint opts=0);
225 };
226
227
228 class GMMenuRadio : public FXMenuRadio {
FXDECLARE(GMMenuRadio)229 FXDECLARE(GMMenuRadio)
230 protected:
231 GMMenuRadio(){}
232 private:
233 GMMenuRadio(const GMMenuRadio&);
234 GMMenuRadio& operator=(const GMMenuRadio&);
235 public:
236 GMMenuRadio(FXComposite* p,const FXString& text,FXObject* tgt=nullptr,FXSelector sel=0,FXuint opts=0);
237 };
238
239
240 class GMMenuCascade : public FXMenuCascade {
FXDECLARE(GMMenuCascade)241 FXDECLARE(GMMenuCascade)
242 protected:
243 GMMenuCascade(){}
244 private:
245 GMMenuCascade(const GMMenuCascade&);
246 GMMenuCascade& operator=(const GMMenuCascade&);
247 public:
248 GMMenuCascade(FXComposite* p,const FXString& text,FXIcon* ic=nullptr,FXPopup* pup=nullptr,FXuint opts=0);
249 };
250
251
252
253 class GMMenuTitle : public FXMenuTitle {
FXDECLARE(GMMenuTitle)254 FXDECLARE(GMMenuTitle)
255 protected:
256 GMMenuTitle(){}
257 private:
258 GMMenuTitle(const GMMenuTitle&);
259 GMMenuTitle& operator=(const GMMenuTitle&);
260 public:
261 long onPaint(FXObject*,FXSelector,void*);
262 long onCmdPost(FXObject*,FXSelector,void*);
263 public:
264 GMMenuTitle(FXComposite* p,const FXString& text,FXIcon* ic=nullptr,FXPopup* pup=nullptr,FXuint opts=0);
265 };
266
267
268 /// Popup menu pane
269 class GMMenuPane : public FXMenuPane {
FXDECLARE(GMMenuPane)270 FXDECLARE(GMMenuPane)
271 protected:
272 GMMenuPane(){}
273 private:
274 GMMenuPane(const GMMenuPane&);
275 GMMenuPane &operator=(const GMMenuPane&);
276 public:
277 /// Construct menu pane
278 GMMenuPane(FXWindow* owner,FXuint opts=0);
279 };
280
281
282 class GMButton : public FXButton {
283 FXDECLARE(GMButton)
284 protected:
285 GMButton();
286 private:
287 GMButton(const GMButton&);
288 GMButton& operator=(const GMButton&);
289 public:
290 long onPaint(FXObject*,FXSelector,void*);
291 public:
292 GMButton(FXComposite* p,const FXString& text,FXIcon* ic=nullptr,FXObject* tgt=nullptr,FXSelector sel=0,FXuint opts=BUTTON_NORMAL,FXint x=0,FXint y=0,FXint w=0,FXint h=0,FXint pl=DEFAULT_PAD,FXint pr=DEFAULT_PAD,FXint pt=DEFAULT_PAD,FXint pb=DEFAULT_PAD);
293 };
294
295
296 class GMToggleButton : public FXToggleButton {
297 FXDECLARE(GMToggleButton)
298 protected:
299 GMToggleButton();
300 private:
301 GMToggleButton(const GMToggleButton&);
302 GMToggleButton& operator=(const GMToggleButton&);
303 public:
304 long onPaint(FXObject*,FXSelector,void*);
305 public:
306 GMToggleButton(FXComposite* p,const FXString& text1,const FXString& text2,FXIcon* icon1=nullptr,FXIcon* icon2=nullptr,FXObject* tgt=nullptr,FXSelector sel=0,FXuint opts=TOGGLEBUTTON_NORMAL,FXint x=0,FXint y=0,FXint w=0,FXint h=0,FXint pl=DEFAULT_PAD,FXint pr=DEFAULT_PAD,FXint pt=DEFAULT_PAD,FXint pb=DEFAULT_PAD);
307 };
308
309 class GMRadioButton : public FXRadioButton {
310 FXDECLARE(GMRadioButton)
311 protected:
312 GMRadioButton();
313 private:
314 GMRadioButton(const GMRadioButton&);
315 GMRadioButton& operator=(const GMRadioButton&);
316 public:
317 GMRadioButton(FXComposite* p,const FXString& text,FXObject* tgt=nullptr,FXSelector sel=0,FXuint opts=RADIOBUTTON_NORMAL,FXint x=0,FXint y=0,FXint w=0,FXint h=0,FXint pl=DEFAULT_PAD,FXint pr=DEFAULT_PAD,FXint pt=DEFAULT_PAD,FXint pb=DEFAULT_PAD);
318 };
319
320 class GMCheckButton : public FXCheckButton {
321 FXDECLARE(GMCheckButton)
322 protected:
323 GMCheckButton();
324 private:
325 GMCheckButton(const GMCheckButton&);
326 GMCheckButton& operator=(const GMCheckButton&);
327 public:
328 long onPaint(FXObject*,FXSelector,void*);
329 public:
330 GMCheckButton(FXComposite* p,const FXString& text,FXObject* tgt=nullptr,FXSelector sel=0,FXuint opts=CHECKBUTTON_NORMAL,FXint x=0,FXint y=0,FXint w=0,FXint h=0,FXint pl=DEFAULT_PAD,FXint pr=DEFAULT_PAD,FXint pt=DEFAULT_PAD,FXint pb=DEFAULT_PAD);
331 };
332
333 class GMMenuButton : public FXMenuButton {
334 FXDECLARE(GMMenuButton)
335 protected:
336 GMMenuButton();
337 private:
338 GMMenuButton(const GMMenuButton&);
339 GMMenuButton& operator=(const GMMenuButton&);
340 public:
341 long onPaint(FXObject*,FXSelector,void*);
342 public:
343 GMMenuButton(FXComposite* p,const FXString& text,FXIcon* ic=nullptr,FXPopup* pup=nullptr,FXuint opts=JUSTIFY_NORMAL|ICON_BEFORE_TEXT|MENUBUTTON_DOWN,FXint x=0,FXint y=0,FXint w=0,FXint h=0,FXint pl=DEFAULT_PAD,FXint pr=DEFAULT_PAD,FXint pt=DEFAULT_PAD,FXint pb=DEFAULT_PAD);
344
345 virtual FXint getDefaultWidth();
346 virtual FXint getDefaultHeight();
347 };
348
349
350 class GMTextField : public FXTextField {
FXDECLARE(GMTextField)351 FXDECLARE(GMTextField)
352 protected:
353 GMTextField(){}
354 private:
355 GMTextField(const GMTextField&);
356 GMTextField& operator=(const GMTextField&);
357 public:
358 long onLeftBtnPress(FXObject*,FXSelector,void*);
359 public:
360 GMTextField(FXComposite* p,FXint ncols,FXObject* tgt=nullptr,FXSelector sel=0,FXuint opts=TEXTFIELD_NORMAL,FXint x=0,FXint y=0,FXint w=0,FXint h=0,FXint pl=DEFAULT_PAD,FXint pr=DEFAULT_PAD,FXint pt=DEFAULT_PAD,FXint pb=DEFAULT_PAD);
361
362 FXbool extendWordSelection(FXint p,FXbool notify=false);
363 };
364
365
366
367 class GMScrollFrame : public FXVerticalFrame {
368 FXDECLARE(GMScrollFrame)
369 protected:
370 GMScrollFrame();
371 private:
372 GMScrollFrame(const GMScrollFrame&);
373 GMScrollFrame& operator=(const GMScrollFrame&);
374 public:
375 GMScrollFrame(FXComposite*p);
376 };
377
378 class GMCoverFrame : public FXVerticalFrame {
379 FXDECLARE(GMCoverFrame)
380 protected:
381 GMCoverFrame();
382 private:
383 GMCoverFrame(const GMCoverFrame&);
384 GMCoverFrame& operator=(const GMCoverFrame&);
385 public:
386 GMCoverFrame(FXComposite*p);
387 };
388
389
390 class GMScrollHFrame : public FXHorizontalFrame {
391 FXDECLARE(GMScrollHFrame)
392 protected:
393 GMScrollHFrame();
394 private:
395 GMScrollHFrame(const GMScrollHFrame&);
396 GMScrollHFrame& operator=(const GMScrollHFrame&);
397 public:
398 GMScrollHFrame(FXComposite*p);
399 };
400
401
402 class GMTabFrame : public FXVerticalFrame {
403 FXDECLARE(GMTabFrame)
404 protected:
405 GMTabFrame();
406 private:
407 GMTabFrame(const GMTabFrame&);
408 GMTabFrame& operator=(const GMTabFrame&);
409 public:
410 GMTabFrame(FXComposite*p);
411 };
412
413
414 class GMImageFrame : public FXImageFrame {
415 FXDECLARE(GMImageFrame)
416 protected:
417 GMImageFrame();
418 private:
419 GMImageFrame(const GMImageFrame&);
420 GMImageFrame& operator=(const GMImageFrame&);
421 public:
422 GMImageFrame(FXComposite*p,FXImage *img,FXuint opts=FRAME_SUNKEN|FRAME_THICK,FXint x=0,FXint y=0,FXint w=0,FXint h=0,FXint pl=0,FXint pr=0,FXint pt=0,FXint pb=0);
423 };
424
425
426 class GMScrollBar : public FXScrollBar {
427 FXDECLARE(GMScrollBar)
428 protected:
429 GMScrollBar();
430 void drawThumb(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h);
431 private:
432 GMScrollBar(const GMScrollBar&);
433 GMScrollBar &operator=(const GMScrollBar&);
434 public:
435 long onPaint(FXObject*,FXSelector,void*);
436 public:
437 /// Construct scroll bar
438 GMScrollBar(FXComposite* p,FXObject* tgt=nullptr,FXSelector sel=0,FXuint opts=SCROLLBAR_VERTICAL,FXint x=0,FXint y=0,FXint w=0,FXint h=0);
439 };
440
441 class GMScrollCorner : public FXScrollCorner {
442 FXDECLARE(GMScrollCorner)
443 protected:
444 FXColor shadowColor = 0;
445 protected:
GMScrollCorner()446 GMScrollCorner() {}
447 private:
448 GMScrollCorner(const GMScrollCorner&);
449 GMScrollCorner &operator=(const GMScrollCorner&);
450 public:
451 long onPaint(FXObject*,FXSelector,void*);
452 public:
453 GMScrollCorner(FXComposite* p);
454 };
455
456 class GMSpinner : public FXSpinner {
FXDECLARE(GMSpinner)457 FXDECLARE(GMSpinner)
458 protected:
459 GMSpinner(){}
460 private:
461 GMSpinner(const GMSpinner&);
462 GMSpinner& operator=(const GMSpinner&);
463 public:
464 GMSpinner(FXComposite* p,FXint ncols,FXObject* tgt=nullptr,FXSelector sel=0,FXuint opts=SPIN_NORMAL,FXint x=0,FXint y=0,FXint w=0,FXint h=0,FXint pl=DEFAULT_PAD,FXint pr=DEFAULT_PAD,FXint pt=DEFAULT_PAD,FXint pb=DEFAULT_PAD);
465 };
466
467
468 class GMProgressBar : public FXProgressBar {
469 FXDECLARE(GMProgressBar)
470 protected:
471 GMProgressBar();
472 private:
473 GMProgressBar(const GMProgressBar&);
474 GMProgressBar &operator=(const GMProgressBar&);
475 public:
476 /// Construct progress bar
477 GMProgressBar(FXComposite* p,FXObject* target=nullptr,FXSelector sel=0,FXuint opts=PROGRESSBAR_NORMAL,FXint x=0,FXint y=0,FXint w=0,FXint h=0,FXint pl=DEFAULT_PAD,FXint pr=DEFAULT_PAD,FXint pt=DEFAULT_PAD,FXint pb=DEFAULT_PAD);
478 };
479
480
481 class GMTrackProgressBar : public FXProgressBar {
482 FXDECLARE(GMTrackProgressBar)
483 protected:
484 GMTrackProgressBar();
485 private:
486 GMTrackProgressBar(const GMTrackProgressBar&);
487 GMTrackProgressBar &operator=(const GMTrackProgressBar&);
488 public:
489 long onMotion(FXObject*,FXSelector,void*);
490 long onLeftBtnPress(FXObject*,FXSelector,void*);
491 long onLeftBtnRelease(FXObject*,FXSelector,void*);
492 public:
493 /// Construct progress bar
494 GMTrackProgressBar(FXComposite* p,FXObject* target=nullptr,FXSelector sel=0,FXuint opts=PROGRESSBAR_NORMAL,FXint x=0,FXint y=0,FXint w=0,FXint h=0,FXint pl=DEFAULT_PAD,FXint pr=DEFAULT_PAD,FXint pt=DEFAULT_PAD,FXint pb=DEFAULT_PAD);
495 };
496
497
498
499 #endif
500