Dillo v3.2.0-88-g47ab7c70
Loading...
Searching...
No Matches
platform.hh
Go to the documentation of this file.
1/*
2 * Dillo Widget
3 *
4 * Copyright 2005-2013 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_PLATFORM_HH__
22#define __DW_PLATFORM_HH__
23
24#ifndef __INCLUDED_FROM_DW_CORE_HH__
25# error Do not include this file directly, use "core.hh" instead.
26#endif
27
28namespace dw {
29namespace core {
30
37{
38public:
39 /*
40 * -----------------------------------
41 * General
42 * -----------------------------------
43 */
44
49 virtual void setLayout (Layout *layout) = 0;
50
51 /*
52 * -------------------------
53 * Operations on views
54 * -------------------------
55 */
56
61 virtual void attachView (View *view) = 0;
62
67 virtual void detachView (View *view) = 0;
68
69 /*
70 * -----------------------------------
71 * Platform dependent properties
72 * -----------------------------------
73 */
74
78 virtual int textWidth (style::Font *font, const char *text, int len) = 0;
79
83 virtual char *textToUpper (const char *text, int len) = 0;
84
88 virtual char *textToLower (const char *text, int len) = 0;
89
93 virtual int nextGlyph (const char *text, int idx) = 0;
94
98 virtual int prevGlyph (const char *text, int idx) = 0;
99
103 virtual float dpiX () = 0;
104
108 virtual float dpiY () = 0;
109
110 /*
111 * ---------------------------------------------------------
112 * These are to encapsulate some platform dependencies
113 * ---------------------------------------------------------
114 */
115
124 virtual int addIdle (void (Layout::*func) ()) = 0;
125
129 virtual void removeIdle (int idleId) = 0;
130
131 /*
132 * ---------------------
133 * Style Resources
134 * ---------------------
135 */
136
151 bool tryEverything) = 0;
152
153 virtual bool fontExists (const char *name) = 0;
154
158 virtual style::Color *createColor (int color) = 0;
159
163 virtual style::Tooltip *createTooltip (const char *text) = 0;
164
168 virtual void cancelTooltip () = 0;
169
175 virtual Imgbuf *createImgbuf (Imgbuf::Type type, int width, int height,
176 double gamma) = 0;
177
181 virtual void copySelection(const char *text, int destination) = 0;
182
187};
188
189} // namespace core
190} // namespace dw
191
192#endif // __DW_PLATFORM_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
virtual float dpiX()=0
Return screen resolution in x-direction.
virtual int textWidth(style::Font *font, const char *text, int len)=0
Return the width of a text, with a given length and font.
virtual ui::ResourceFactory * getResourceFactory()=0
...
virtual void removeIdle(int idleId)=0
Remove an idle function, which has not been processed yet.
virtual int nextGlyph(const char *text, int idx)=0
Return the index of the next glyph in string text.
virtual void copySelection(const char *text, int destination)=0
Copy selected text (0-terminated).
virtual void detachView(View *view)=0
This methods notifies the platform, that a view has been detached from the related layout.
virtual style::Tooltip * createTooltip(const char *text)=0
Create a tooltip.
virtual void attachView(View *view)=0
This methods notifies the platform, that a view has been attached to the related layout.
virtual char * textToUpper(const char *text, int len)=0
Return the string resulting from transforming text to uppercase.
virtual style::Color * createColor(int color)=0
Create a color resource for a given 0xrrggbb value.
virtual void setLayout(Layout *layout)=0
This methods notifies the platform, that it has been attached to a layout.
virtual char * textToLower(const char *text, int len)=0
Return the string resulting from transforming text to lowercase.
virtual void cancelTooltip()=0
Cancel a tooltip (either shown or requested)
virtual int addIdle(void(Layout::*func)())=0
Add an idle function.
virtual float dpiY()=0
Return screen resolution in y-direction.
virtual style::Font * createFont(style::FontAttrs *attrs, bool tryEverything)=0
Create a (platform dependent) font.
virtual int prevGlyph(const char *text, int idx)=0
Return the index of the previous glyph in string text.
virtual Imgbuf * createImgbuf(Imgbuf::Type type, int width, int height, double gamma)=0
Create a (platform specific) image buffer.
virtual bool fontExists(const char *name)=0
An interface to encapsulate platform dependent drawing.
Definition view.hh:17
A factory for the common resource.
Definition ui.hh:581
This is the base class for many other classes, which defines very common virtual methods.
Definition object.hh:45
static Layout * layout
Dw is in this namespace, or sub namespaces of this one.