Planeshift
|
00001 /* 00002 * pawscombobox.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 00020 #ifndef PAWS_COMBO_BOX_HEADER 00021 #define PAWS_COMBO_BOX_HEADER 00022 00023 #include "pawswidget.h" 00024 #include "pawslistbox.h" 00025 00026 class pawsButton; 00027 class pawsTextBox; 00028 class pawsListBox; 00029 class pawsListBoxRow; 00030 00053 class pawsComboBox : public pawsWidget 00054 { 00055 public: 00056 pawsComboBox(); 00057 ~pawsComboBox(); 00058 pawsComboBox(const pawsComboBox &origin); 00059 00060 bool Setup(iDocumentNode* node); 00061 bool PostSetup(); 00062 bool OnButtonPressed(int mouseButton, int keyModifier, pawsWidget* widget); 00063 void OnListAction(pawsListBox* widget, int status); 00064 00065 void SetNumRows(int numRows) 00066 { 00067 rows = numRows; 00068 } 00069 void SetRowHeight(int height) 00070 { 00071 rowHeight = height; 00072 } 00073 void SetUpButtonImage(const char* name) 00074 { 00075 upButton = name; 00076 } 00077 void SetUpDownButtonImage(const char* name) 00078 { 00079 downButton = name; 00080 } 00081 void SetUpButtonPressedImage(const char* name) 00082 { 00083 upButtonPressed = name; 00084 } 00085 void SetUpDownButtonPressedImage(const char* name) 00086 { 00087 downButtonPressed = name; 00088 } 00089 00091 void SetSorted(bool sorting); 00092 pawsListBoxRow* NewOption(); 00093 pawsListBoxRow* NewOption(const csString &text); 00094 00096 pawsListBox* GetChoiceList() 00097 { 00098 return listChoice; 00099 } 00100 00102 int GetSelectedRowNum(); 00103 00105 csString GetSelectedRowString(); 00106 00108 pawsListBoxRow* Select(int optionNum); 00109 pawsListBoxRow* Select(const char* text); 00110 00111 int GetRowCount(); 00112 bool Clear(); 00113 00114 private: 00115 pawsTextBox* itemChoice; 00116 pawsListBox* listChoice; 00117 pawsButton* arrow; 00118 csString initalText; 00119 00120 int oldHeight; 00121 int oldWidth; 00122 bool closed; 00123 bool fliptotop; 00124 bool useScrollBar; 00125 00126 int rows; 00127 int rowHeight; 00128 int listalpha; 00129 bool sorted; 00130 00131 csString text, upButton, upButtonPressed, downButton, downButtonPressed; 00132 }; 00133 00134 CREATE_PAWS_FACTORY(pawsComboBox); 00135 00138 #endif