Dillo v3.1.1-98-g318d1f14
Loading...
Searching...
No Matches
fltkui.hh
Go to the documentation of this file.
1#ifndef __DW_FLTK_UI_HH__
2#define __DW_FLTK_UI_HH__
3
4#ifndef __INCLUDED_FROM_DW_FLTK_CORE_HH__
5# error Do not include this file directly, use "fltkcore.hh" instead.
6#endif
7
8#include <FL/Fl_Button.H>
9#include <FL/Fl_Menu.H>
10#include <FL/Fl_Text_Buffer.H>
11
12namespace dw {
13namespace fltk {
14
182namespace ui {
183
188{
189private:
191
192protected:
194 Fl_Widget *widget;
197
199
201 void init (FltkPlatform *platform);
202 virtual Fl_Widget *createNewWidget (core::Allocation *allocation) = 0;
203
204 virtual void setWidgetStyle (Fl_Widget *widget, core::style::Style *style);
205 void setDisplayed (bool displayed);
206 bool displayed();
207public:
208 ~FltkResource ();
209
210 virtual void attachView (FltkView *view);
211 virtual void detachView (FltkView *view);
212
214 void draw (core::View *view, core::Rectangle *area,
215 core::DrawingContext *context);
216
218
219 bool isEnabled ();
220 void setEnabled (bool enabled);
221};
222
223
224template <class I> class FltkSpecificResource: public I, public FltkResource
225{
226public:
229
231 void draw (core::View *view, core::Rectangle *area,
232 core::DrawingContext *context);
234
235 bool isEnabled ();
236 void setEnabled (bool enabled);
237};
238
239
241 public FltkSpecificResource <dw::core::ui::LabelButtonResource>
242{
243private:
244 const char *label;
245
246 static void widgetCallback (Fl_Widget *widget, void *data);
247
248protected:
250
251public:
254
255 void sizeRequest (core::Requisition *requisition);
256
257 const char *getLabel ();
258 void setLabel (const char *label);
259};
260
261
263 public FltkSpecificResource <dw::core::ui::ComplexButtonResource>
264{
265private:
266 bool relief;
267
268 static void widgetCallback (Fl_Widget *widget, void *data);
269
270protected:
272
273 void attachView (FltkView *view);
274 void detachView (FltkView *view);
275
277
280
281 int reliefXThickness ();
282 int reliefYThickness ();
283
285
286public:
288 bool relief);
290};
291
292
298 public FltkSpecificResource <dw::core::ui::EntryResource>
299{
300private:
301 int size;
303 const char *initText;
304 char *label;
308
309 static void widgetCallback (Fl_Widget *widget, void *data);
310 void setDisplayed (bool displayed);
311
312protected:
314 void setWidgetStyle (Fl_Widget *widget, core::style::Style *style);
315
316public:
318 const char *label, const char *placeholder);
320
321 void sizeRequest (core::Requisition *requisition);
323
324 const char *getText ();
325 void setText (const char *text);
326 bool isEditable ();
327 void setEditable (bool editable);
328 void setMaxLength (int maxlen);
329};
330
331
333 public FltkSpecificResource <dw::core::ui::MultiLineTextResource>
334{
335private:
339protected:
341 void setWidgetStyle (Fl_Widget *widget, core::style::Style *style);
342
343public:
344 FltkMultiLineTextResource (FltkPlatform *platform, int cols, int rows,
345 const char *placeholder);
347
348 void sizeRequest (core::Requisition *requisition);
349
350 const char *getText ();
351 void setText (const char *text);
352 bool isEditable ();
353 void setEditable (bool editable);
354};
355
356
357template <class I> class FltkToggleButtonResource:
358 public FltkSpecificResource <I>
359{
360private:
362
363protected:
364 virtual Fl_Button *createNewButton (core::Allocation *allocation) = 0;
366 void setWidgetStyle (Fl_Widget *widget, core::style::Style *style);
367
368public:
370 bool activated);
372
373 void sizeRequest (core::Requisition *requisition);
374
375 bool isActivated ();
376 void setActivated (bool activated);
377};
378
379
381 public FltkToggleButtonResource <dw::core::ui::CheckButtonResource>
382{
383protected:
385
386public:
388 bool activated);
390};
391
392
394 public FltkToggleButtonResource <dw::core::ui::RadioButtonResource>
395{
396private:
397 class Group
398 {
399 private:
402 {
403 private:
404 lout::container::typed::Iterator <FltkRadioButtonResource> it;
405
406 public:
411
412 bool hasNext ();
414 void unref ();
415 };
416
417 lout::container::typed::List <FltkRadioButtonResource> *list;
418
419 protected:
420 ~Group ();
421
422 public:
423 Group (FltkRadioButtonResource *radioButtonResource);
424
425 inline lout::container::typed::Iterator <FltkRadioButtonResource>
427 {
428 return list->iterator ();
429 }
430
433 {
434 return new FltkGroupIterator (list);
435 }
436
437 void connect (FltkRadioButtonResource *radioButtonResource);
438 void unconnect (FltkRadioButtonResource *radioButtonResource);
439 };
440
442
443 static void widgetCallback (Fl_Widget *widget, void *data);
444 void buttonClicked ();
445
446protected:
448
449public:
451 FltkRadioButtonResource *groupedWith,
452 bool activated);
454
455 GroupIterator *groupIterator ();
456};
457
458
459template <class I> class FltkSelectionResource:
460 public FltkSpecificResource <I>
461{
462protected:
463 virtual bool setSelectedItems() { return false; }
464 virtual void addItem (const char *str, bool enabled, bool selected) = 0;
465 virtual void setItem (int index, bool selected) = 0;
466 virtual void pushGroup (const char *name, bool enabled) = 0;
467 virtual void popGroup () = 0;
468public:
472};
473
474
476 public FltkSelectionResource <dw::core::ui::OptionMenuResource>
477{
478protected:
480 virtual bool setSelectedItems() { return true; }
481 void setWidgetStyle (Fl_Widget *widget, core::style::Style *style);
482 int getNumberOfItems();
483 int getMaxItemWidth ();
484private:
485 static void widgetCallback (Fl_Widget *widget, void *data);
486 void enlargeMenu();
487 Fl_Menu_Item *newItem();
488 Fl_Menu_Item *menu;
490public:
493
494 void addItem (const char *str, bool enabled, bool selected);
495 void setItem (int index, bool selected);
496 void pushGroup (const char *name, bool enabled);
497 void popGroup ();
498
499 void sizeRequest (core::Requisition *requisition);
500 bool isSelected (int index);
501};
502
504 public FltkSelectionResource <dw::core::ui::ListResource>
505{
506protected:
508 void setWidgetStyle (Fl_Widget *widget, core::style::Style *style);
509 int getNumberOfItems();
510 int getMaxItemWidth ();
511private:
512 static void widgetCallback (Fl_Widget *widget, void *data);
513 void *newItem (const char *str, bool enabled, bool selected);
515 int colWidths[4];
517 ListResource::SelectionMode mode;
518public:
521 int rows);
523
524 void addItem (const char *str, bool enabled, bool selected);
525 void setItem (int index, bool selected);
526 void pushGroup (const char *name, bool enabled);
527 void popGroup ();
528
529 void sizeRequest (core::Requisition *requisition);
530 bool isSelected (int index);
531};
532
533
534} // namespace ui
535} // namespace fltk
536} // namespace dw
537
538
539#endif // __DW_FLTK_UI_HH__
Set at the top when drawing.
Definition types.hh:295
Iterators are used to iterate through the contents of a widget.
Definition iterator.hh:20
The central class for managing and drawing a widget tree.
Definition layout.hh:17
An interface to encapsulate some platform dependencies.
Definition platform.hh:17
dw::core::Shape implemtation for simple rectangles.
Definition types.hh:70
An interface to encapsulate platform dependent drawing.
Definition view.hh:17
The base class of all dillo widgets.
Definition widget.hh:44
This interface adds some more methods for all flkt-based views.
Fl_Button * createNewButton(core::Allocation *allocation)
Definition fltkui.cc:1234
Fl_Widget * createNewWidget(core::Allocation *allocation)
Definition fltkui.cc:838
void setLayout(dw::core::Layout *layout)
Definition fltkui.cc:822
dw::core::Platform * createPlatform()
Definition fltkui.cc:781
static void widgetCallback(Fl_Widget *widget, void *data)
Definition fltkui.cc:744
void sizeAllocate(core::Allocation *allocation)
Definition fltkui.cc:799
void setWidgetStyle(Fl_Widget *widget, core::style::Style *style)
Definition fltkui.cc:912
void setMaxLength(int maxlen)
Definition fltkui.cc:1013
void sizeRequest(core::Requisition *requisition)
Definition fltkui.cc:938
void sizeAllocate(core::Allocation *allocation)
Definition fltkui.cc:964
void setDisplayed(bool displayed)
Definition fltkui.cc:932
void setEditable(bool editable)
Definition fltkui.cc:1008
static void widgetCallback(Fl_Widget *widget, void *data)
Definition fltkui.cc:984
Fl_Widget * createNewWidget(core::Allocation *allocation)
Definition fltkui.cc:890
void setText(const char *text)
Definition fltkui.cc:994
void setLabel(const char *label)
Definition fltkui.cc:718
Fl_Widget * createNewWidget(core::Allocation *allocation)
Definition fltkui.cc:638
void sizeRequest(core::Requisition *requisition)
Definition fltkui.cc:649
static void widgetCallback(Fl_Widget *widget, void *data)
Definition fltkui.cc:701
ListResource::SelectionMode mode
Definition fltkui.hh:517
void setWidgetStyle(Fl_Widget *widget, core::style::Style *style)
Definition fltkui.cc:1604
Fl_Widget * createNewWidget(core::Allocation *allocation)
Definition fltkui.cc:1589
void * newItem(const char *str, bool enabled, bool selected)
Definition fltkui.cc:1639
static void widgetCallback(Fl_Widget *widget, void *data)
Definition fltkui.cc:1621
void pushGroup(const char *name, bool enabled)
Definition fltkui.cc:1700
void setItem(int index, bool selected)
Definition fltkui.cc:1693
void addItem(const char *str, bool enabled, bool selected)
Definition fltkui.cc:1684
void sizeRequest(core::Requisition *requisition)
Definition fltkui.cc:1733
void sizeRequest(core::Requisition *requisition)
Definition fltkui.cc:1095
Fl_Widget * createNewWidget(core::Allocation *allocation)
Definition fltkui.cc:1067
void setWidgetStyle(Fl_Widget *widget, core::style::Style *style)
Definition fltkui.cc:1082
void pushGroup(const char *name, bool enabled)
Definition fltkui.cc:1513
void addItem(const char *str, bool enabled, bool selected)
Definition fltkui.cc:1491
static void widgetCallback(Fl_Widget *widget, void *data)
Definition fltkui.cc:1416
void setWidgetStyle(Fl_Widget *widget, core::style::Style *style)
Definition fltkui.cc:1393
void sizeRequest(core::Requisition *requisition)
Definition fltkui.cc:1438
Fl_Widget * createNewWidget(core::Allocation *allocation)
Definition fltkui.cc:1405
void setItem(int index, bool selected)
Definition fltkui.cc:1507
lout::container::typed::Iterator< FltkRadioButtonResource > it
Definition fltkui.hh:404
FltkGroupIterator(lout::container::typed::List< FltkRadioButtonResource > *list)
Definition fltkui.hh:407
lout::container::typed::List< FltkRadioButtonResource > * list
Definition fltkui.hh:417
lout::container::typed::Iterator< FltkRadioButtonResource > iterator()
Definition fltkui.hh:426
void unconnect(FltkRadioButtonResource *radioButtonResource)
Definition fltkui.cc:1280
dw::core::ui::RadioButtonResource::GroupIterator * groupIterator()
Definition fltkui.hh:432
void connect(FltkRadioButtonResource *radioButtonResource)
Definition fltkui.cc:1274
Fl_Button * createNewButton(core::Allocation *allocation)
Definition fltkui.cc:1333
static void widgetCallback(Fl_Widget *widget, void *data)
Definition fltkui.cc:1317
virtual void detachView(FltkView *view)
Definition fltkui.cc:460
void setDisplayed(bool displayed)
Definition fltkui.cc:524
FltkPlatform * platform
Definition fltkui.hh:196
void init(FltkPlatform *platform)
This is not a constructor, since it calls some virtual methods, which should not be done in a C++ bas...
Definition fltkui.cc:421
void setEnabled(bool enabled)
Definition fltkui.cc:549
void setStyle(core::style::Style *style)
Definition fltkui.cc:489
void sizeAllocate(core::Allocation *allocation)
Definition fltkui.cc:468
virtual void attachView(FltkView *view)
Definition fltkui.cc:443
core::style::Style * style
Definition fltkui.hh:198
virtual void setWidgetStyle(Fl_Widget *widget, core::style::Style *style)
Definition fltkui.cc:500
void draw(core::View *view, core::Rectangle *area, core::DrawingContext *context)
Definition fltkui.cc:480
core::Allocation allocation
Definition fltkui.hh:195
virtual Fl_Widget * createNewWidget(core::Allocation *allocation)=0
virtual void pushGroup(const char *name, bool enabled)=0
dw::core::Iterator * iterator(dw::core::Content::Type mask, bool atEnd)
Definition fltkui.cc:1361
FltkSelectionResource(FltkPlatform *platform)
Definition fltkui.hh:469
virtual void addItem(const char *str, bool enabled, bool selected)=0
virtual void setItem(int index, bool selected)=0
void setStyle(core::style::Style *style)
Definition fltkui.cc:589
void draw(core::View *view, core::Rectangle *area, core::DrawingContext *context)
Definition fltkui.cc:581
void sizeAllocate(core::Allocation *allocation)
Definition fltkui.cc:575
void setEnabled(bool enabled)
Definition fltkui.cc:600
virtual Fl_Button * createNewButton(core::Allocation *allocation)=0
void sizeRequest(core::Requisition *requisition)
Definition fltkui.cc:1180
void setActivated(bool activated)
Definition fltkui.cc:1212
void setWidgetStyle(Fl_Widget *widget, core::style::Style *style)
Definition fltkui.cc:1170
Fl_Widget * createNewWidget(core::Allocation *allocation)
Definition fltkui.cc:1161
Typed version of container::untyped::List.
Definition container.hh:485
This is the base class for many other classes, which defines very common virtual methods.
Definition object.hh:25
#define I(x, y, z)
Dw is in this namespace, or sub namespaces of this one.
Represents the allocation, i.e.
Definition types.hh:164