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

pglistbox.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: 2008-05-24 18:21:04 $
00024     Source File:      $Source: /home/cvspsrv/cvsroot/games/asc/source/libs/paragui/include/pglistbox.h,v $
00025     CVS/RCS Revision: $Revision: 1.3 $
00026     Status:           $State: Exp $
00027 */
00028 
00029 #ifndef PG_LISTBOX_H
00030 #define PG_LISTBOX_H
00031 
00032 #include "pgwidgetlist.h"
00033 #include "pglabel.h"
00034 
00035 class PG_ListBoxBaseItem;
00036 
00049 class DECLSPEC PG_ListBox : public PG_WidgetList {
00050 public:
00051 
00055         template<class datatype = PG_Pointer>
00056 class SignalSelectItem : public PG_Signal1<PG_ListBoxBaseItem*, datatype> {}
00057         ;
00058 
00060         PG_ListBox(PG_Widget* parent, const PG_Rect& r = PG_Rect::null, const std::string& style="ListBox");
00061 
00063         ~PG_ListBox();
00064 
00066         void SetMultiSelect(bool multi = true);
00067 
00069         bool GetMultiSelect();
00070 
00072         PG_ListBoxBaseItem* GetSelectedItem();
00073 
00075         void SelectItem(PG_ListBoxBaseItem* item, bool select = true, bool fireEvent = true);
00076 
00077         /* */
00078         void SelectFirstItem( bool fireEvent = true );
00079 
00080         /* */
00081         void SelectNextItem( bool fireEvent = true );
00082 
00083         /* */
00084         void SelectPrevItem( bool fireEvent = true );
00085 
00089         void RemoveAll();
00090 
00094         void DeleteAll();
00095 
00100         void SetIndent(Uint16 indent);
00101 
00105         Uint16 GetIndent();
00106 
00111         void SetAlignment(PG_Label::TextAlign style);
00112 
00116         PG_Label::TextAlign GetAlignment();
00117 
00121         int GetSelectedIndex();
00122 
00123         void GetSelectedItems(std::vector<PG_ListBoxBaseItem*>& items);
00124 
00125         void AddChild(PG_Widget* child);
00126 
00127         SignalSelectItem<> sigSelectItem;
00128 
00129 protected:
00130 
00132         virtual bool eventSelectItem(PG_ListBoxBaseItem* item);
00133 
00135         bool eventMouseButtonUp(const SDL_MouseButtonEvent* button);
00136 
00138         bool eventMouseButtonDown(const SDL_MouseButtonEvent* button);
00139 
00141         bool eventMouseMotion(const SDL_MouseMotionEvent* motion);
00142 
00143         friend class PG_ListBoxBaseItem;
00144 
00145 private:
00146 
00147         bool my_multiselect;
00148 
00149         Uint16 my_indent;
00150 
00151         int my_selectindex;
00152 
00153         PG_ListBoxBaseItem* my_selectedItem;
00154 
00155         PG_Label::TextAlign my_alignment;
00156 
00157 };
00158 
00159 #endif  // PG_LISTBOX_H

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