Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

pgscrollwidget.h

Go to the documentation of this file.
00001 /*
00002     ParaGUI - crossplatform widgetset
00003     Copyright (C) 2000,2001,2002  Alexander Pipelka
00004  
00005     This library is free software; you can redistribute it and/or
00006     modify it under the terms of the GNU Library General Public
00007     License as published by the Free Software Foundation; either
00008     version 2 of the License, or (at your option) any later version.
00009  
00010     This library is distributed in the hope that it will be useful,
00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013     Library General Public License for more details.
00014  
00015     You should have received a copy of the GNU Library General Public
00016     License along with this library; if not, write to the Free
00017     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00018  
00019     Alexander Pipelka
00020     pipelka@teleweb.at
00021  
00022     Last Update:      $Author: mbickel $
00023     Update Date:      $Date: 2007-04-13 16:15:57 $
00024     Source File:      $Source: /home/cvspsrv/cvsroot/games/asc/source/libs/paragui/include/pgscrollwidget.h,v $
00025     CVS/RCS Revision: $Revision: 1.2 $
00026     Status:           $State: Exp $
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

Generated on Tue Jun 24 01:27:49 2008 for Advanced Strategic Command by  doxygen 1.4.2