Dillo
fltkviewport.hh
Go to the documentation of this file.
1 #ifndef __DW_FLTKVIEWPORT_HH__
2 #define __DW_FLTKVIEWPORT_HH__
3 
4 #include <FL/Fl_Group.H>
5 #include <FL/Fl_Scrollbar.H>
6 
7 #include "core.hh"
8 #include "fltkcore.hh"
9 #include "fltkviewbase.hh"
10 
11 namespace dw {
12 namespace fltk {
13 
15 {
16 public:
18 
19 private:
20  enum { SCROLLBAR_THICKNESS = 15 };
21 
26 
27  Fl_Scrollbar *vscrollbar, *hscrollbar;
28 
32 
34  void adjustScrollbarValues ();
35  void hscrollbarChanged ();
36  void vscrollbarChanged ();
37  void positionChanged ();
38 
39  static void hscrollbarCallback (Fl_Widget *hscrollbar, void *viewportPtr);
40  static void vscrollbarCallback (Fl_Widget *vscrollbar, void *viewportPtr);
41 
42  void selectionScroll();
43  static void selectionScroll(void *vport);
44 
45  void updateCanvasWidgets (int oldScrollX, int oldScrollY);
46  static void draw_area (void *data, int x, int y, int w, int h);
47 
48 protected:
49  int translateViewXToCanvasX (int x);
50  int translateViewYToCanvasY (int y);
51  int translateCanvasXToViewX (int x);
52  int translateCanvasYToViewY (int y);
53 
54 public:
55  FltkViewport (int x, int y, int w, int h, const char *label = 0);
56  ~FltkViewport ();
57 
58  void resize(int x, int y, int w, int h);
59  void draw ();
60  int handle (int event);
61 
62  void setCanvasSize (int width, int ascent, int descent);
63 
64  bool usesViewport ();
67  void scroll(int dx, int dy);
69  void scrollTo (int x, int y);
70  void setViewportSize (int width, int height,
71  int hScrollbarThickness, int vScrollbarThickness);
72  void setScrollStep(int step);
73 
74  void setGadgetOrientation (bool hscrollbarVisible, bool vscrollbarVisible,
75  GadgetOrientation gadgetOrientation);
76  void setDragScroll (bool enable) { hasDragScroll = enable ? 1 : 0; }
77  void addGadget (Fl_Widget *gadget);
78 };
79 
80 } // namespace fltk
81 } // namespace dw
82 
83 #endif // __DW_FLTKVIEWPORT_HH__
84 
Definition: fltkviewport.hh:20
Definition: fltkviewbase.hh:111
FltkViewport(int x, int y, int w, int h, const char *label=0)
Definition: fltkviewport.cc:54
Fl_Scrollbar * vscrollbar
Definition: fltkviewport.hh:27
int dragY
Definition: fltkviewport.hh:24
void resize(int x, int y, int w, int h)
Definition: fltkviewport.cc:171
int hasDragScroll
Definition: fltkviewport.hh:24
int horScrolling
Definition: fltkviewport.hh:25
Definition: fltkviewport.hh:17
int handle(int event)
Definition: fltkviewport.cc:240
void hscrollbarChanged()
Definition: fltkviewport.cc:149
static void draw_area(void *data, int x, int y, int w, int h)
Definition: fltkviewport.cc:182
void updateCanvasWidgets(int oldScrollX, int oldScrollY)
Definition: fltkviewport.cc:504
void setViewportSize(int width, int height, int hScrollbarThickness, int vScrollbarThickness)
Set the viewport size.
Definition: fltkviewport.cc:478
int getVScrollbarThickness()
Get the thickness of the vertical scrollbar, when it is visible.
Definition: fltkviewport.cc:386
int scrollDX
Definition: fltkviewport.hh:23
int translateCanvasXToViewX(int x)
Definition: fltkviewport.cc:527
int scrollDY
Definition: fltkviewport.hh:23
Definition: fltkviewport.hh:14
void scrollTo(int x, int y)
Scroll the vieport to the given position.
Definition: fltkviewport.cc:391
GadgetOrientation
Definition: fltkviewport.hh:17
void setDragScroll(bool enable)
Definition: fltkviewport.hh:76
int translateViewYToCanvasY(int y)
Definition: fltkviewport.cc:522
void adjustScrollbarValues()
Definition: fltkviewport.cc:143
int translateCanvasYToViewY(int y)
Definition: fltkviewport.cc:532
int scrollX
Definition: fltkviewport.hh:22
int dragX
Definition: fltkviewport.hh:24
lout::container::typed::List< lout::object::TypedPointer< Fl_Widget > > * gadgets
Definition: fltkviewport.hh:31
static void hscrollbarCallback(Fl_Widget *hscrollbar, void *viewportPtr)
Definition: fltkviewport.cc:164
~FltkViewport()
Definition: fltkviewport.cc:85
bool usesViewport()
Return, whether this view uses a viewport.
Definition: fltkviewport.cc:376
void positionChanged()
Definition: fltkviewport.cc:356
int translateViewXToCanvasX(int x)
Definition: fltkviewport.cc:517
void setGadgetOrientation(bool hscrollbarVisible, bool vscrollbarVisible, GadgetOrientation gadgetOrientation)
Definition: fltkviewport.cc:539
void selectionScroll()
Definition: fltkviewport.cc:455
int scrollY
Definition: fltkviewport.hh:22
int getHScrollbarThickness()
Get the thickness of the horizontal scrollbar, when it is visible.
Definition: fltkviewport.cc:381
void draw()
Definition: fltkviewport.cc:205
void setScrollStep(int step)
Definition: fltkviewport.cc:370
static void vscrollbarCallback(Fl_Widget *vscrollbar, void *viewportPtr)
Definition: fltkviewport.cc:159
void setCanvasSize(int width, int ascent, int descent)
Set the canvas size.
Definition: fltkviewport.cc:347
int dragScrolling
Definition: fltkviewport.hh:24
Dw is in this namespace, or sub namespaces of this one.
Definition: alignedtablecell.cc:28
void scroll(int dx, int dy)
Definition: fltkviewport.cc:422
void adjustScrollbarsAndGadgetsAllocation()
Definition: fltkviewport.cc:91
int verScrolling
Definition: fltkviewport.hh:25
void addGadget(Fl_Widget *gadget)
Definition: fltkviewport.cc:549
ScrollCommand
Definition: types.hh:35
Definition: fltkviewport.hh:17
GadgetOrientation gadgetOrientation[4]
Definition: fltkviewport.hh:29
Typed version of container::untyped::List.
Definition: container.hh:463
void vscrollbarChanged()
Definition: fltkviewport.cc:154
Fl_Scrollbar * hscrollbar
Definition: fltkviewport.hh:27