Planeshift
|
00001 /* 00002 * Author: Andrew Robberts 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_KEY_SELECT_BOX_HEADER 00021 #define PAWS_KEY_SELECT_BOX_HEADER 00022 00023 #include "pawswidget.h" 00024 00032 class pawsKeySelectBox : public pawsWidget 00033 { 00034 public: 00035 pawsKeySelectBox() 00036 { 00037 factory = "pawsKeySelectBox"; 00038 } 00039 virtual ~pawsKeySelectBox(); 00040 pawsKeySelectBox(const pawsKeySelectBox &origin); 00041 bool Setup(iDocumentNode* node); 00042 00043 void Draw(); 00044 00045 bool OnKeyDown(utf32_char keyCode, utf32_char keyChar, int modifiers); 00046 00051 void SetKey(int _key, int _modifiers=0); 00052 00053 int GetKey() const 00054 { 00055 return key; 00056 } 00057 int GetModifiers() const 00058 { 00059 return modifiers; 00060 } 00061 00065 const char* GetText() const; 00066 00070 void SetText(const char* keyText); 00071 00072 virtual int GetBorderStyle(); 00073 00074 virtual bool GetFocusOverridesControls() const 00075 { 00076 return true; 00077 } 00078 00079 protected: 00080 00083 void CalcTextPos(); 00084 00086 csString text; 00087 00088 int key; 00089 int modifiers; 00090 00091 int textX, textY; // Position of text inside the widget 00092 }; 00093 CREATE_PAWS_FACTORY(pawsKeySelectBox); 00094 00097 #endif