Dillo
fltkplatform.hh
Go to the documentation of this file.
1 #ifndef __DW_FLTKPLATFORM_HH__
2 #define __DW_FLTKPLATFORM_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 namespace dw {
9 
13 namespace fltk {
14 
16 {
18  Fl_Font font[4];
19  public:
20  FontFamily (Fl_Font fontNormal, Fl_Font fontBold,
21  Fl_Font fontItalic, Fl_Font fontBoldItalic);
22  void set (Fl_Font, int attrs);
23  Fl_Font get (int attrs);
24  };
25 
27 
32 
34  ~FltkFont ();
35 
36  static void initSystemFonts ();
37 
38 public:
39  Fl_Font font;
40 
41  static FltkFont *create (core::style::FontAttrs *attrs);
42  static bool fontExists (const char *name);
43  static Fl_Font get (const char *name, int attrs);
44 };
45 
46 
48 {
51 
52  FltkColor (int color);
53  ~FltkColor ();
54 
55 public:
57 
58  static FltkColor *create(int color);
59 };
60 
62 {
63 private:
64  FltkTooltip (const char *text);
65  ~FltkTooltip ();
66 public:
67  static FltkTooltip *create(const char *text);
68  static void cancel();
69  void onEnter();
70  void onLeave();
71  void onMotion();
72 };
73 
74 
78 class FltkView: public core::View
79 {
80 public:
81  virtual bool usesFltkWidgets () = 0;
82 
83  virtual void addFltkWidget (Fl_Widget *widget,
84  core::Allocation *allocation);
85  virtual void removeFltkWidget (Fl_Widget *widget);
86  virtual void allocateFltkWidget (Fl_Widget *widget,
87  core::Allocation *allocation);
88  virtual void drawFltkWidget (Fl_Widget *widget, core::Rectangle *area);
89 };
90 
91 
93 {
94 private:
96  {
97  private:
99 
100  public:
101  inline void setPlatform (FltkPlatform *platform) {
102  this->platform = platform; }
103 
105  *label);
107  createComplexButtonResource (core::Widget *widget, bool relief);
110  int rows);
112  core::ui::EntryResource *createEntryResource (int size, bool password,
113  const char *label,
114  const char *placeholder);
116  int rows,
117  const char *placeholder);
119  activated);
122  *groupedWith, bool activated);
123  };
124 
126 
128  {
129  public:
130  int id;
131  void (core::Layout::*func) ();
132  };
133 
135 
139 
140  static void generalStaticIdle(void *data);
141  void generalIdle();
142 
145 
146 public:
147  FltkPlatform ();
148  ~FltkPlatform ();
149 
150  void setLayout (core::Layout *layout);
151 
152  void attachView (core::View *view);
153 
154  void detachView (core::View *view);
155 
156  int textWidth (core::style::Font *font, const char *text, int len);
157  char *textToUpper (const char *text, int len);
158  char *textToLower (const char *text, int len);
159  int nextGlyph (const char *text, int idx);
160  int prevGlyph (const char *text, int idx);
161  float dpiX ();
162  float dpiY ();
163 
164  int addIdle (void (core::Layout::*func) ());
165  void removeIdle (int idleId);
166 
168  bool tryEverything);
169  bool fontExists (const char *name);
170  core::style::Color *createColor (int color);
171  core::style::Tooltip *createTooltip (const char *text);
172  void cancelTooltip();
173 
174  core::Imgbuf *createImgbuf (core::Imgbuf::Type type, int width, int height,
175  double gamma);
176 
177  void copySelection(const char *text);
178 
180 
181  void attachResource (ui::FltkResource *resource);
182  void detachResource (ui::FltkResource *resource);
183 };
184 
185 } // namespace fltk
186 } // namespace dw
187 
188 #endif // __DW_FLTKPLATFORM_HH__
FltkPlatform * platform
Definition: fltkplatform.hh:98
core::Layout * layout
Definition: fltkplatform.hh:134
void detachResource(ui::FltkResource *resource)
Definition: fltkplatform.cc:724
virtual bool usesFltkWidgets()=0
const char * name
Definition: style.hh:683
Fl_Font font
Definition: fltkplatform.hh:39
int idleFuncId
Definition: fltkplatform.hh:138
virtual void addFltkWidget(Fl_Widget *widget, core::Allocation *allocation)
Definition: fltkplatform.cc:364
Definition: fltkplatform.hh:61
Definition: style.hh:751
void removeIdle(int idleId)
Remove an idle function, which has not been processed yet.
Definition: fltkplatform.cc:666
A factory for the common resource.
Definition: ui.hh:580
lout::container::typed::List< IdleFunc > * idleQueue
Definition: fltkplatform.hh:136
Typed version of container::untyped::HashTable.
Definition: container.hh:514
Definition: fltkplatform.hh:47
core::style::Font * createFont(core::style::FontAttrs *attrs, bool tryEverything)
Create a (platform dependent) font.
Definition: fltkplatform.cc:684
dw::core::Shape implemtation for simple rectangles.
Definition: types.hh:69
~FltkTooltip()
Definition: fltkplatform.cc:259
int id
Definition: fltkplatform.hh:130
void cancelTooltip()
Cancel a tooltip (either shown or requested)
Definition: fltkplatform.cc:333
SelectionMode
Definition: ui.hh:481
The central class for managing and drawing a widget tree.
Definition: layout.hh:16
This is the base class for many other classes, which defines very common virtual methods.
Definition: object.hh:24
Definition: ui.hh:527
static lout::container::typed::HashTable< lout::object::ConstString, FontFamily > * systemFonts
Definition: fltkplatform.hh:29
void onEnter()
Definition: fltkplatform.cc:281
int prevGlyph(const char *text, int idx)
Return the index of the previous glyph in string text.
Definition: fltkplatform.cc:597
static void cancel()
Definition: fltkplatform.cc:341
Definition: style.hh:768
~FltkPlatform()
Definition: fltkplatform.cc:465
core::Imgbuf * createImgbuf(core::Imgbuf::Type type, int width, int height, double gamma)
Create a (platform speficic) image buffer.
Definition: fltkplatform.cc:706
Definition: style.hh:730
float dpiY()
Return screen resolution in y-direction.
Definition: fltkplatform.cc:610
Definition: style.hh:698
static FltkColor * create(int color)
Definition: fltkplatform.cc:242
Type
Definition: imgbuf.hh:164
~FltkColor()
Definition: fltkplatform.cc:237
void(core::Layout::* func)()
Definition: fltkplatform.hh:131
Definition: fltkplatform.hh:127
core::ui::LabelButtonResource * createLabelButtonResource(const char *label)
Definition: fltkplatform.cc:384
int colors[SHADING_NUM]
Definition: fltkplatform.hh:56
core::ui::ResourceFactory * getResourceFactory()
Definition: fltkplatform.cc:712
void attachView(core::View *view)
This methods notifies the platform, that a view has been attached to the related layout.
Definition: fltkplatform.cc:482
core::ui::ComplexButtonResource * createComplexButtonResource(core::Widget *widget, bool relief)
Definition: fltkplatform.cc:391
Represents the allocation, i.e. actual position and size of a dw::core::Widget.
Definition: types.hh:163
Definition: fltkplatform.hh:15
Fl_Font font[4]
Definition: fltkplatform.hh:18
static void initSystemFonts()
Definition: fltkplatform.cc:140
FontFamily(Fl_Font fontNormal, Fl_Font fontBold, Fl_Font fontItalic, Fl_Font fontBoldItalic)
Definition: fltkplatform.cc:63
int color
Definition: style.hh:733
int nextGlyph(const char *text, int idx)
Return the index of the next glyph in string text.
Definition: fltkplatform.cc:592
lout::container::typed::List< ui::FltkResource > * resources
Definition: fltkplatform.hh:144
This interface adds some more methods for all flkt-based views.
Definition: fltkplatform.hh:78
virtual void removeFltkWidget(Fl_Widget *widget)
Definition: fltkplatform.cc:369
The base class of all dillo widgets.
Definition: widget.hh:23
Definition: style.hh:657
void detachView(core::View *view)
This methods notifies the platform, that a view has been detached from the related layout...
Definition: fltkplatform.cc:496
void setPlatform(FltkPlatform *platform)
Definition: fltkplatform.hh:101
core::ui::ListResource * createListResource(core::ui::ListResource::SelectionMode selectionMode, int rows)
Definition: fltkplatform.cc:399
void generalIdle()
Definition: fltkplatform.cc:623
static FltkFont * create(core::style::FontAttrs *attrs)
Definition: fltkplatform.cc:205
core::style::Color * createColor(int color)
Create a color resource for a given 0xrrggbb value.
Definition: fltkplatform.cc:691
void attachResource(ui::FltkResource *resource)
Definition: fltkplatform.cc:718
FltkFont(core::style::FontAttrs *attrs)
Definition: fltkplatform.cc:97
int addIdle(void(core::Layout::*func)())
Definition: fltkplatform.cc:645
Definition: fltkplatform.hh:17
FltkTooltip(const char *text)
Definition: fltkplatform.cc:255
virtual void drawFltkWidget(Fl_Widget *widget, core::Rectangle *area)
Definition: fltkplatform.cc:378
~FltkFont()
Definition: fltkplatform.cc:128
void onMotion()
Definition: fltkplatform.cc:360
void set(Fl_Font, int attrs)
Definition: fltkplatform.cc:72
core::ui::RadioButtonResource * createRadioButtonResource(core::ui::RadioButtonResource *groupedWith, bool activated)
Definition: fltkplatform.cc:439
Definition: ui.hh:478
FltkPlatform()
Definition: fltkplatform.cc:450
static void generalStaticIdle(void *data)
Definition: fltkplatform.cc:618
The platform independent interface for image buffers.
Definition: imgbuf.hh:161
core::ui::OptionMenuResource * createOptionMenuResource()
Definition: fltkplatform.cc:408
An object::Object wrapper for constant strings (char*).
Definition: object.hh:162
int textWidth(core::style::Font *font, const char *text, int len)
Return the width of a text, with a given length and font.
Definition: fltkplatform.cc:511
void copySelection(const char *text)
Copy selected text (0-terminated).
Definition: fltkplatform.cc:701
void onLeave()
Definition: fltkplatform.cc:327
core::ui::MultiLineTextResource * createMultiLineTextResource(int cols, int rows, const char *placeholder)
Definition: fltkplatform.cc:424
static FontFamily standardFontFamily
Definition: fltkplatform.hh:26
core::ui::CheckButtonResource * createCheckButtonResource(bool activated)
Definition: fltkplatform.cc:432
Dw is in this namespace, or sub namespaces of this one.
Definition: alignedtablecell.cc:28
FltkView * view
Definition: fltkplatform.hh:143
core::ui::EntryResource * createEntryResource(int size, bool password, const char *label, const char *placeholder)
Definition: fltkplatform.cc:414
An interface to encapsulate platform dependent drawing.
Definition: view.hh:16
Definition: fltkplatform.hh:92
virtual void allocateFltkWidget(Fl_Widget *widget, core::Allocation *allocation)
Definition: fltkplatform.cc:373
An interface to encapsulate some platform dependencies.
Definition: platform.hh:16
static lout::container::typed::HashTable< dw::core::style::FontAttrs, FltkFont > * fontsTable
Definition: fltkplatform.hh:31
core::style::Tooltip * createTooltip(const char *text)
Create a tooltip.
Definition: fltkplatform.cc:696
char * textToLower(const char *text, int len)
Return the string resulting from transforming text to lowercase.
Definition: fltkplatform.cc:577
FltkResourceFactory resourceFactory
Definition: fltkplatform.hh:125
static lout::container::typed::HashTable< dw::core::style::ColorAttrs, FltkColor > * colorsTable
Definition: fltkplatform.hh:50
bool idleFuncRunning
Definition: fltkplatform.hh:137
static FltkTooltip * create(const char *text)
Definition: fltkplatform.cc:265
Typed version of container::untyped::List.
Definition: container.hh:463
float dpiX()
Return screen resolution in x-direction.
Definition: fltkplatform.cc:602
char * textToUpper(const char *text, int len)
Return the string resulting from transforming text to uppercase.
Definition: fltkplatform.cc:562
Interface for labelled buttons resources.
Definition: ui.hh:399
Definition: fltkplatform.hh:95
static bool fontExists(const char *name)
Definition: fltkplatform.cc:177
bool fontExists(const char *name)
Definition: fltkplatform.cc:199
FltkColor(int color)
Definition: fltkplatform.cc:223
Definition: style.hh:680
Definition: fltkui.hh:187
void setLayout(core::Layout *layout)
This methods notifies the platform, that it has been attached to a layout.
Definition: fltkplatform.cc:475