⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 guitoolwindowctrl.h

📁 五行MMORPG引擎系统V1.0
💻 H
字号:
//guiToolWindowCtrl.h
/*/////////////////////////////////////////////////////////////////

   李亦
	2006-7-6
/*/////////////////////////////////////////////////////////////////
#ifndef _GUITOOLWINDOWCTRL_H_
#define _GUITOOLWINDOWCTRL_H_



#ifndef _GUICONTROL_H_
#include "gui/core/guiControl.h"
#endif
#ifndef _GUITEXTCTRL_H_
#include "gui/controls/guiTextCtrl.h"
#endif

class GuiToolWindowCtrl : public GuiTextCtrl
{
   private:
      typedef GuiTextCtrl Parent;


		bool		m_bVerticalBar;	//是否为竖直型标题栏
		Point2I	m_boundBak;
		Point2I	m_boundOrigin;
		S32		m_nExpandExpire;	//鼠标经过自动展开后收缩超时,ms
		S32		m_nExpandTimer;
		bool		m_bMouseEnter;
		bool		m_bAlwaysShow;
		bool		m_bCanVerticalBar;
		bool		m_bEditorMode;

      bool mResizeWidth;
      bool mResizeHeight;
      bool mCanMove;
      bool mCanClose;
      bool mCanMinimize;
      bool mPressClose;

      Point2I	mMinSize;


      StringTableEntry mCloseCommand;

      S32 mTitleHeight;
      S32 mResizeRightWidth;
      S32 mResizeBottomHeight;

      bool mMouseMovingWin;
      bool mMouseResizeWidth;
      bool mMouseResizeHeight;
      bool mMinimized;
      bool mMaximized;

      Point2I mMouseDownPosition;
      RectI mOrigBounds;
      RectI mStandardBounds;

      RectI mCloseButton;
      S32 mMinimizeIndex;
      S32 mTabIndex;

		static GuiToolWindowCtrl*	ms_pAutoExpandTool;

      void PositionButtons(void);

   protected:
      enum BitmapIndices
      {
         BmpClose,
         BmpMaximize,
         BmpNormal,
         BmpMinimize,

         BmpCount
      };
      enum BitmapStates
      {
         BmpDefault = 0,
         BmpHilite,
#ifdef TGE_RPG_UI ///TGE_RPG_UI
			BmpDepress,
#endif
         BmpDisabled,

         BmpStates
      };
      enum
		{
         BorderTopLeftKey	= BmpStates*BmpCount,
         BorderTopRightKey,
         BorderTopKey,
         BorderTopLeftNoKey,
         BorderTopRightNoKey,
         BorderTopNoKey,
         BorderBottomLeft,
         BorderBottom,
         BorderBottomRight,
         BorderLeft,
         BorderRight,

			//竖直型标题栏

         VBorderBottomLeftKey,	//矩形的左下角认与 水平型标题栏左上角相应
         VBorderTopLeftKey,
         VBorderLeftKey,
         VBorderBottomLeftNoKey,
         VBorderTopLeftNoKey,
         VBorderLeftNoKey,
         VBorderBottomRight,
         VBorderRight,
         VBorderTopRight,
         VBorderBottom,
         VBorderTop,

			BmpFill,
         NumBitmaps
      };

      RectI *mBitmapBounds;  //bmp is [3*n], bmpHL is [3*n + 1], bmpNA is [3*n + 2]
      TextureHandle mTextureHandle;


      void drawWinRect(const RectI &myRect);

   public:
      GuiToolWindowCtrl();
      DECLARE_CONOBJECT(GuiToolWindowCtrl);
      static void initPersistFields();

      bool onWake();
      void onSleep();

      bool isMinimized(S32 &index);

      //bool initCursors();
      //void getCursor(GuiCursor *&cursor, bool &showCursor, const GuiEvent &lastGuiEvent);

      void setFont(S32 fntTag);

      GuiControl* findHitControl(const Point2I &pt, S32 initialLayer = -1);
      void resize(const Point2I &newPosition, const Point2I &newExtent);

//#ifdef TGE_RPG_UI /// TGE_RPG_UI
//		void onMouseMove(const GuiEvent &event);
//#endif
		void setAlwaysShow();

		void onMouseEnter(const GuiEvent &event);
		void onMouseLeave(const GuiEvent &event);
		void onMouseDown(const GuiEvent &event);
      void onMouseDragged(const GuiEvent &event);
      void onMouseUp(const GuiEvent &event);
		void onRightMouseDown(const GuiEvent &event);
		void onRightMouseUp(const GuiEvent &event);

		void ToggleVertMode(/*const GuiEvent &event*/);
		void ToggleMiniMode(bool bMin);
		void autoSizeToContent();


      //only cycle tabs through the current window, so overwrite the method
      GuiControl* findNextTabable(GuiControl *curResponder, bool firstCall = true);
      GuiControl* findPrevTabable(GuiControl *curResponder, bool firstCall = true);

      bool onKeyDown(const GuiEvent &event);

      S32 GetTitleHeight(void) { return mTitleHeight; } //IME

      S32 getTabIndex(void) { return mTabIndex; }

		bool toggleVisible();
      void selectWindow(void);

		void onPreRender();
      void onRender(Point2I offset, const RectI &updateRect);
};

#endif //_GUITOOLWINDOWCTRL_H_

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -