Planeshift
|
00001 /* 00002 * shortcutwindow.h - Author: Andrew Dai 00003 * Copyright (C) 2003 Atomic Blue ([email protected], http://www.atomicblue.org) 00004 * 00005 * Revision Author: Joe Lyon 00006 * Copyright (C) 2013 Atomic Blue ([email protected], http://www.atomicblue.org) 00007 * 00008 * This program is free software; you can redistribute it and/or 00009 * modify it under the terms of the GNU General Public License 00010 * as published by the Free Software Foundation (version 2 of the License) 00011 * This program is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 * GNU General Public License for more details. 00015 * You should have received a copy of the GNU General Public License 00016 * along with this program; if not, write to the Free Software 00017 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00018 * 00019 */ 00020 00021 #ifndef PAWS_SHORTCUT_WINDOW 00022 #define PAWS_SHORTCUT_WINDOW 00023 00024 //============================================================================= 00025 // Library Includes 00026 //============================================================================= 00027 // COMMON INCLUDES 00028 #include "net/messages.h" 00029 #include "net/clientmsghandler.h" 00030 #include "net/cmdhandler.h" 00031 00032 // CLIENT INCLUDES 00033 #include "pscelclient.h" 00034 #include "../globals.h" 00035 #include "clientvitals.h" 00036 #include "psclientchar.h" 00037 00038 // PAWS INCLUDES 00039 #include "gui/pawscontrolwindow.h" 00040 #include "gui/pawsconfigkeys.h" 00041 #include "paws/pawsprogressbar.h" 00042 #include "pawsscrollmenu.h" 00043 00044 00045 //============================================================================= 00046 // Forward Declarations 00047 //============================================================================= 00048 class pawsChatWindow; 00049 00050 //============================================================================= 00051 // Defines 00052 //============================================================================= 00053 #define NUM_SHORTCUTS 256 00054 00055 //============================================================================= 00056 // Classes 00057 //============================================================================= 00058 00062 class pawsShortcutWindow : public pawsControlledWindow, public pawsFingeringReceiver, public psClientNetSubscriber 00063 { 00064 public: 00065 pawsShortcutWindow(); 00066 00067 virtual ~pawsShortcutWindow(); 00068 00069 virtual bool Setup(iDocumentNode *node); 00070 virtual bool PostSetup(); 00071 00072 bool OnMouseDown( int button, int modifiers, int x, int y ); 00073 bool OnButtonPressed(int mouseButton, int keyModifier, pawsWidget* reporter); 00074 bool OnButtonReleased(int mouseButton, int keyModifier, pawsWidget* reporter); 00075 bool OnScroll(int direction, pawsScrollBar* widget); 00076 00077 void OnResize(); 00078 bool OnFingering(csString string, psControl::Device device, uint button, uint32 mods); 00079 00085 void ExecuteCommand(int shortcutNum ); 00086 00092 const csString& GetCommandName(int shortcutNum ); 00093 00099 csString GetTriggerText(int shortcutNum); 00100 00104 void LoadDefaultCommands(); 00105 void LoadCommandsFile(); 00106 void LoadCommands(const char *FN); 00107 void SaveCommands(); 00108 void SaveCommands(const char *FN); 00109 00110 void ResetEditWindow(); 00111 00112 void Show(); 00113 00114 void StartMonitors(); 00115 void StopMonitors(); 00116 int GetMonitorState(); 00120 char const * GetFontName() 00121 { 00122 return fontName; 00123 } 00124 00128 bool LoadUserPrefs(); 00129 bool LoadUserSharedPrefs(); 00130 00131 void SetHPWarnLevel( float val ); 00132 float GetHPWarnLevel(); 00133 00134 void SetHPDangerLevel( float val ); 00135 float GetHPDangerLevel(); 00136 00137 void SetHPFlashLevel( float val ); 00138 float GetHPFlashLevel(); 00139 00140 void SetManaWarnLevel( float val ); 00141 float GetManaWarnLevel(); 00142 00143 void SetManaDangerLevel( float val ); 00144 float GetManaDangerLevel(); 00145 00146 void SetManaFlashLevel( float val ); 00147 float GetManaFlashLevel(); 00148 00149 void SetHPOn( bool val ); 00150 void SetManaOn( bool val ); 00151 00152 protected: 00154 pawsChatWindow* chatWindow; 00155 CmdHandler *cmdsource; 00156 00157 csArray<csString> cmds; 00158 csArray<csString> names; 00159 csArray<csString> toolTips; 00160 csArray<csString> icon; 00161 00162 csRef<iVFS> vfs; 00163 00164 // The widget that holds the command data during editing 00165 pawsMultilineEditTextBox* textBox; 00166 00167 // The widget that holds the button label data during editing 00168 pawsEditTextBox* labelBox; 00169 00170 // The widget that holds the shortcut lable data during editing 00171 pawsTextBox* shortcutText; 00172 00173 pawsTextBox* title; 00174 00175 // Widget used to configure the shortcuts 00176 pawsWidget* subWidget; 00177 00178 pawsScrollMenu* iconPalette; 00179 pawsDnDButton* iconDisplay; 00180 int iconDisplayID; 00181 00182 csString buttonBackgroundImage; 00183 00184 size_t edit; 00185 pawsWidget *editedButton; 00186 00187 virtual void HandleMessage(MsgEntry *msg); 00188 00189 private: 00190 //status bars, optional;configured in XML 00191 pawsProgressBar *main_hp; 00192 pawsProgressBar *main_mana; 00193 pawsProgressBar *phys_stamina; 00194 pawsProgressBar *ment_stamina; 00195 pawsScrollMenu *MenuBar; 00196 00197 //custom controls, optional;configured in XML 00198 pawsButton *UpButton; 00199 pawsButton *DownButton; 00200 pawsScrollBar *iconScrollBar; 00201 pawsScrollBar *paletteScrollBar; 00202 00203 csArray<csString> allIcons; 00204 csArray<csString> allNames; //not populated at this time... 00205 csArray<csString> stubArray; 00206 00207 csString fileName; 00208 00209 size_t position; 00210 size_t buttonWidth; 00211 int textSpacing; 00212 float scrollSize; 00213 int EditMode; 00214 }; 00215 00216 00217 CREATE_PAWS_FACTORY( pawsShortcutWindow ); 00218 #endif