Dillo v3.2.0-88-g47ab7c70
Loading...
Searching...
No Matches
fltkplatform.hh
Go to the documentation of this file.
1/*
2 * Dillo Widget
3 *
4 * Copyright 2005-2007 Sebastian Geerken <sgeerken@dillo.org>
5 * Copyright 2025 Rodrigo Arias Mallo <rodarima@gmail.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 */
20
21#ifndef __DW_FLTKPLATFORM_HH__
22#define __DW_FLTKPLATFORM_HH__
23
24#ifndef __INCLUDED_FROM_DW_FLTK_CORE_HH__
25# error Do not include this file directly, use "fltkcore.hh" instead.
26#endif
27
28namespace dw {
29
33namespace fltk {
34
36{
38 Fl_Font font[4];
39 public:
40 FontFamily (Fl_Font fontNormal, Fl_Font fontBold,
41 Fl_Font fontItalic, Fl_Font fontBoldItalic);
42 void set (Fl_Font, int attrs);
43 Fl_Font get (int attrs);
44 };
45
47
52
54 ~FltkFont ();
55
56 static void initSystemFonts ();
57
58public:
59 Fl_Font font;
60
61 static FltkFont *create (core::style::FontAttrs *attrs);
62 static bool fontExists (const char *name);
63 static Fl_Font get (const char *name, int attrs);
64};
65
66
80
82{
83private:
84 FltkTooltip (const char *text);
85 ~FltkTooltip ();
86public:
87 static FltkTooltip *create(const char *text);
88 static void cancel();
89 void onEnter();
90 void onLeave();
91 void onMotion();
92};
93
94
98class FltkView: public core::View
99{
100public:
101 virtual bool usesFltkWidgets () = 0;
102
103 virtual void addFltkWidget (Fl_Widget *widget,
104 core::Allocation *allocation);
105 virtual void removeFltkWidget (Fl_Widget *widget);
106 virtual void allocateFltkWidget (Fl_Widget *widget,
107 core::Allocation *allocation);
108 virtual void drawFltkWidget (Fl_Widget *widget, core::Rectangle *area);
109};
110
111
113{
114private:
116 {
117 private:
119
120 public:
122 this->platform = platform; }
123
125 *label);
127 createComplexButtonResource (core::Widget *widget, bool relief);
130 int rows);
132 core::ui::EntryResource *createEntryResource (int size, bool password,
133 const char *label,
134 const char *placeholder);
136 int rows,
137 const char *placeholder);
139 activated);
142 *groupedWith, bool activated);
143 };
144
146
148 {
149 public:
150 int id;
151 void (core::Layout::*func) ();
152 };
153
155
156 lout::container::typed::List <IdleFunc> *idleQueue;
159
160 static void generalStaticIdle(void *data);
161 void generalIdle();
162
164 lout::container::typed::List <ui::FltkResource> *resources;
165
166public:
167 FltkPlatform ();
168 ~FltkPlatform ();
169
171
172 void attachView (core::View *view);
173
174 void detachView (core::View *view);
175
176 int textWidth (core::style::Font *font, const char *text, int len);
177 char *textToUpper (const char *text, int len);
178 char *textToLower (const char *text, int len);
179 int nextGlyph (const char *text, int idx);
180 int prevGlyph (const char *text, int idx);
181 float dpiX ();
182 float dpiY ();
183
184 int addIdle (void (core::Layout::*func) ());
185 void removeIdle (int idleId);
186
188 bool tryEverything);
189 bool fontExists (const char *name);
190 core::style::Color *createColor (int color);
191 core::style::Tooltip *createTooltip (const char *text);
192 void cancelTooltip();
193
194 core::Imgbuf *createImgbuf (core::Imgbuf::Type type, int width, int height,
195 double gamma);
196
197 void copySelection(const char *text, int destination);
198
200
201 void attachResource (ui::FltkResource *resource);
202 void detachResource (ui::FltkResource *resource);
203};
204
205} // namespace fltk
206} // namespace dw
207
208#endif // __DW_FLTKPLATFORM_HH__
The platform independent interface for image buffers.
Definition imgbuf.hh:162
The central class for managing and drawing a widget tree.
Definition layout.hh:37
An interface to encapsulate some platform dependencies.
Definition platform.hh:37
dw::core::Shape implementation 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
Interface for labelled buttons resources.
Definition ui.hh:400
A factory for the common resource.
Definition ui.hh:581
static FltkColor * create(int color)
static lout::container::typed::HashTable< dw::core::style::ColorAttrs, FltkColor > * colorsTable
int colors[SHADING_NUM]
void set(Fl_Font, int attrs)
static FontFamily standardFontFamily
static bool fontExists(const char *name)
static FltkFont * create(core::style::FontAttrs *attrs)
static lout::container::typed::HashTable< lout::object::ConstString, FontFamily > * systemFonts
static Fl_Font get(const char *name, int attrs)
static void initSystemFonts()
static lout::container::typed::HashTable< dw::core::style::FontAttrs, FltkFont > * fontsTable
core::ui::LabelButtonResource * createLabelButtonResource(const char *label)
core::ui::OptionMenuResource * createOptionMenuResource()
core::ui::ComplexButtonResource * createComplexButtonResource(core::Widget *widget, bool relief)
core::ui::RadioButtonResource * createRadioButtonResource(core::ui::RadioButtonResource *groupedWith, bool activated)
core::ui::MultiLineTextResource * createMultiLineTextResource(int cols, int rows, const char *placeholder)
core::ui::ListResource * createListResource(core::ui::ListResource::SelectionMode selectionMode, int rows)
void setPlatform(FltkPlatform *platform)
core::ui::EntryResource * createEntryResource(int size, bool password, const char *label, const char *placeholder)
core::ui::CheckButtonResource * createCheckButtonResource(bool activated)
void(core::Layout::* func)()
static void generalStaticIdle(void *data)
float dpiX()
Return screen resolution in x-direction.
int nextGlyph(const char *text, int idx)
Return the index of the next glyph in string text.
int addIdle(void(core::Layout::*func)())
core::Imgbuf * createImgbuf(core::Imgbuf::Type type, int width, int height, double gamma)
Create a (platform specific) image buffer.
int prevGlyph(const char *text, int idx)
Return the index of the previous glyph in string text.
void copySelection(const char *text, int destination)
Copy selected text (0-terminated).
void setLayout(core::Layout *layout)
This methods notifies the platform, that it has been attached to a layout.
bool fontExists(const char *name)
void removeIdle(int idleId)
Remove an idle function, which has not been processed yet.
core::style::Color * createColor(int color)
Create a color resource for a given 0xrrggbb value.
FltkResourceFactory resourceFactory
lout::container::typed::List< ui::FltkResource > * resources
float dpiY()
Return screen resolution in y-direction.
void attachResource(ui::FltkResource *resource)
lout::container::typed::List< IdleFunc > * idleQueue
char * textToLower(const char *text, int len)
Return the string resulting from transforming text to lowercase.
core::style::Tooltip * createTooltip(const char *text)
Create a tooltip.
core::ui::ResourceFactory * getResourceFactory()
...
void detachResource(ui::FltkResource *resource)
void detachView(core::View *view)
This methods notifies the platform, that a view has been detached from the related layout.
core::style::Font * createFont(core::style::FontAttrs *attrs, bool tryEverything)
Create a (platform dependent) font.
int textWidth(core::style::Font *font, const char *text, int len)
Return the width of a text, with a given length and font.
void attachView(core::View *view)
This methods notifies the platform, that a view has been attached to the related layout.
void cancelTooltip()
Cancel a tooltip (either shown or requested)
char * textToUpper(const char *text, int len)
Return the string resulting from transforming text to uppercase.
static FltkTooltip * create(const char *text)
This interface adds some more methods for all flkt-based views.
virtual void drawFltkWidget(Fl_Widget *widget, core::Rectangle *area)
virtual void removeFltkWidget(Fl_Widget *widget)
virtual void addFltkWidget(Fl_Widget *widget, core::Allocation *allocation)
virtual void allocateFltkWidget(Fl_Widget *widget, core::Allocation *allocation)
virtual bool usesFltkWidgets()=0
Typed version of container::untyped::HashTable.
Definition container.hh:536
An object::Object wrapper for constant strings (char*).
Definition object.hh:183
This is the base class for many other classes, which defines very common virtual methods.
Definition object.hh:45
Dw is in this namespace, or sub namespaces of this one.
Represents the allocation, i.e.
Definition types.hh:164