aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Hofmann <Johannes.Hofmann@gmx.de>2008-11-13 16:18:56 +0100
committerJohannes Hofmann <Johannes.Hofmann@gmx.de>2008-11-13 16:18:56 +0100
commitdfc9e510aedb52375da02a8776259d21ecf14587 (patch)
tree17054b06a3452a0c563701a6afc623286e58e51a
parent7b81c09bb70cdfd59f80685eb218b1b883f04240 (diff)
add dpiX () / dpiY () methods to Platform and Layout
-rw-r--r--dw/fltkplatform.cc11
-rw-r--r--dw/fltkplatform.hh2
-rw-r--r--dw/layout.hh10
-rw-r--r--dw/platform.hh10
4 files changed, 33 insertions, 0 deletions
diff --git a/dw/fltkplatform.cc b/dw/fltkplatform.cc
index 337f4dba..1d83dbb8 100644
--- a/dw/fltkplatform.cc
+++ b/dw/fltkplatform.cc
@@ -25,6 +25,7 @@
#include <fltk/draw.h>
#include <fltk/run.h>
#include <fltk/events.h>
+#include <fltk/Monitor.h>
#include <fltk/utf.h>
#include <stdio.h>
@@ -301,6 +302,16 @@ int FltkPlatform::prevGlyph (const char *text, int idx)
return utf8back (&text[idx - 1], text, &text[strlen (text)]) - text;
}
+float FltkPlatform::dpiX ()
+{
+ return ::fltk::Monitor::all ().dpi_x ();
+}
+
+float FltkPlatform::dpiY ()
+{
+ return ::fltk::Monitor::all ().dpi_y ();
+}
+
void FltkPlatform::generalStaticIdle (void *data)
{
((FltkPlatform*)data)->generalIdle();
diff --git a/dw/fltkplatform.hh b/dw/fltkplatform.hh
index 7b3d3e73..e7493fba 100644
--- a/dw/fltkplatform.hh
+++ b/dw/fltkplatform.hh
@@ -125,6 +125,8 @@ public:
int textWidth (core::style::Font *font, const char *text, int len);
int nextGlyph (const char *text, int idx);
int prevGlyph (const char *text, int idx);
+ float dpiX ();
+ float dpiY ();
int addIdle (void (core::Layout::*func) ());
void removeIdle (int idleId);
diff --git a/dw/layout.hh b/dw/layout.hh
index 13b8f312..292024a2 100644
--- a/dw/layout.hh
+++ b/dw/layout.hh
@@ -216,6 +216,16 @@ public:
return platform->prevGlyph (text, idx);
}
+ inline float dpiX ()
+ {
+ return platform->dpiX ();
+ }
+
+ inline float dpiY ()
+ {
+ return platform->dpiY ();
+ }
+
inline style::Font *createFont (style::FontAttrs *attrs, bool tryEverything)
{
return platform->createFont (attrs, tryEverything);
diff --git a/dw/platform.hh b/dw/platform.hh
index 0ae5d508..4dcb2681 100644
--- a/dw/platform.hh
+++ b/dw/platform.hh
@@ -66,6 +66,16 @@ public:
* \brief Return the index of the previous glyph in string text.
*/
virtual int prevGlyph (const char *text, int idx) = 0;
+
+ /**
+ * \brief Return screen resolution in x-direction.
+ */
+ virtual float dpiX () = 0;
+
+ /**
+ * \brief Return screen resolution in y-direction.
+ */
+ virtual float dpiY () = 0;
/*
* ---------------------------------------------------------