Dillo
platform.hh
Go to the documentation of this file.
1 #ifndef __DW_PLATFORM_HH__
2 #define __DW_PLATFORM_HH__
3 
4 #ifndef __INCLUDED_FROM_DW_CORE_HH__
5 # error Do not include this file directly, use "core.hh" instead.
6 #endif
7 
8 namespace dw {
9 namespace core {
10 
17 {
18 public:
19  /*
20  * -----------------------------------
21  * General
22  * -----------------------------------
23  */
24 
29  virtual void setLayout (Layout *layout) = 0;
30 
31  /*
32  * -------------------------
33  * Operations on views
34  * -------------------------
35  */
36 
41  virtual void attachView (View *view) = 0;
42 
47  virtual void detachView (View *view) = 0;
48 
49  /*
50  * -----------------------------------
51  * Platform dependent properties
52  * -----------------------------------
53  */
54 
58  virtual int textWidth (style::Font *font, const char *text, int len) = 0;
59 
63  virtual char *textToUpper (const char *text, int len) = 0;
64 
68  virtual char *textToLower (const char *text, int len) = 0;
69 
73  virtual int nextGlyph (const char *text, int idx) = 0;
74 
78  virtual int prevGlyph (const char *text, int idx) = 0;
79 
83  virtual float dpiX () = 0;
84 
88  virtual float dpiY () = 0;
89 
90  /*
91  * ---------------------------------------------------------
92  * These are to encapsulate some platform dependencies
93  * ---------------------------------------------------------
94  */
95 
104  virtual int addIdle (void (Layout::*func) ()) = 0;
105 
109  virtual void removeIdle (int idleId) = 0;
110 
111  /*
112  * ---------------------
113  * Style Resources
114  * ---------------------
115  */
116 
129  virtual style::Font *createFont (style::FontAttrs *attrs,
130  bool tryEverything) = 0;
131 
132  virtual bool fontExists (const char *name) = 0;
133 
137  virtual style::Color *createColor (int color) = 0;
138 
142  virtual style::Tooltip *createTooltip (const char *text) = 0;
143 
147  virtual void cancelTooltip () = 0;
148 
154  virtual Imgbuf *createImgbuf (Imgbuf::Type type, int width, int height,
155  double gamma) = 0;
156 
160  virtual void copySelection(const char *text) = 0;
161 
165  virtual ui::ResourceFactory *getResourceFactory () = 0;
166 };
167 
168 } // namespace core
169 } // namespace dw
170 
171 #endif // __DW_PLATFORM_HH__
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 char * textToLower(const char *text, int len)=0
Return the string resulting from transforming text to lowercase.
Definition: style.hh:751
A factory for the common resource.
Definition: ui.hh:580
virtual int nextGlyph(const char *text, int idx)=0
Return the index of the next glyph in string text.
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
virtual void removeIdle(int idleId)=0
Remove an idle function, which has not been processed yet.
static Layout * layout
Definition: dw_anchors_test.cc:38
virtual bool fontExists(const char *name)=0
virtual style::Tooltip * createTooltip(const char *text)=0
Create a tooltip.
Definition: style.hh:698
Type
Definition: imgbuf.hh:164
virtual void setLayout(Layout *layout)=0
This methods notifies the platform, that it has been attached to a layout.
virtual ui::ResourceFactory * getResourceFactory()=0
virtual void cancelTooltip()=0
Cancel a tooltip (either shown or requested)
virtual int addIdle(void(Layout::*func)())=0
Add an idle function.
Definition: style.hh:657
virtual float dpiY()=0
Return screen resolution in y-direction.
virtual void copySelection(const char *text)=0
Copy selected text (0-terminated).
The platform independent interface for image buffers.
Definition: imgbuf.hh:161
virtual float dpiX()=0
Return screen resolution in x-direction.
virtual style::Color * createColor(int color)=0
Create a color resource for a given 0xrrggbb value.
virtual style::Font * createFont(style::FontAttrs *attrs, bool tryEverything)=0
Create a (platform dependent) font.
Dw is in this namespace, or sub namespaces of this one.
Definition: alignedtablecell.cc:28
An interface to encapsulate platform dependent drawing.
Definition: view.hh:16
An interface to encapsulate some platform dependencies.
Definition: platform.hh:16
virtual int prevGlyph(const char *text, int idx)=0
Return the index of the previous glyph in string text.
virtual void detachView(View *view)=0
This methods notifies the platform, that a view has been detached from the related layout...
virtual Imgbuf * createImgbuf(Imgbuf::Type type, int width, int height, double gamma)=0
Create a (platform speficic) image buffer.
Definition: style.hh:680
virtual int textWidth(style::Font *font, const char *text, int len)=0
Return the width of a text, with a given length and font.