[773] | 1 | // |
---|
| 2 | // "$Id: ScrollGroup.h 4218 2005-03-31 05:14:08Z spitzak $" |
---|
| 3 | // |
---|
| 4 | // Group that adds scrollbars so you can scroll around the area |
---|
| 5 | // covered by all the child widgets. For most uses you will make |
---|
| 6 | // a single child widget, this child may resize in it's layout() |
---|
| 7 | // and the scrollbars will adjust to match. |
---|
| 8 | // |
---|
| 9 | // Due to clipping problems no subclasses of Window may be used |
---|
| 10 | // as child widgets. |
---|
| 11 | // |
---|
| 12 | // This library is free software; you can redistribute it and/or |
---|
| 13 | // modify it under the terms of the GNU Library General Public |
---|
| 14 | // License as published by the Free Software Foundation; either |
---|
| 15 | // version 2 of the License, or (at your option) any later version. |
---|
| 16 | // |
---|
| 17 | // This library is distributed in the hope that it will be useful, |
---|
| 18 | // but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 19 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
---|
| 20 | // Library General Public License for more details. |
---|
| 21 | // |
---|
| 22 | // You should have received a copy of the GNU Library General Public |
---|
| 23 | // License along with this library; if not, write to the Free Software |
---|
| 24 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 |
---|
| 25 | // USA. |
---|
| 26 | // |
---|
| 27 | // Please report all bugs and problems to "fltk-bugs@fltk.org". |
---|
| 28 | // |
---|
| 29 | |
---|
| 30 | #ifndef fltk_ScrollGroup_h |
---|
| 31 | #define fltk_ScrollGroup_h |
---|
| 32 | |
---|
| 33 | #include "Group.h" |
---|
| 34 | #include "Scrollbar.h" |
---|
| 35 | |
---|
| 36 | namespace fltk { |
---|
| 37 | |
---|
| 38 | class FL_API ScrollGroup : public Group { |
---|
| 39 | |
---|
| 40 | int xposition_, yposition_; |
---|
| 41 | int layoutdx, layoutdy; |
---|
| 42 | int scrolldx, scrolldy; |
---|
| 43 | bool enable_drag_scroll_; |
---|
| 44 | bool drag_scrolling_; |
---|
| 45 | bool delegate_alt_click_; |
---|
| 46 | int drag_x_, drag_y_, pos_x_, pos_y_; |
---|
| 47 | int max_x_scroll_, max_y_scroll_; |
---|
| 48 | static void hscrollbar_cb(Widget*, void*); |
---|
| 49 | static void scrollbar_cb(Widget*, void*); |
---|
| 50 | static void draw_clip(void*,const Rectangle&); |
---|
| 51 | |
---|
| 52 | protected: |
---|
| 53 | |
---|
| 54 | void draw(); |
---|
| 55 | |
---|
| 56 | public: |
---|
| 57 | |
---|
| 58 | void bbox(Rectangle&); |
---|
| 59 | Scrollbar scrollbar; |
---|
| 60 | Scrollbar hscrollbar; |
---|
| 61 | |
---|
| 62 | void enable_drag_scroll( bool enable ) { enable_drag_scroll_ = true; } |
---|
| 63 | |
---|
| 64 | virtual int handle(int); |
---|
| 65 | virtual void layout(); |
---|
| 66 | |
---|
| 67 | ScrollGroup(int X,int Y,int W,int H,const char*l=0); |
---|
| 68 | |
---|
| 69 | enum { // values for type() |
---|
| 70 | HORIZONTAL = 1, |
---|
| 71 | VERTICAL = 2, |
---|
| 72 | BOTH = 3, |
---|
| 73 | ALWAYS_ON = 4, |
---|
| 74 | HORIZONTAL_ALWAYS = 5, |
---|
| 75 | VERTICAL_ALWAYS = 6, |
---|
| 76 | BOTH_ALWAYS = 7, |
---|
| 77 | }; |
---|
| 78 | |
---|
| 79 | int xposition() const {return xposition_;} |
---|
| 80 | int yposition() const {return yposition_;} |
---|
| 81 | void scrollTo(int, int); |
---|
| 82 | }; |
---|
| 83 | |
---|
| 84 | } |
---|
| 85 | |
---|
| 86 | #endif |
---|
| 87 | |
---|
| 88 | // |
---|
| 89 | // End of "$Id: ScrollGroup.h 4218 2005-03-31 05:14:08Z spitzak $". |
---|
| 90 | // |
---|