Planeshift
pawsselector.h
Go to the documentation of this file.
1 /*
2  * pawsselector.h - Author: Andrew Craig
3  *
4  * Copyright (C) 2003 Atomic Blue (info@planeshift.it, http://www.atomicblue.org)
5  *
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation (version 2 of the License)
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17  *
18  */
19 #ifndef PAWS_SELECTOR_BOX_HEADER
20 #define PAWS_SELECTOR_BOX_HEADER
21 
22 #include "pawswidget.h"
23 
25 // FORWARD DECLARATIONS
27 class pawsListBox;
28 class pawsListBoxRow;
29 class pawsButton;
30 
31 
36 #define SELECTOR_ADD_BUTTON -100
38 #define SELECTOR_REMOVE_BUTTON -200
39 
41 // WIDGET IDENTIFIERS
43 #define AVAILABLE_BOX -1000
44 #define SELECTED_BOX -2000
45 
47 
67 {
68 public:
70  pawsSelectorBox(const pawsSelectorBox &origin);
72 
73  bool Setup(iDocumentNode* node);
74  bool OnButtonPressed(int mouseButton, int keyModifier, pawsWidget* widget);
75  void OnListAction(pawsListBox* widget, int status);
76 
79 
82  {
83  return moved;
84  }
85 
87  void RemoveFromAvailable(int id);
88 
90  void RemoveFromSelected(int id);
91 
93  int GetAvailableCount(void);
94 
96  bool SelectAndMoveRow(int rowNo, bool toSelected=true);
97 
98 private:
99  pawsListBox* available;
100  pawsListBox* selected;
101 
102  pawsButton* add;
103  pawsButton* remove;
104 
105  pawsListBoxRow* moved;
106 };
107 
109 
110 
113 #endif
bool OnButtonPressed(int mouseButton, int keyModifier, pawsWidget *widget)
Called whenever a button is pressed.
bool SelectAndMoveRow(int rowNo, bool toSelected=true)
Move row automatically, default available->selected.
The main base widget that all other widgets should inherit from.
Definition: pawswidget.h:116
bool Setup(iDocumentNode *node)
Setup this widget.
void OnListAction(pawsListBox *widget, int status)
Called whenever an item in a child list box is selected.
void RemoveFromSelected(int id)
Remove the row with id from selected list.
void RemoveFromAvailable(int id)
Remove the row with id from available list.
A simple list box widget.
Definition: pawslistbox.h:202
A simple button widget.
Definition: pawsbutton.h:43
A List Box Row.
Definition: pawslistbox.h:85
This a available->selected widget.
Definition: pawsselector.h:66
CREATE_PAWS_FACTORY(pawsSelectorBox)
pawsListBoxRow * GetMoved()
Get the row that was moved from one list to the other.
Definition: pawsselector.h:81
pawsListBoxRow * CreateOption()
Create a new entry in the available box.
int GetAvailableCount(void)
Return number of items in available list.