Dillo v3.1.1-46-g8a360e32
Loading...
Searching...
No Matches
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
8namespace dw {
9namespace fltk {
10
12{
13 friend class FltkPreviewWindow;
14
15private:
17
18protected:
19 int translateViewXToCanvasX (int x);
20 int translateViewYToCanvasY (int y);
21 int translateCanvasXToViewX (int x);
22 int translateCanvasYToViewY (int y);
23
24public:
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
58class FltkPreviewWindow: public Fl_Menu_Window
59{
60private:
61 enum { BORDER_WIDTH = 2 };
62
64 int posX, posY;
65
66public:
69
70 void reallocate ();
71
72 void showWindow ();
73 void hideWindow ();
74
75 void scrollTo (int mouseX, int mouseY);
76};
77
78
79class FltkPreviewButton: public Fl_Button
80{
81private:
83
84public:
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__
The platform independent interface for image buffers.
Definition imgbuf.hh:162
The central class for managing and drawing a widget tree.
Definition layout.hh:17
dw::core::Shape implemtation for simple rectangles.
Definition types.hh:70
FltkPreviewWindow * window
void scrollTo(int mouseX, int mouseY)
void drawFltkWidget(Fl_Widget *widget, core::Rectangle *area)
void drawText(core::style::Font *font, core::style::Color *color, core::style::Color::Shading shading, int x, int y, const char *text, int len)
bool usesViewport()
Return, whether this view uses a viewport.
int getVScrollbarThickness()
Get the thickness of the vertical scrollbar, when it is visible.
int translateCanvasYToViewY(int y)
void scrollTo(int x, int y)
Scroll the vieport to the given position.
int handle(int event)
void scroll(dw::core::ScrollCommand cmd)
Scroll the viewport as commanded.
void drawImage(core::Imgbuf *imgbuf, int xRoot, int yRoot, int x, int y, int width, int height)
int translateViewXToCanvasX(int x)
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)
int translateCanvasXToViewX(int x)
int getHScrollbarThickness()
Get the thickness of the horizontal scrollbar, when it is visible.
void setViewportSize(int width, int height, int hScrollbarThickness, int vScrollbarThickness)
Set the viewport size.
void setCanvasSize(int width, int ascent, int descent)
Set the canvas size.
int translateViewYToCanvasY(int y)
static Layout * layout
static core::Imgbuf * imgbuf
ScrollCommand
Definition types.hh:35
Dw is in this namespace, or sub namespaces of this one.