afxSpellButton.h
Engine/source/afx/ui/afxSpellButton.h
Classes:
class
Detailed Description
1 2 3//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// 4// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames 5// Copyright (C) 2015 Faust Logic, Inc. 6// 7// Permission is hereby granted, free of charge, to any person obtaining a copy 8// of this software and associated documentation files (the "Software"), to 9// deal in the Software without restriction, including without limitation the 10// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 11// sell copies of the Software, and to permit persons to whom the Software is 12// furnished to do so, subject to the following conditions: 13// 14// The above copyright notice and this permission notice shall be included in 15// all copies or substantial portions of the Software. 16// 17// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 23// IN THE SOFTWARE. 24// 25//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// 26 27#ifndef _AFX_SPELL_BUTTON_H_ 28#define _AFX_SPELL_BUTTON_H_ 29 30#include "gui/buttons/guiButtonCtrl.h" 31 32///------------------------------------- 33/// Bitmap Button Contrl 34/// Set 'bitmap' comsole field to base name of bitmaps to use. This control will 35/// append '_n' for normal 36/// append '_h' for hilighted 37/// append '_d' for depressed 38/// 39/// if bitmap cannot be found it will use the default bitmap to render. 40/// 41/// if the extent is set to (0,0) in the gui editor and appy hit, this control will 42/// set it's extent to be exactly the size of the normal bitmap (if present) 43/// 44 45class afxSpellBook; 46class afxMagicSpellData; 47class afxRPGMagicSpellData; 48 49class afxSpellButton : public GuiButtonCtrl 50{ 51private: 52 typedef GuiButtonCtrl Parent; 53 54 enum { NUM_COOLDOWN_FRAMES = 36 }; 55 56protected: 57 static StringTableEntry sUnknownSpellBitmap; 58 static StringTableEntry sSpellCooldownBitmaps; 59 60 StringTableEntry mBitmapName; 61 GFXTexHandle mTextureNormal; 62 GFXTexHandle mTextureHilight; 63 GFXTexHandle mTextureDepressed; 64 GFXTexHandle mTextureInactive; 65 66 afxSpellBook* spellbook; 67 Point2I book_slot; 68 69 GFXTexHandle cooldown_txrs[NUM_COOLDOWN_FRAMES]; 70 71 void update_bitmap(); 72 void renderButton(GFXTexHandle &texture, Point2I &offset, const RectI& updateRect); 73 74public: 75 /*C*/ afxSpellButton(); 76 /*D*/ ~afxSpellButton(); 77 78 void setBitmap(const char *name, bool placholder=false); 79 void setSpellBook(afxSpellBook*, U8 page); 80 void setPage(U8 page); 81 char* formatDesc(char* buffer, int len) const; 82 83 afxMagicSpellData* getSpellDataBlock() const; 84 afxRPGMagicSpellData* getSpellRPGDataBlock() const; 85 86 virtual bool onAdd(); 87 virtual bool onWake(); 88 virtual void onSleep(); 89 virtual void inspectPostApply(); 90 virtual void onMouseEnter(const GuiEvent &event); 91 virtual void onMouseLeave(const GuiEvent &event); 92 virtual void onRender(Point2I offset, const RectI &updateRect); 93 94 virtual void onDeleteNotify(SimObject*); 95 96 static void initPersistFields(); 97 98 DECLARE_CONOBJECT(afxSpellButton); 99 DECLARE_CATEGORY("AFX"); 100}; 101 102//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// 103 104#endif //_GUI_BITMAP_BUTTON_CTRL_H 105