| 1 | ///////////////////////////////////////////////////////////////////////////// |
| 2 | // Name: scrolbar.h |
| 3 | // Purpose: |
| 4 | // Author: Robert Roebling |
| 5 | // Id: $Id$ |
| 6 | // Copyright: (c) 1998 Robert Roebling |
| 7 | // Licence: wxWindows licence |
| 8 | ///////////////////////////////////////////////////////////////////////////// |
| 9 | |
| 10 | |
| 11 | #ifndef __GTKSCROLLBARH__ |
| 12 | #define __GTKSCROLLBARH__ |
| 13 | |
| 14 | #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) |
| 15 | #pragma interface "scrolbar.h" |
| 16 | #endif |
| 17 | |
| 18 | #include "wx/defs.h" |
| 19 | |
| 20 | //----------------------------------------------------------------------------- |
| 21 | // classes |
| 22 | //----------------------------------------------------------------------------- |
| 23 | |
| 24 | class wxScrollBar; |
| 25 | |
| 26 | //----------------------------------------------------------------------------- |
| 27 | // wxScrollBar |
| 28 | //----------------------------------------------------------------------------- |
| 29 | |
| 30 | class wxScrollBar: public wxScrollBarBase |
| 31 | { |
| 32 | public: |
| 33 | wxScrollBar() |
| 34 | { m_adjust = (GtkAdjustment *) NULL; m_oldPos = 0.0; } |
| 35 | inline wxScrollBar( wxWindow *parent, wxWindowID id, |
| 36 | const wxPoint& pos = wxDefaultPosition, |
| 37 | const wxSize& size = wxDefaultSize, |
| 38 | long style = wxSB_HORIZONTAL, |
| 39 | const wxValidator& validator = wxDefaultValidator, |
| 40 | const wxString& name = wxScrollBarNameStr ) |
| 41 | { |
| 42 | Create( parent, id, pos, size, style, validator, name ); |
| 43 | } |
| 44 | bool Create( wxWindow *parent, wxWindowID id, |
| 45 | const wxPoint& pos = wxDefaultPosition, |
| 46 | const wxSize& size = wxDefaultSize, |
| 47 | long style = wxSB_HORIZONTAL, |
| 48 | const wxValidator& validator = wxDefaultValidator, |
| 49 | const wxString& name = wxScrollBarNameStr ); |
| 50 | ~wxScrollBar(); |
| 51 | int GetThumbPosition() const; |
| 52 | int GetThumbSize() const; |
| 53 | int GetPageSize() const; |
| 54 | int GetRange() const; |
| 55 | virtual void SetThumbPosition( int viewStart ); |
| 56 | virtual void SetScrollbar( int position, int thumbSize, int range, int pageSize, |
| 57 | bool refresh = TRUE ); |
| 58 | |
| 59 | // Backward compatibility |
| 60 | // ---------------------- |
| 61 | |
| 62 | int GetValue(void) const; |
| 63 | void SetValue( int viewStart ); |
| 64 | void GetValues( int *viewStart, int *viewLength, int *objectLength, int *pageLength) const; |
| 65 | int GetViewLength() const; |
| 66 | int GetObjectLength() const; |
| 67 | void SetPageSize( int pageLength ); |
| 68 | void SetObjectLength( int objectLength ); |
| 69 | void SetViewLength( int viewLength ); |
| 70 | |
| 71 | // implementation |
| 72 | // -------------- |
| 73 | |
| 74 | bool IsOwnGtkWindow( GdkWindow *window ); |
| 75 | void ApplyWidgetStyle(); |
| 76 | |
| 77 | GtkAdjustment *m_adjust; |
| 78 | float m_oldPos; |
| 79 | |
| 80 | protected: |
| 81 | virtual wxSize DoGetBestSize() const; |
| 82 | |
| 83 | private: |
| 84 | DECLARE_DYNAMIC_CLASS(wxScrollBar) |
| 85 | }; |
| 86 | |
| 87 | #endif |
| 88 | // __GTKSCROLLBARH__ |