Planeshift
|
00001 /* 00002 * glyph.h - Author: Anders Reggestad 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_GLYPH_WINDOW 00021 #define PAWS_GLYPH_WINDOW 00022 00023 // CS INCLUDES 00024 #include <csutil/array.h> 00025 #include <imap/loader.h> 00026 00027 #include "paws/pawswidget.h" 00028 #include "paws/pawsbutton.h" 00029 #include "paws/pawstextbox.h" 00030 #include "pawsslot.h" 00031 #include "inventorywindow.h" 00032 #include "util/psconst.h" 00033 #include "net/messages.h" 00034 00035 #define FLOATING_SLOT GLYPH_LIST_MAX_SLOTS 00036 00037 struct iEngine; 00038 00039 00040 class pawsGlyphSlot : public pawsSlot 00041 { 00042 public: 00043 pawsGlyphSlot() 00044 { 00045 dragDrop = false; 00046 emptyOnZeroCount = true; 00047 Clear(); 00048 } 00049 int GetStatID() 00050 { 00051 return statID; 00052 } 00053 void SetStatID(int statID) 00054 { 00055 this->statID = statID; 00056 } 00057 void Clear() 00058 { 00059 statID = 0; 00060 00061 pawsSlot::Clear(); 00062 } 00063 int Way() 00064 { 00065 return wayID; 00066 } 00067 void SetWay(int way) 00068 { 00069 wayID = way; 00070 } 00071 protected: 00072 int statID; 00073 int wayID; 00074 }; 00075 00076 CREATE_PAWS_FACTORY( pawsGlyphSlot ); 00077 00078 00079 00080 class pawsGlyphWindow : public pawsWidget, public psClientNetSubscriber 00081 { 00082 public: 00083 00084 pawsGlyphWindow(); 00085 virtual ~pawsGlyphWindow(); 00086 00089 void HandleMessage( MsgEntry* message ); 00090 00091 bool PostSetup(); 00092 void Show(); 00093 void Hide(); 00094 bool OnMouseDown(int button, int modifiers, int x, int y); 00095 bool OnButtonPressed( int mouseButton, int keyModifier, pawsWidget* widget ); 00096 00097 protected: 00098 void HandleAssemble( MsgEntry* me ); 00099 void HandleGlyphList( MsgEntry* me ); 00100 00102 void NewGlyphSlotRow(int wayNum); 00103 00105 pawsGlyphSlot * FindFreeSlot(int wayNum); 00106 00108 void StartDrag(pawsGlyphSlot *sourceSlot); 00109 void StopDrag(pawsGlyphSlot *sourceSlot); 00110 00112 void SendAssembler(bool infoRequest = false); 00113 00114 /*** Clears the Spell name and Description fields. ***/ 00115 void ClearSpell(); 00116 00117 pawsMessageTextBox *description; 00118 pawsTextBox *spellName; 00119 pawsWidget *spellImage; 00120 pawsButton *helpButton; 00121 pawsWidget *helpWindow; 00122 csArray <pawsListBox*> ways; 00123 00124 pawsGlyphSlot * assembler[GLYPH_ASSEMBLER_SLOTS]; 00125 }; 00126 00127 00128 CREATE_PAWS_FACTORY( pawsGlyphWindow ); 00129 00130 00131 00132 #endif 00133