Dillo
fltkpreview.hh
Go to the documentation of this file.
1 #ifndef __FlTKPREVIEW_HH__
2 #define __FlTKPREVIEW_HH__
3 
4 #include <FL/Fl_Button.H>
5 #include <FL/Fl_Menu_Window.H>
6 #include "fltkviewbase.hh"
7 
8 namespace dw {
9 namespace fltk {
10 
12 {
13  friend class FltkPreviewWindow;
14 
15 private:
17 
18 protected:
19  int translateViewXToCanvasX (int x);
20  int translateViewYToCanvasY (int y);
21  int translateCanvasXToViewX (int x);
22  int translateCanvasYToViewY (int y);
23 
24 public:
25  FltkPreview (int x, int y, int w, int h, dw::core::Layout *layout,
26  const char *label = 0);
27  ~FltkPreview ();
28 
29  int handle (int event);
30 
31  void setCanvasSize (int width, int ascent, int descent);
32 
33  bool usesViewport ();
36  void scrollTo (int x, int y);
38  void setViewportSize (int width, int height,
39  int hScrollbarThickness, int vScrollbarThickness);
40 
41  void drawText (core::style::Font *font,
42  core::style::Color *color,
44  int x, int y, const char *text, int len);
46  core::style::Color *color,
48  int x, int y, int w, int h,
49  const char *text);
50  void drawImage (core::Imgbuf *imgbuf, int xRoot, int yRoot,
51  int x, int y, int width, int height);
52 
53  bool usesFltkWidgets ();
54  void drawFltkWidget (Fl_Widget *widget, core::Rectangle *area);
55 };
56 
57 
58 class FltkPreviewWindow: public Fl_Menu_Window
59 {
60 private:
61  enum { BORDER_WIDTH = 2 };
62 
64  int posX, posY;
65 
66 public:
69 
70  void reallocate ();
71 
72  void showWindow ();
73  void hideWindow ();
74 
75  void scrollTo (int mouseX, int mouseY);
76 };
77 
78 
79 class FltkPreviewButton: public Fl_Button
80 {
81 private:
83 
84 public:
85  FltkPreviewButton (int x, int y, int w, int h,
86  dw::core::Layout *layout, const char *label = 0);
88 
89  int handle (int event);
90 };
91 
92 } // namespace fltk
93 } // namespace dw
94 
95 #endif // __FlTKPREVIEW_HH__
void drawImage(core::Imgbuf *imgbuf, int xRoot, int yRoot, int x, int y, int width, int height)
Definition: fltkpreview.cc:157
Definition: fltkviewbase.hh:15
Definition: fltkpreview.hh:61
FltkPreviewWindow * window
Definition: fltkpreview.hh:82
Definition: style.hh:751
Shading
Definition: style.hh:767
dw::core::Shape implemtation for simple rectangles.
Definition: types.hh:69
int scrollHeight
Definition: fltkpreview.hh:16
int getHScrollbarThickness()
Get the thickness of the horizontal scrollbar, when it is visible.
Definition: fltkpreview.cc:88
FltkPreview * preview
Definition: fltkpreview.hh:63
FltkPreviewWindow(dw::core::Layout *layout)
Definition: fltkpreview.cc:174
The central class for managing and drawing a widget tree.
Definition: layout.hh:16
int getVScrollbarThickness()
Get the thickness of the vertical scrollbar, when it is visible.
Definition: fltkpreview.cc:93
void scroll(dw::core::ScrollCommand cmd)
Scroll the viewport as commanded.
Definition: fltkpreview.cc:104
static Layout * layout
Definition: dw_anchors_test.cc:38
int handle(int event)
Definition: fltkpreview.cc:280
FltkPreviewButton(int x, int y, int w, int h, dw::core::Layout *layout, const char *label=0)
Definition: fltkpreview.cc:267
int translateCanvasXToViewX(int x)
Definition: fltkpreview.cc:66
Definition: style.hh:698
void reallocate()
Definition: fltkpreview.cc:196
void setViewportSize(int width, int height, int hScrollbarThickness, int vScrollbarThickness)
Set the viewport size.
Definition: fltkpreview.cc:109
Definition: fltkpreview.hh:58
void hideWindow()
Definition: fltkpreview.cc:248
int translateViewYToCanvasY(int y)
Definition: fltkpreview.cc:61
bool usesViewport()
Return, whether this view uses a viewport.
Definition: fltkpreview.cc:83
int scrollWidth
Definition: fltkpreview.hh:16
int posX
Definition: fltkpreview.hh:64
FltkPreview(int x, int y, int w, int h, dw::core::Layout *layout, const char *label=0)
Definition: fltkpreview.cc:35
int posY
Definition: fltkpreview.hh:64
void setCanvasSize(int width, int ascent, int descent)
Set the canvas size.
Definition: fltkpreview.cc:76
int translateCanvasYToViewY(int y)
Definition: fltkpreview.cc:71
~FltkPreview()
Definition: fltkpreview.cc:47
void drawFltkWidget(Fl_Widget *widget, core::Rectangle *area)
Definition: fltkpreview.cc:167
~FltkPreviewWindow()
Definition: fltkpreview.cc:186
int translateViewXToCanvasX(int x)
Definition: fltkpreview.cc:56
The platform independent interface for image buffers.
Definition: imgbuf.hh:161
Definition: fltkpreview.hh:11
int handle(int event)
Definition: fltkpreview.cc:51
void showWindow()
Definition: fltkpreview.cc:190
Dw is in this namespace, or sub namespaces of this one.
Definition: alignedtablecell.cc:28
static core::Imgbuf * imgbuf
Definition: dw_images_scaled.cc:38
void scrollTo(int x, int y)
Scroll the vieport to the given position.
Definition: fltkpreview.cc:98
void drawText(core::style::Font *font, core::style::Color *color, core::style::Color::Shading shading, int x, int y, const char *text, int len)
Definition: fltkpreview.cc:117
~FltkPreviewButton()
Definition: fltkpreview.cc:276
int scrollX
Definition: fltkpreview.hh:16
void drawSimpleWrappedText(core::style::Font *font, core::style::Color *color, core::style::Color::Shading shading, int x, int y, int w, int h, const char *text)
Definition: fltkpreview.cc:149
int scrollY
Definition: fltkpreview.hh:16
ScrollCommand
Definition: types.hh:35
void scrollTo(int mouseX, int mouseY)
Definition: fltkpreview.cc:253
bool usesFltkWidgets()
Definition: fltkpreview.cc:162
Definition: fltkpreview.hh:79