00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00033 #ifndef PG_SCROLLWIDGET_H
00034 #define PG_SCROLLWIDGET_H
00035
00036 #include "pgthemewidget.h"
00037 #include "pgscrollbar.h"
00038 #include "pgscrollarea.h"
00039
00040
00050 class DECLSPEC PG_ScrollWidget : public PG_ThemeWidget {
00051 public:
00052
00053 enum {
00054 IDWIDGETLIST_VSCROLL = PG_WIDGETID_INTERNAL + 10, IDWIDGETLIST_HSCROLL
00055 };
00056
00060 PG_ScrollWidget(PG_Widget* parent, const PG_Rect& r = PG_Rect::null, const std::string& style="ScrollWidget");
00061
00065 ~PG_ScrollWidget();
00066
00068 void LoadThemeStyle(const std::string& widgettype);
00069
00075 void EnableScrollBar(bool enable, PG_ScrollBar::ScrollDirection direction = PG_ScrollBar::VERTICAL);
00076
00082 void ScrollTo( int x, int y);
00083
00089 void ScrollToWidget(PG_Widget* widget, bool bVertical = true);
00090
00091 Uint16 GetListHeight();
00092
00093 Uint16 GetListWidth();
00094
00095 Uint16 GetWidgetCount();
00096
00097 PG_Widget* GetFirstInList();
00098
00099 virtual void DeleteAll();
00100
00101 virtual void RemoveAll();
00102
00103 void AddChild(PG_Widget* child);
00104
00106 void SetLineSize( int linesize );
00107 int GetLineSize();
00108
00116 void SetShiftOnRemove(bool shiftx, bool shifty);
00117
00121 Uint16 GetScrollPosX();
00122
00126 Uint16 GetScrollPosY();
00127
00133 void SetAutoResize(bool bRemove, bool bAdd);
00134
00135 PG_ScrollArea::SignalAreaChangedHeight sigAreaChangedHeight;
00136
00137 PG_ScrollArea::SignalAreaChangedWidth sigAreaChangedWidth;
00138
00139 protected:
00140
00142 void eventSizeWidget(Uint16 w, Uint16 h);
00143
00144 bool eventMouseButtonDown(const SDL_MouseButtonEvent* button);
00145
00147 bool handleScrollPos(PG_ScrollBar* widget, long data);
00148
00150 bool handleScrollTrack(PG_ScrollBar* widget, long data);
00151
00152 bool handleAreaChangedHeight(PG_ScrollArea* area, Uint16 h);
00153
00154 bool handleAreaChangedWidth(PG_ScrollArea* area, Uint16 w);
00155
00156 PG_ScrollBar* my_objVerticalScrollbar;
00157 PG_ScrollBar* my_objHorizontalScrollbar;
00158 PG_ScrollArea* my_scrollarea;
00159
00160 int my_widthScrollbar;
00161 int my_heightHorizontalScrollbar;
00162
00163 bool my_enableVerticalScrollbar;
00164 bool my_enableHorizontalScrollbar;
00165 int my_scrollLineSize;
00166
00167 void CheckScrollBars();
00168
00169 private:
00170
00171 PG_ScrollWidget(const PG_ScrollWidget&);
00172
00173 PG_ScrollWidget& operator=(const PG_ScrollWidget&);
00174
00175 DLLLOCAL void CalcScrollbarVisibility();
00176 DLLLOCAL void RecalcPositions(bool bV, bool bH);
00177 };
00178
00179 #endif // PG_SCROLLWIDGET_H