#pragma once #include "KUIWnd.h" class KUIControl; class KUIControlSimpleButton; class KUIControlButton; class KUIControlStatic; class KUIControlTitleBar; class KUIControlStatusBar; class KUITipControl; namespace { enum KUIGENWND_ANIMATION { GENWND_TITLE = 0, GENWND_CLOSE, GENWND_MINIMIZE, GENWND_RESIZE, GENWND_STATUSBAR, GENWND_FRAME, GENWND_TOPFRAME, GENWND_BACKGROUND, GENWND_STATUSBAR_BTN, TOTAL_GENWND_ANINAME, }; } class KUIDragAndDropNormalIconRenderer; class KUIGenWnd : public KUIWnd { public: KUIGenWnd(); virtual ~KUIGenWnd(); virtual void Create(KUIWND_CREATE_ARG& CREATE_ARG); virtual void Render( KViewportObject *pViewport, bool isFront = false ); //#ifdef _KUI_INVALIDATION // virtual void RenderPopup( KViewportObject *pViewport, bool isFront = false ); // virtual void RenderToolTip( KViewportObject *pViewport, bool isFront = false ); //#endif virtual void PumpUpMessage( LPCSTR lpszControlID, DWORD nMessage, DWORD lparam, DWORD wparam ); virtual DWORD OnMouseMessage(DWORD dwMessage, int x, int y); virtual DWORD OnKeyMessage(DWORD dwMessage, DWORD dwKeyCode); virtual void *Perform( KID id, KArg& msg ); virtual void OnSizeChangeNofity(const KRect& rcRect); virtual void OnParentSizeChangeNotify(const KRect& rcNewRect,int nXMove, int nYMove,int nResizeStyle); virtual void OnPosChangeNofity(int nLeft, int Top); virtual void OnParentPosChangeNotify(int XOffset, int YOffset); virtual void OnClipChangeNotify( const KRect& rcClipRect); virtual void OnParentClipChangeNotify(const KRect& rcClipRect); virtual void OnAlphaChangeNotify(float fAlpha); virtual void OnChangeCaptionNotify(); #ifdef _KUI_INVALIDATION virtual void OnShowNotify( bool bShowFlag ); virtual void ActivateImageCache( bool bActive ); virtual void OnDeviceLost(); #endif bool IsMoving() { return m_bMoving; } void SetMoving(bool b = true) { m_bMoving = b; } // MJ 2004/09/15 void Create(KStream& stream, KUIWndManager* pManager); void AddButton( const char *_id, const char *_caption, const char* _toolTip = ""); void SetStatusText( const char *text ); void SetResizeUnit(int nXUnit, int nYUnit, KSize minSize, KSize maxSize); void SetGenWndAniName(LPCSTR lpszAniNAme, int nType); void SetCustomMovingRect(const KRect& rcMovingRect); void AddCustomRect(const KRect& rcCustom); void ChangeCustomRect(const KRect& rcMovingRect, int nIndex); KRect& GetCustomRect(int nIndex); int GetCustomRectSize() const; void RemoveCustomRectAll(); bool RemoveCustomRect(DWORD dwIndex); void SwapControl( const char* szID, const char* szSwapID ); bool IsAbleMoveWin() { return m_bWinMove; } static void AbleMoveWin( bool bWinMove ) { m_bWinMove = bWinMove; } enum GENWND_DROP_STATE { STATE_NORMAL = 0, STATE_CAN_DROP, STATE_CANNOT_DROP, TOTAL_STATE, }; protected: KRect _calculateCorrectionRect(const KRect& rcRect); const KRect& _calculateChildRect(const KRect & rcWindowRect); void _refreshStatusBar(); void _reArrangeFrame(); void _reArrangeBackground(); void _makeSpriteFrame(); void _makeBackgroundFrame(); void _makeTopFrame(); void _updateTopFrameRect(); #ifdef _KUI_INVALIDATION // { [sonador] void AddPopupControl( KUIControl* pControl ); void RemovePopupControl( KUIControl* pControl ); void RemoveAllPopupControl(); void _render( KViewportObject* pViewport, bool isFront ); void _renderPopupControl( KViewportObject *pViewport, bool isFront = false ); void _renderToolTip( KViewportObject *pViewport, bool isFront ); bool _initImageCache(); void _releaseImageCache(); bool _prepareImageCache( bool isFront ); bool _isTopWindow() const { return GetParent() == 0; } // } #endif protected: KUIControlSimpleButton* m_pMinimize; KUIControlSimpleButton* m_pClose; KUIControlSimpleButton* m_pResize; KUIControlTitleBar* m_pTitleBar; KUIControlStatusBar* m_pStatusBar; KRect m_rcTopFrame; KRect m_rcMinimize; KRect m_rcClose; KRect m_rcTitleBar; KRect m_rcStatusBar; KRect m_rcResize; std::string m_sTotalAniName[TOTAL_GENWND_ANINAME]; // minimize, Close, Resize, Titlebar, StatusBar 등 std::vector m_vtGenWndControls; std::vector m_VtButtons; #ifdef _KUI_INVALIDATION std::vector m_vtPopupControl; #endif KRect m_rcChildRect; std::string m_sStatusBarCaption; std::string m_sFrameAniName; int m_nResizeXUnit; int m_nResizeYUnit; KSize m_minSize; KSize m_maxSize; bool m_bResizing; bool m_bMoving; KPoint m_ptMovingOffset; std::vector m_vtCustomRect; KRect m_rcPieceArea[9]; int m_nPieceCount; KSpritePrimitive* m_pSpriteList; KRect* m_pBackgroundArea; int m_nBackgroundCount; KSpritePrimitive* m_pBackgroundList; KSpritePrimitive* m_pTopFrame; KUIDragAndDropNormalIconRenderer* m_pDragAndDropIcon; // { [sonador] #ifdef _KUI_INVALIDATION K3DRenderTargetSPtr m_spImageCache; KSpritePrimitive* m_pImageCachePrimitive; bool m_bActivateImageCache; bool m_bNeedToCheckCached; #endif // } bool m_bRightDown; static bool m_bWinMove; };