Planeshift

pawsselector.h

Go to the documentation of this file.
00001 /*
00002  * pawsselector.h - Author: Andrew Craig
00003  *
00004  * Copyright (C) 2003 Atomic Blue ([email protected], http://www.atomicblue.org)
00005  *
00006  *
00007  * This program is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU General Public License
00009  * as published by the Free Software Foundation (version 2 of the License)
00010  * This program 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
00013  * GNU General Public License for more details.
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program; if not, write to the Free Software
00016  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00017  *
00018  */
00019 #ifndef PAWS_SELECTOR_BOX_HEADER
00020 #define PAWS_SELECTOR_BOX_HEADER
00021 
00022 #include "pawswidget.h"
00023 
00025 //  FORWARD DECLARATIONS
00027 class pawsListBox;
00028 class pawsListBoxRow;
00029 class pawsButton;
00030 
00031 
00036 
00037 #define SELECTOR_ADD_BUTTON    -100
00038 #define SELECTOR_REMOVE_BUTTON -200
00039 
00041 //  WIDGET IDENTIFIERS
00043 #define AVAILABLE_BOX -1000
00044 #define SELECTED_BOX  -2000
00045 
00046 
00047 
00066 class pawsSelectorBox : public pawsWidget
00067 {
00068 public:
00069     pawsSelectorBox();
00070     pawsSelectorBox(const pawsSelectorBox &origin);
00071     ~pawsSelectorBox();
00072 
00073     bool Setup(iDocumentNode* node);
00074     bool OnButtonPressed(int mouseButton, int keyModifier, pawsWidget* widget);
00075     void OnListAction(pawsListBox* widget, int status);
00076 
00078     pawsListBoxRow* CreateOption();
00079 
00081     pawsListBoxRow* GetMoved()
00082     {
00083         return moved;
00084     }
00085 
00087     void RemoveFromAvailable(int id);
00088 
00090     void RemoveFromSelected(int id);
00091 
00093     int GetAvailableCount(void);
00094 
00096     bool SelectAndMoveRow(int rowNo, bool toSelected=true);
00097 
00098 private:
00099     pawsListBox* available;
00100     pawsListBox* selected;
00101 
00102     pawsButton* add;
00103     pawsButton* remove;
00104 
00105     pawsListBoxRow* moved;
00106 };
00107 
00108 CREATE_PAWS_FACTORY(pawsSelectorBox);
00109 
00110 
00113 #endif