guiFormCtrl.h

Engine/source/gui/containers/guiFormCtrl.h

More...

Classes:

Detailed Description

  1
  2//-----------------------------------------------------------------------------
  3// Copyright (c) 2012 GarageGames, LLC
  4//
  5// Permission is hereby granted, free of charge, to any person obtaining a copy
  6// of this software and associated documentation files (the "Software"), to
  7// deal in the Software without restriction, including without limitation the
  8// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  9// sell copies of the Software, and to permit persons to whom the Software is
 10// furnished to do so, subject to the following conditions:
 11//
 12// The above copyright notice and this permission notice shall be included in
 13// all copies or substantial portions of the Software.
 14//
 15// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 16// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 17// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 18// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 19// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
 21// IN THE SOFTWARE.
 22//-----------------------------------------------------------------------------
 23
 24#ifndef _GUIFORMCTRL_H_
 25#define _GUIFORMCTRL_H_
 26
 27#ifndef _GUICONTROL_H_
 28#include "gui/core/guiControl.h"
 29#endif
 30
 31#ifndef _GUI_PANEL_H_
 32#include "gui/containers/guiPanel.h"
 33#endif
 34
 35#ifndef _GUIMENUBAR_H_
 36#include "gui/editor/guiMenuBar.h"
 37#endif
 38
 39#ifndef _GUICANVAS_H_
 40#include "gui/core/guiCanvas.h"
 41#endif
 42
 43#include "console/console.h"
 44#include "console/consoleTypes.h"
 45
 46class GuiMenuBar;
 47
 48
 49/// @addtogroup gui_container_group Containers
 50///
 51/// @ingroup gui_group Gui System
 52/// @{
 53class GuiFormCtrl : public GuiPanel
 54{
 55private:
 56   typedef GuiPanel Parent;
 57
 58   Resource<GFont>  mFont;
 59   String           mCaption;
 60   bool             mCanMove;
 61   bool             mUseSmallCaption;
 62   String           mSmallCaption;
 63   StringTableEntry mContentLibrary;
 64   StringTableEntry mContent;
 65
 66   Point2I          mThumbSize;
 67
 68   bool             mHasMenu;
 69   GuiMenuBar*      mMenuBar;
 70
 71   bool mMouseMovingWin;
 72
 73   Point2I mMouseDownPosition;
 74   RectI mOrigBounds;
 75   RectI mStandardBounds;
 76
 77   RectI mCloseButton;
 78   RectI mMinimizeButton;
 79   RectI mMaximizeButton;
 80
 81   bool mMouseOver;
 82   bool mDepressed;
 83   
 84   static bool _setHasMenu( void *object, const char *index, const char *data );
 85
 86protected:
 87   /// @name Callbacks
 88   /// @{
 89   DECLARE_CALLBACK( void, onResize, () );
 90   /// @}
 91
 92public:
 93   GuiFormCtrl();
 94   virtual ~GuiFormCtrl();
 95
 96   void setCaption( const char* caption ) { mCaption = caption; }
 97   void setHasMenu( bool value );
 98
 99   bool resize(const Point2I &newPosition, const Point2I &newExtent);
100   void onRender(Point2I offset, const RectI &updateRect);
101
102   bool onWake();
103   void onSleep();
104
105   virtual void addObject( SimObject *object );
106   virtual void removeObject( SimObject* object );
107   virtual bool acceptsAsChild( SimObject* object ) const;
108
109   void onMouseDown(const GuiEvent &event);
110   void onMouseUp(const GuiEvent &event);
111   void onMouseMove(const GuiEvent &event);
112   void onMouseLeave(const GuiEvent &event);
113   void onMouseEnter(const GuiEvent &event);
114
115   U32  getMenuBarID();
116
117   static void initPersistFields();
118   DECLARE_CONOBJECT(GuiFormCtrl);
119};
120/// @}
121
122#endif
123