From 5f40d3a705d154e8771b4c9cdf8bacb0db039341 Mon Sep 17 00:00:00 2001 From: Alexa Wolfe Date: Sat, 7 Jan 2017 02:49:21 +0100 Subject: [PATCH] Remove comments from MWidget.cpp and .h --- Mint2/Include/MWidget.h | 328 ++++++++++----------------------------- Mint2/Source/MWidget.cpp | 300 +++++++---------------------------- 2 files changed, 136 insertions(+), 492 deletions(-) diff --git a/Mint2/Include/MWidget.h b/Mint2/Include/MWidget.h index bef4bab9..49d47d8e 100644 --- a/Mint2/Include/MWidget.h +++ b/Mint2/Include/MWidget.h @@ -2,24 +2,17 @@ // MINT ( MAIET In-house wiNdows sysTem ) // //////////////////////////////////////////////////////////////////////////////// -#ifndef MWIDGET_H -#define MWIDGET_H +#pragma once #include "CMPtrList.h" #include "MDrawContext.h" #include "MTypes.h" #include "MEvent.h" - - class MWidget; -/// À§Á¬µéÀÇ ¸Þ¼¼Áö¸¦ ¹ÞÀ» ¼ö ÀÖ´Â Listener(Pure Virtual Class) class MListener{ public: - /// ¸Þ¼¼Áö¸¦ ¹Þ±âÀ§ÇÑ Virtual Function - /// @param pWidget ¸Þ¼¼Áö¸¦ º¸³»´Â À§Á¬ Æ÷ÀÎÅÍ - /// @param szMessage ¸Þ¼¼Áö(½ºÆ®¸µ) virtual bool OnCommand(MWidget* pWidget, const char* szMessage) = 0; }; @@ -27,10 +20,9 @@ class MListener{ class MToolTip; class MResourceMap; -/// À§Á¬ÀÇ Z ¼ø¼­ enum MZOrder{ - MZ_TOP = 0, ///< ¸Ç ¾ÕÀ¸·Î - MZ_BOTTOM, ///< ¸Ç µÚ·Î + MZ_TOP = 0, + MZ_BOTTOM, }; struct MAnchors @@ -39,321 +31,201 @@ struct MAnchors bool m_bRight; bool m_bTop; bool m_bBottom; - MAnchors(void) { m_bLeft = true; m_bRight = false; m_bTop = true; m_bBottom = false; } + MAnchors() { m_bLeft = true; m_bRight = false; m_bTop = true; m_bBottom = false; } MAnchors(bool bLeft, bool bRight, bool bTop, bool bBottom) { m_bLeft = bLeft; m_bRight = bRight; m_bTop = bTop; m_bBottom = bBottom; } }; -#define MWIDGET_NAME_LENGTH 256 ///< À§Á¬ À̸§ ÃÖ´ë ±æÀÌ +#define MWIDGET_NAME_LENGTH 256 -/// ±âº» À§Á¬ Ŭ·¡½º class MWidget : public MListener{ private: - bool m_bEnable; ///< Enable - bool m_bFocusEnable; ///< Focus Enable + bool m_bEnable; + bool m_bFocusEnable; - MListener* m_pListener; ///< Listener - MToolTip* m_pToolTip; ///< ±âº» ÅøÆÁ + MListener* m_pListener; + MToolTip* m_pToolTip; int m_nAndPos; - int m_nAccelerator; ///< Accelerator Key + int m_nAccelerator; protected: - bool m_bVisible; ///< Visible Flag + bool m_bVisible; - CMPtrList m_Children; ///< Children Widgets + CMPtrList m_Children; - MWidget* m_pParent; ///< Parent Widget - CMPtrList m_Exclusive; ///< Exclusive Child Widget Stack ( for Modal Support ) + MWidget* m_pParent; + CMPtrList m_Exclusive; - MCursor* m_pCursor; ///< Default Cursor of this Widget - MFont* m_pFont; ///< Default Font of this Widget + MCursor* m_pCursor; + MFont* m_pFont; - static MWidget* m_pCapturedWidget; ///< SetCapture(), ReleaseCapture() - static MWidget* m_pFocusedWidget; ///< SetFocus() + static MWidget* m_pCapturedWidget; + static MWidget* m_pFocusedWidget; - bool m_bZOrderChangable; ///< Z Order Change by L-Button Click - bool m_bResizable; ///< Resizable? + bool m_bZOrderChangable; + bool m_bResizable; - int m_nResizeSide; ///< 0: N/A 1: Up 2: Right 4: Down 8: Left(BitFlag) + int m_nResizeSide; - unsigned char m_nOpacity; ///< ºÒÅõ¸íµµ -// bool m_bVisibleChildren; ///< Children WidgetÀÇ Visibility + unsigned char m_nOpacity; - bool m_bClipByParent; ///< Parent Widget¿¡ ÀÇÇØ ClipµÇ´Â°¡? + bool m_bClipByParent; - MAlignmentMode m_BoundsAlignment; ///< m_Rect¿¡ ´ëÇÑ Alignment + MAlignmentMode m_BoundsAlignment; public: - char m_szName[MWIDGET_NAME_LENGTH]; ///< Name - char m_szIDLName[MWIDGET_NAME_LENGTH]; ///< Name + char m_szName[MWIDGET_NAME_LENGTH]; + char m_szIDLName[MWIDGET_NAME_LENGTH]; - MRECT m_Rect; ///< Rect in Parent Widget - MRECT m_IDLRect; ///< IDL ¿¡¼­ ÀоúÀ»¶§ÀÇ Ãʱâ rect + MRECT m_Rect; + MRECT m_IDLRect; - MAnchors m_Anchors; ///< Parent Widget¿¡ ºñ·ÊÇؼ­ À§Ä¡Çϴ°¡? - int m_nMinWidth, m_nMinHeight; ///< À§Á¬ÀÇ ÃÖ¼Ò Å©±â + MAnchors m_Anchors; + int m_nMinWidth, m_nMinHeight; bool m_bisListBox; int m_nDebugType; - bool m_bEventAcceleratorCall;///< Å°ÀÔ·ÂÀ̺¥Æ®·Î ºÒ·È´ÂÁö °¨Áö + bool m_bEventAcceleratorCall; protected: // Only for Designer Mode - bool m_bEnableDesignerMode; ///< Designer Mode È°¼ºÈ­ Ç÷¡±× - int m_nDMDragWidget; ///< À§Á¬ Move ¶Ç´Â Resize Ç÷¡±× - MPOINT m_DMDragPoint; ///< À§Á¬ Move ¶Ç´Â Resize Æ÷Áö¼Ç - bool m_bModifiedByDesigner; ///< Designer¿¡ ÀÇÇØ À§Ä¡,Å©±â°¡ ¼öÁ¤µÈ °æ¿ì - bool m_bAddedByDesigner; ///< Designer¿¡ ÀÇÇØ Ãß°¡µÈ °æ¿ì - int m_nID; ///< À§Á¬ÀÇ ID + bool m_bEnableDesignerMode; + int m_nDMDragWidget; + MPOINT m_DMDragPoint; + bool m_bModifiedByDesigner; + bool m_bAddedByDesigner; + int m_nID; private: - /// Local Coordinate¸¦ ÀÌ¿ëÇÑ Local Event·Î º¯È¯ void MakeLocalEvent(MEvent* pLoalEvent, const MEvent* pEvent); - /// Event¿¡¼­ ResizeºÎºÐ ó¸® bool EventResize(MEvent* pEvent); protected: - /// Child Widget ¸Ç ¾Õ¿¡ Ãß°¡ void InsertChild(MWidget* pWidget); - /// Child Widget Ãß°¡ void AddChild(MWidget* pWidget); - /// Child Widget »èÁ¦ void RemoveChild(MWidget* pWidget); - // Accelerator¸¦ szTextÀÇ &µÚ¿¡ ³ª¿À´Â ¹®ÀÚ·Î ÇÑ´Ù. - //void UseAcceleractorAndCharacter(char* szText); - /// Exclusive Stack¿¡ Ãß°¡ÇÑ´Ù. void AddExclusive(MWidget* pWidget); - /// Exclusive Stack¿¡¼­ Á¦°ÅÇÑ´Ù. bool RemoveExclusive(MWidget* pWidget); - /// Runtime Loop - virtual void OnRun(void); - /// Draw Handler + virtual void OnRun(); virtual void OnDraw(MDrawContext* pDC); - /* - /// Draw Handler - /// @deprecated 3D Rendering Pass¸¦ µû·Î ó¸®Çϱâ À§ÇÑ ÄÚµå·Î ´õÀÌ»ó »ç¿ëÇÏÁö ¾Ê´Â´Ù. - virtual void OnDraw3D(MDrawContext3D* pDC); - */ - /// Event Handler. Event°¡ 󸮵Ǹé return true, ¾Æ´Ï¸é return false. + virtual bool OnEvent(MEvent* pEvent, MListener* pListener); - /// ÇÖÅ°¸¦ ´­·¶À»¶§ ºÒ·ÁÁö´Â À̺¥Æ® Çڵ鷯 - //virtual bool OnHotKey(int a, bool bShift, bool bCtrl, bool bAlt){ return false; } virtual bool OnHotKey(int nID){ return false; } - /// Show()È£Ãâ¿¡ ÀÇÇÑ Event Handler - virtual bool OnShow(void); - virtual void OnHide(void); + virtual bool OnShow() { return true; } + virtual void OnHide() {} - /// Æ÷Ä¿½º Çڵ鷯 virtual void OnSetFocus(void){} virtual void OnReleaseFocus(void){} - /// SetSize(), SetBounds()È£Ãâ¿¡ ÀÇÇÑ Event Handler - virtual void OnSize(int w, int h); + virtual void OnSize(int w, int h) {} - /// Show(), Hide()È£Ãâ¿¡ ÀÇÇÑ Event Handler void OnShow(bool bVisible); - /// Tab Key - virtual bool OnTab(bool bForward=true); - - /// Drop&Drop¿¡ ÀÇÇØ ³õ¿©Áö´Â Çڵ鷯 + virtual bool OnTab(bool bForward = true); virtual bool OnDrop(MWidget* pSender, MBitmap* pBitmap, const char* szString, const char* szItemString); - - /// Listener Event Handler ( ÁöÁ¤ÇÑ ¸Þ¼¼Áö¸¦ ¼öÇàÇßÀ¸¸é return true¸¦ ÇÑ´Ù. ) virtual bool OnCommand(MWidget* pWidget, const char* szMessage){ return false; } - /// Anchor ¼³Á¤¿¡ µû¸¥ Children Resize - /// @param w new width - /// @param h new height void ResizeChildrenByAnchor(int w, int h); - /// Bounds Alignment¿¡ µû¸¥ À§Ä¡°ª void GetBoundsAlignmentPosition(MPOINT* p, MAlignmentMode am, int w=-1, int h=-1); public: - /// Workspace°¡ º¯°æµÉ¶§ È£ÃâµÇ´Â ÇÔ¼ö - //virtual void OnReSize(); - -public: - /// @param szName À§Á¬ À̸§ - /// @param pParent ºÎ¸ð À§Á¬ - /// @param szName ¸Þ¼¼Áö¸¦ Àü´Þ¹ÞÀ» ¸®½º³Ê, º¸ÅëÀº ºÎ¸ð À§Á¬ÀÌ ÇØ´çµÈ´Ù. MWidget(const char* szName=NULL, MWidget* pParent=NULL, MListener* pListener=NULL); - virtual ~MWidget(void); + virtual ~MWidget(); - /// Loop°¡ µ¹¶§¸¶´Ù Widget System¿¡¼­ ó¸®ÇÒ ÀÏÀÌ ÀÖÀ»¶§ ½ÇÇàÇÑ´Ù. - void Run(void); - /// ÀÌ WidgetÀ» ºñ·ÔÇÑ Child WidgetÀ» ±×¸°´Ù. + void Run(); void Draw(MDrawContext* pDC); - /// ÇöÀç ´Ù½Ã ±×¸°´Ù. void Redraw(void); - /// À̺¥Æ®¸¦ ó¸®ÇÒ Çڵ鷯 È£Ãâ bool Event(MEvent* pEvent); - /// Å°º¸µå Accelerator À̺¥Æ®¸¸ ó¸® bool EventAccelerator(MEvent* pEvent); - /// µðÆúÆ® Å°(Enter, ESC) Çڵ鷯 È£Ãâ bool EventDefaultKey(MEvent* pEvent); - /// À§Á¬À» º¸¿©ÁØ´Ù. - /// @param bVisible Visible Flag - /// @param bModal Modal Dialog Flag virtual void Show(bool bVisible=true, bool bModal=false); - /// À§Á¬À» °¨Ãá´Ù. - void Hide(void){ Show(false); } - /// À§Á¬À» È°¼ºÈ­ ½ÃŲ´Ù. - /// @param bEnable Enable Flag + void Hide(){ Show(false); } void Enable(bool bEnable=true); - /// À§Á¬ÀÌ º¸À̴°¡? - bool IsVisible(void); - /// À§Á¬ÀÌ È°¼ºÈ­ µÇ¾ú´Â°¡? - bool IsEnable(void); + bool IsVisible(); + bool IsEnable(); void SetResizable(bool bEnable); - bool IsResizable(void); + bool IsResizable(); - /// ¸®½º³Ê ÁöÁ¤ - /// @param pListener ÁöÁ¤ÇÒ ¸®½º³Ê virtual void SetListener(MListener* pListener); - /// ÇöÀç ¸®½º³Ê ¾ò±â - /// @return ÇöÀç ¸®½º³Ê - virtual MListener* GetListener(void); - + virtual MListener* GetListener(); - /// À§Á¬ ID ¾ò±â - int GetID(void); - /// À§Á¦ ID ÁöÁ¤Çϱâ + int GetID(); void SetID(int nID); - /// À§Á¬ ÅؽºÆ®(Name) ÁöÁ¤Çϱâ virtual void SetText(const char* szText); - /// À§Á¬ ÅؽºÆ®(Name) ¾ò±â - virtual const char* GetText(void); + virtual const char* GetText(); - /// ÇöÀç À§Á¬¿¡ ¸ðµç ¸¶¿ì½º ¸Þ¼¼Áö°¡ °¡µµ·Ï ĸÃÄ - void SetCapture(void); - /// ÇöÀç ĸÃÄµÈ À§Á¬À» ÇØÁ¦ - void ReleaseCapture(void); + void SetCapture(); + void ReleaseCapture(); void SetFocusEnable(bool bEnable); - bool IsFocusEnable(void); - - /// À§Á¬¿¡ Æ÷Ä¿½º¸¦ À§Ä¡½ÃŲ´Ù. Æ÷Ä¿½ºµÈ À§Á¬¿¡ Å°º¸µå ¸Þ¼¼Áö°¡ ¿ì¼±ÀûÀ¸·Î µé¾î°£´Ù. - void SetFocus(void); - /// À§Á¬¿¡ Æ÷Ä¿½º¸¦ ÇØÁ¦½ÃŲ´Ù. - void ReleaseFocus(void); - /// À§Á¬¿¡ Æ÷Ä¿½º¸¦ °¡Áö°í Àִ°¡? - bool IsFocus(void); - - /// ºÎ¸ð À§Á¬À» ¾ò¾î³½´Ù. - MWidget* GetParent(void); - /// ÀÚ½Ä À§Á¬ °¹¼ö¸¦ ¾ò¾î³½´Ù. - int GetChildCount(void); - /// ÀÚ½Ä À§Á¬À» ¾ò¾î³½´Ù. - /// @param i ÀÚ½Ä À§Á¬ À妽º + bool IsFocusEnable(); + + void SetFocus(); + void ReleaseFocus(); + bool IsFocus(); + + MWidget* GetParent(); + int GetChildCount(); MWidget* GetChild(int i); - /// ÀÚ½Ä À§Á¬ÀÇ À妽º¸¦ ¾ò¾î³½´Ù. - /// @param pWidget ÀÚ½Ä À§Á¬ - /// @return ÀÚ½Ä À§Á¬ÀÇ À妽º int GetChildIndex(MWidget* pWidget); - /// Exculsive ¸ðµå(Modal)·Î ÀüȯÇÑ´Ù. Exclusive ¸ðµå·Î ¼³Á¤µÇ¾î ÀÖ´Â À§Á¬ÀÌ ¸ðµç ¸Þ¼¼Áö¸¦ µ¶Á¡ÇÑ´Ù. - void SetExclusive(void); - /// Exclusive ¸ðµå¸¦ ÇØÁ¦Çϳª. - void ReleaseExclusive(void); - /// Exclusive StackÀÇ °¡Àå ¸¶Áö¸· À§Á¬À» ¾ò¾î³½´Ù. - MWidget* GetLatestExclusive(void); - /// Child WidgetÀÌ ExclusiveÀÎÁö Å×½ºÆ® + void SetExclusive(); + void ReleaseExclusive(); + MWidget* GetLatestExclusive(); bool IsExclusive(MWidget* pWidget); - /// À§Á¬¿¡ Ä¿¼­¸¦ ¼³Á¤ÇÑ´Ù. - /// @param pCursor À§Á¬¿¡ ¼³Á¤ÇÒ Ä¿¼­ - /// @return ÀÌÀü¿¡ ¼³Á¤µÇ¾î ÀÖ´ø Ä¿¼­ MCursor* SetCursor(MCursor* pCursor); - /// ÇöÀç Ä¿¼­¸¦ ¾ò¾î³½´Ù. - MCursor* GetCursor(void); + MCursor* GetCursor(); - /// À§Á¬¿¡ ÆùÆ®¸¦ ¼³Á¤ÇÑ´Ù. MFont* SetFont(MFont* pFont); - /// ÇöÀç ÆùÆ®¸¦ ¾ò¾î³½´Ù. - MFont* GetFont(void); + MFont* GetFont(); - /// Size ÁöÁ¤Çϱâ - /// @param w, h °¡·Î ¼¼·Î Å©±â void SetSize(int w, int h); - /// Size ÁöÁ¤Çϱâ - /// @param s »çÀÌÁî void SetSize(MSIZE& s); - /// Parent WidgetÀÇ Local ÁÂÇ¥°è¿¡¼­ Poition ÁöÁ¤Çϱâ - /// @param x, y À§Ä¡ void SetPosition(int x, int y); - /// Parent WidgetÀÇ Local ÁÂÇ¥°è¿¡¼­ Poition ÁöÁ¤Çϱâ - /// @param p À§Ä¡ void SetPosition(const MPOINT& p); - /// Parent WidgetÀÇ Local ÁÂÇ¥°è¿¡¼­ Initial Rect ÁöÁ¤Çϱâ void SetInitialBounds(MRECT& r); - /// Parent WidgetÀÇ Local ÁÂÇ¥°è¿¡¼­ Rect ÁöÁ¤Çϱâ - /// @param r Rectangle void SetBounds(const MRECT& r); - /// Parent WidgetÀÇ Local ÁÂÇ¥°è¿¡¼­ Rect ÁöÁ¤Çϱâ - /// @param x,y,w,h Rectangle void SetBounds(int x, int y, int w, int h); - /// Parent WidgetÀÇ Local ÁÂÇ¥°è¿¡¼­ Position ¾ò¾î³»±â - MPOINT GetPosition(void); - /// Parent WidgetÀÇ Local ÁÂÇ¥°è¿¡¼­ Rect ¾ò¾î³»±â - MRECT GetRect(void); - /// idl¿¡¼­ ÀÐÀº rect¸¦ ¾ò´Â´Ù - MRECT GetIDLRect(void); - /// À§Ä¡¿¡´ëÇÑ ¾ó¶óÀθÕÆ® ÁöÁ¤ + MPOINT GetPosition(); + MRECT GetRect(); + MRECT GetIDLRect(); void SetBoundsAlignment(MAlignmentMode am, int w, int h); - /// À§Ä¡¿¡´ëÇÑ ¾ó¶óÀθÕÆ® ¾ò±â - MAlignmentMode GetBoundsAlignment(void); + MAlignmentMode GetBoundsAlignment(); void SetOpacity(unsigned char nOpacity); - unsigned char GetOpacity(); + unsigned char GetOpacity() const; - /// Screen ÁÂÇ¥°è¿¡¼­ Rect ¾ò¾î³»±â - /// @deprecated Àü¿ª ÁÂÇ¥°è´Â È¥¶õÀ» °¡Á®¿À¹Ç·Î ·ÎÄà ÁÂÇ¥°è ÇÔ¼öµé·Î ´ëü, Àü¿ª ÁÂÇ¥¸¦ ¾Ë°í ½ÍÀ¸¸é MClientToScreen(),MScreenToClient()¸¦ ÀÌ¿ë - MRECT GetScreenRect(void) const; + MRECT GetScreenRect() const; - /// ÅøÆÁ ½ºÆ®¸µ ÁöÁ¤ void AttachToolTip(const char* szToolTipString=NULL); - /// ÅøÆÁ ¿ÀºêÁ§Æ® ÁöÁ¤ void AttachToolTip(MToolTip* pToolTip); - /// ÅøÆÁÀ» ¾ø¾Ú - void DetachToolTip(void); - /// ÇöÀç ÅøÆÁ ¿ÀºêÁ§Æ® ¾ò±â - MToolTip* GetToolTip(void); + void DetachToolTip(); + MToolTip* GetToolTip(); - /// Accelerator ÁöÁ¤ void SetAccelerator(int a); - /// Label¿¡¼­ &´ÙÀ½¿¡ ³ª¿À´Â ¹®ÀÚ·Î Accelerator ÁöÁ¤ - void SetLabelAccelerator(void); - /// ÇöÀç Accelerator ¾ò±â - char GetLabelAccelerator(void); - /// ÇöÀç ToolTipÀÇ Accelerator ¾ò±â - char GetToolTipAccelerator(void); - - /// WidgetÀÇ Ä¿½ºÅ͸¶ÀÌÁîµÈ Client Rect - virtual MRECT GetClientRect(void); - /// WidgetÀÇ ¿ø·¡ Client Rect(0, 0, width, height) - MRECT GetInitialClientRect(void); - - /// Child Widget ¼ø¼­¸¦ ¹Ù²ã ±×¸®´Â ¼ø¼­¸¦ Á¶Á¤ÇÑ´Ù. + void SetLabelAccelerator(); + char GetLabelAccelerator(); + char GetToolTipAccelerator(); + + virtual MRECT GetClientRect(); + MRECT GetInitialClientRect(); + void SetZOrder(MZOrder z); - /// ÀÚ¼Õ WidgetÁß ¸ÇóÀ½ ¹ß°ßµÈ Exclusive Widget ¸®ÅÏ - MWidget* FindExclusiveDescendant(void); + MWidget* FindExclusiveDescendant(); - /// À§Ä¡·Î À§Á¬ °Ë»ö MWidget* Find(int x, int y) { return Find(MPOINT(x, y)); } - /// À§Ä¡·Î À§Á¬ °Ë»ö MWidget* Find(const MPOINT& p); MWidget* FindDropAble(MPOINT& p); - /// ÇØ´ç IDÀÇ Drag Object°¡ Drop°¡´ÉÇÑ°¡? virtual bool IsDropable(MWidget* pSender){ return false; } bool Drop(MWidget* pSender, MBitmap* pBitmap, const char* szString, const char* szItemString); @@ -364,18 +236,13 @@ class MWidget : public MListener{ void GetHierarchicalName(char(&szName)[size]) { GetHierarchicalName(szName, size); } - /// °èÃþ ±¸Á¶¸¦ Æ÷ÇÔÇÑ À̸§ ¾ò¾î³»±â ( ¿¹: Parent/Child ) void GetHierarchicalName(char* szName, int maxlen); - /// °èÃþ ±¸Á¶¸¦ Æ÷ÇÔÇÑ À̸§À¸·Î À§Á¬ ã±â MWidget* FindWidgetByHierarchicalName(const char* szName); - /// ÇöÀç À§Á¬¿¡¼­ Acceleratorµî¿¡ ÀÇÇØ ¼öÇàµÉ ¼ö ÀÖ´Â Default Command¸¦ ÁöÁ¤ ( ¿À¹ö¶óÀ̵åÇÑ °æ¿ì return true¸¦ ÇÑ´Ù. ) virtual bool DefaultCommand(void){ return false; } - /// ¸Þ¼¼Áö°¡ ÀÏÄ¡Çϴ°¡? static bool IsMsg(const char* szMsg1, const char* szMsg2); - /// Query Anything virtual void* Query(const char* szQuery); void SetClipByParent(bool b) { @@ -383,55 +250,28 @@ class MWidget : public MListener{ } #define MINT_WIDGET "Widget" - /// Ŭ·¡½º À̸§ ¾ò±â virtual const char* GetClassName(void){ return MINT_WIDGET; } }; - -// Help Functions -/// &°¡ ÀÖ´Â À§Ä¡¸¦ ¾Ë·ÁÁØ´Ù. szText°¡ NULLÀ̸é m_szName¿¡¼­ &ÀÇ À§Ä¡¸¦ ã´Â´Ù. int GetAndPos(const char* szText); -/// & µÚ¿¡ ºÙ¾îÀÖ´Â ¹®ÀÚ¸¦ ¾ò¾î³½´Ù. char GetAndChar(const char* szText); -/// &¹®ÀÚ Á¦°Å int RemoveAnd(char* szText); template int RemoveAnd(char(&szRemovedText)[size], const char* szText) { return RemoveAnd(szRemovedText, size, szText); } -/// &¹®ÀÚ Á¦°Å -/// @param szRemovedText [out] Á¦°ÅµÈ ¹®ÀÚ¿­ -/// @param szText [in] ¼Ò½º ¹®ÀÚ¿­ int RemoveAnd(char* szRemovedText, int maxlen, const char* szText); template int RemoveAnd(char(&szRemovedFrontText)[size], char* cUnderLineChar, char* szRemovedBackText, const char* szText) { return RemoveAnd(szRemovedFrontText, size, cUnderLineChar, szRemovedBackText, szText); } -/// &¹®ÀÚ Á¦°Å -/// @param szRemovedFrontText [out] &¾ÕÂÊ ¹®ÀÚ¿­ -/// @param cUnderLineChar [out] &·Î ÀÎÇØ ¹ØÁÙÀÌ ºÙÀ» ¹®ÀÚ¿­ -/// @param szRemovedBackText [out] &µÚÂÊ ¹®ÀÚ¿­ -/// @param szText [in] ¼Ò½º ¹®ÀÚ¿­ int RemoveAnd(char* szRemovedFrontText, int maxlen, char* cUnderLineChar, char* szRemovedBackText, const char* szText); -/// ·ÎÄà À§Ä¡¸¦ Àü¿ª À§Ä¡·Î º¯È¯ MPOINT MClientToScreen(const MWidget* pWidget, const MPOINT& p); -/// Àü¿ª À§Ä¡¸¦ ·ÎÄà À§Ä¡·Î º¯È¯ MPOINT MScreenToClient(const MWidget* pWidget, const MPOINT& p); -/// ·ÎÄà ¿µ¿ªÀ» Àü¿ª ¿µ¿ªÀ¸·Î º¯È¯ MRECT MClientToScreen(const MWidget* pWidget, const MRECT& p); -/// Àü¿ª ¿µ¿ªÀ» ·ÎÄà ¿µ¿ªÀ¸·Î º¯È¯ MRECT MScreenToClient(const MWidget* pWidget, const MRECT& p); -/// ÇöÀç Ä¿¼­ À§Ä¡ ¾ò±â -MPOINT GetCursorPosition(void); - -/// °°Àº À§Á¬ Ŭ·¡½ºÀÎÁö °Ë»ç -inline bool MIsSameWidgetClass(MWidget* pWidget, const char* szClassName); -/// °°Àº À§Á¬ Ŭ·¡½ºÀÎÁö °Ë»ç -inline bool MIsSameWidgetClass(MWidget* pWidgetA, MWidget* pWidgetB); - - -#endif +MPOINT GetCursorPosition(); diff --git a/Mint2/Source/MWidget.cpp b/Mint2/Source/MWidget.cpp index 5c813504..04e914c0 100644 --- a/Mint2/Source/MWidget.cpp +++ b/Mint2/Source/MWidget.cpp @@ -94,7 +94,6 @@ bool MWidget::EventResize(MEvent* pEvent) r.x = pp.x; } SetPosition(r.x, r.y); -// Àӽ÷ΠÀ§Á¬ ÃÖ¼Ò Å©±â¸¦ ÁöÁ¤, ³ªÁß¿¡ ¸â¹ö·Î ºüÁ®ÁÙ ÇÊ¿ä°¡ ÀÖ´Ù. if(r.wGetOpacity(); -// else - m_nOpacity = 255; - -// m_bVisibleChildren = true; + m_nOpacity = 255; m_bEnableDesignerMode = true; m_nDMDragWidget = 0; m_bModifiedByDesigner = false; m_bAddedByDesigner = false; - //m_nID = -1; m_BoundsAlignment = MAM_NOTALIGN; - /* - m_bAnchorLeft = true; - m_bAnchorRight = false; - m_bAnchorTop = true; - m_bAnchorBottom = false; - */ - m_nMinWidth = 10; m_nMinHeight = 10; @@ -259,18 +227,8 @@ MWidget::~MWidget(void) for(int i=0; im_pParent = NULL; // ºÎ¸ð°¡ ¸ÕÀú Á×À» °æ¿ì Children's Parent Link »èÁ¦ - } - - /* - // ±âÁ¸ Äڵ尡 ¸í½ÃÀûÀ¸·Î Child¸¦ °¢°¢ °¡Áö°í ÀÖÀ»¶§ ¹®Á¦°¡ ¹ß»ýÇÑ´Ù. - // °¡Áö°í ÀÖ´Â Childrenµµ ¸ðµÎ »èÁ¦ - while(m_Children.GetCount()>0){ - MWidget* pWidget = m_Children.Get(0); - delete pWidget; - //RemoveChild(pWidget); + pWidget->m_pParent = NULL; } - */ if(m_pParent!=NULL) m_pParent->RemoveChild(this); if(MWidget::m_pCapturedWidget==this) MWidget::m_pCapturedWidget = NULL; @@ -289,12 +247,6 @@ void MWidget::OnDraw(MDrawContext* pDC) pDC->FillRectangle(GetInitialClientRect()); } -/* -void MWidget::OnDraw3D(MDrawContext3D* pDC) -{ -} -*/ - bool MWidget::OnEvent(MEvent* pEvent, MListener* pListener) { return false; @@ -309,28 +261,23 @@ void MWidget::Run(void) pCurWnd->Run(); } } -#include "MDebug.h" void MWidget::Draw(MDrawContext* pDC) { if(m_bVisible==false) return; -// MBeginProfile(100+m_nID,m_szIDLName); - - // Opacity ¼³Á¤ unsigned char nLastOpacity; nLastOpacity = pDC->GetOpacity(); MRECT sr = GetScreenRect(); pDC->SetOrigin(MPOINT(sr.x, sr.y)); - // ±×¸®±â Àü ÃʱâÈ­ if(m_pFont!=NULL) pDC->SetFont(m_pFont); - else pDC->SetFont(MFontManager::Get(NULL)); // ÆùÆ®°¡ NULLÀÎ °æ¿ì Default Font·Î ¼¼ÆÃÇÑ´Ù. + else pDC->SetFont(MFontManager::Get(NULL)); pDC->SetOpacity((unsigned char)(nLastOpacity * (float)(m_nOpacity / 255.0f))); if(!IsEnable()) - pDC->SetOpacity((unsigned char)(pDC->GetOpacity()*0.70)); // Disable »óÅÂÀ϶§ ³Ê¹« ¾îµÎ¿ö¼­ Á» ¹à°Ô ÇßÀ½(µ¿È¯) + pDC->SetOpacity((unsigned char)(pDC->GetOpacity()*0.70)); bool bIntersect = true; MRECT rectScreen(0, 0, MGetWorkspaceWidth()-1, MGetWorkspaceHeight()-1); @@ -341,55 +288,32 @@ void MWidget::Draw(MDrawContext* pDC) }else PrevClipRect = rectScreen; - //if(GetParent()!=NULL) PrevClipRect = GetParent()->GetScreenRect(); MRECT CurrClipRect = GetScreenRect(); MRECT IntersectClipRect; if(m_bClipByParent==true){ - // ºÎ¸ð À§Á¬°ú °øÅëµÇ´Â ¿µ¿ªÀÌ ÀÖÀ» °æ¿ì¿¡¸¸ ±×¸°´Ù. if(PrevClipRect.Intersect(&IntersectClipRect, CurrClipRect)==true){ MRECT test = IntersectClipRect; if(IntersectClipRect.w>0 && IntersectClipRect.h>0) { pDC->SetClipRect(IntersectClipRect); - // ±×¸®±â OnDraw(pDC); } } } else{ pDC->SetClipRect(CurrClipRect); - // ±×¸®±â OnDraw(pDC); } - // Child Widget Drawing -// if(m_bVisibleChildren==true){ for(int i=0; iDraw(pDC); } - if(GetLatestExclusive()!=NULL) GetLatestExclusive()->Draw(pDC); // Exclusive WidgetÀ» ¸¶Áö¸·¿¡ ±×¸°´Ù. -// } + if(GetLatestExclusive()!=NULL) GetLatestExclusive()->Draw(pDC); - // Opacity Àç¼³Á¤ pDC->SetOpacity(nLastOpacity); - -// MEndProfile(100+m_nID); -} - -/* -void MWidget::Draw3D(MDrawContext3D* pDC) -{ - if(m_bVisible==true) OnDraw3D(pDC); - else return; - - for(int i=0; iDraw3D(pDC); - } } -*/ void MWidget::Redraw(void) { @@ -398,10 +322,8 @@ void MWidget::Redraw(void) bool MWidget::Event(MEvent* pEvent) { - if(m_bVisible==false) return false; // º¸ÀÌ´Â À©µµ¿ì¸¸ À̺¥Æ®¸¦ ó¸®ÇÒ ¼ö ÀÖ´Ù. + if(m_bVisible==false) return false; - // Look¿¡¼­ Á¤ÀÇÇÑ Client¿µ¿ªÀÌ ¾Æ´Ñ ½ÇÁ¦ Client ¿µ¿ª - //MRECT r = GetClientRect(); MRECT r = GetRect(); r.x = r.y = 0; @@ -415,15 +337,14 @@ bool MWidget::Event(MEvent* pEvent) if(pEvent->nMessage==MWM_LBUTTONDOWN ) int k=0; } - // Disable»óÅ¿¡¼­µµ ÅøÆÁÀº º¸ÀÌ°Ô ÇØÁØ´Ù. - //if(pEvent->nMessage==MWM_MOUSEMOVE && m_Rect.InPoint(pEvent->Pos)==true && (MWidget::m_pCapturedWidget==NULL || MWidget::m_pCapturedWidget==this)){ - if(r.InPoint(LocalEvent.Pos)==true && (MWidget::m_pCapturedWidget==NULL || MWidget::m_pCapturedWidget==this) && IsVisible()==true){ + + if(r.InPoint(LocalEvent.Pos)==true && (MWidget::m_pCapturedWidget==NULL || + MWidget::m_pCapturedWidget==this) && IsVisible()==true){ if(m_pCursor!=NULL) MCursorSystem::Set(m_pCursor); - else MCursorSystem::Set(MCURSOR_ARROW); // ¾Æ¹«°Íµµ ÁöÁ¤µÇ¾î ÀÖÁö ¾ÊÀ¸¸é Default Cursor·Î... + else MCursorSystem::Set(MCURSOR_ARROW); if(m_pToolTip!=NULL){ - // ÅøÆÁ º¸¿©ÁÖ±â À§ÇØ ZOrder¸¦ ¹Ù²Ù¸é ¾ÈµÇÁö¸¸, ÇØ°áÃ¥ÀÌ ¾øÀ¸¹Ç·Î ¿ì¼± ÀÌ·¸°Ô ÇصдÙ. - SetZOrder(MZ_TOP); // ÀÌ À©µµ¿ì¸¦ Â÷Àϵå À©µµ¿ì ¸Ç ¾Õ¿¡ º¸ÀÌ°Ô Çؼ­.. ÅøÆÁÀÌ °¡¸®Áö ¾Ê°Ô.. + SetZOrder(MZ_TOP); m_pToolTip->Show(true); } } @@ -435,10 +356,9 @@ bool MWidget::Event(MEvent* pEvent) if(m_bEnable==false) return false; -// if(m_bVisibleChildren==true && GetLatestExclusive()!=NULL){ if(GetLatestExclusive()!=NULL){ if(GetLatestExclusive()->Event(pEvent)==true) return true; - if(GetLatestExclusive()!=NULL) return false; // À̺¥Æ® Çڵ鷯¿¡ ÀÇÇØ Exclusive°¡ Ç®¸®´Â °æ¿ì°¡ ÀÖÀ¸¸é ´ÙÀ½À¸·Î ³Ñ¾î°£´Ù. + if(GetLatestExclusive()!=NULL) return false; } if(pEvent->nMessage==MWM_LBUTTONDOWN) @@ -446,20 +366,12 @@ bool MWidget::Event(MEvent* pEvent) if ( r.InPoint(LocalEvent.Pos)==true) { SetFocus(); -// OnSetFocus(); - if((m_bFocusEnable)&&(m_bZOrderChangable==true)) SetZOrder(MZ_TOP); // ÇØ´ç À§Á¬À» ¸Ç À§·Î ¿Ã·ÁÁØ´Ù. - } - else // ReleaseFocus - { -// ReleaseFocus(); -// OnReleaseFocus(); -// ReleaseCapture(); + if((m_bFocusEnable)&&(m_bZOrderChangable==true)) SetZOrder(MZ_TOP); } } -// if(m_bVisibleChildren==true && GetLatestExclusive()==NULL){ if(GetLatestExclusive()==NULL){ - for(int i=m_Children.GetCount()-1; i>=0; i--){ // ¸¶Áö¸·¿¡ Ãß°¡µÈ À©µµ¿ìºÎÅÍ + for(int i=m_Children.GetCount()-1; i>=0; i--){ MWidget* pCurWnd = m_Children.Get(i); if(pCurWnd->Event(pEvent)==true) { return true; @@ -467,29 +379,16 @@ bool MWidget::Event(MEvent* pEvent) } } - // À§Á¬ ¸®»çÀÌÁî - // Ŭ¶óÀ̾ðÆ® ¿µ¿ªÀ» ¹þ¾î³ª¼­ Á¦¾îÇؾßÇϹǷÎ, Event()¿¡¼­ ó¸®ÇÑ´Ù. if(EventResize(pEvent)==true) return true; - //if(pEvent->nMessage==MWM_RESIZE) OnReSize(); - - // HotKey - /* - if(pEvent->nMessage==MWM_KEYDOWN){ - //if(OnHotKey(pEvent->nKey, pEvent->GetShiftState(), pEvent->GetCtrlState(), pEvent->GetAltState())==true) return true; - if(OnHotKey(pEvent->nKey, pEvent->GetShiftState(), pEvent->bCtrl, pEvent->bAlt)==true) return true; - } - */ if(pEvent->nMessage==MWM_HOTKEY){ - //if(OnHotKey(pEvent->nKey, pEvent->GetShiftState(), pEvent->GetCtrlState(), pEvent->GetAltState())==true) return true; if(OnHotKey(pEvent->nKey)==true) return true; } // Focused Event if(pEvent->nMessage==MWM_CHAR || pEvent->nMessage==MWM_KEYDOWN || pEvent->nMessage==MWM_IMECOMPOSE || pEvent->nMessage==MWM_ACTIONKEYDOWN || pEvent->nMessage==MWM_ACTIONKEYUP || pEvent->nMessage==MWM_ACTIONPRESSED || pEvent->nMessage==MWM_ACTIONRELEASED){ - if (IsFocus()) { // KEY Event´Â Focus ¾ø´Â À§Á¬¿¡´Â Àǹ̾ø´Ù - //¸ÕÀú ÀڽĿ¡°Ô·Î ÀüÇØÁ®¼­ 󸮵Ǹé ok ó¸®ÇÑ ÀÚ½ÄÀÌ ¾øÀ¸¸é ºÎ¸ð¿¡°Ô±îÁö °£´Ù + if (IsFocus()) { if(OnEvent(&LocalEvent, GetListener())==true) return true; @@ -498,19 +397,10 @@ bool MWidget::Event(MEvent* pEvent) if(OnTab(!pEvent->GetShiftState())==true) return true; } - - /* - // Focused Widget¿¡°Ô ¿ì¼±±ÇÀÌ ÀÖÀ¸¸ç... - if(MWidget::m_pFocusedWidget==this){ // MWM_CHAR ¸Þ¼¼ÁöÀÎ °æ¿ì ÇöÀç Æ÷Ä¿½ºµÈ À©µµ¿ì¿¡°Ô¸¸ ¸Þ¼¼Áö°¡ º¸³»Áø´Ù. - if(OnEvent(&LocalEvent, GetListener())==true) - return true; - } - */ - // Accelerator´Â EventAcceleratorÂÊÀ¸·Î ºüÁü } } else{ - if((MWidget::m_pCapturedWidget==NULL || MWidget::m_pCapturedWidget==this)) // Capture°¡ °É¸± °æ¿ì CaptureµÈ À©µµ¿ì¿¡¸¸ ¸Þ¼¼Áö º¸³»±â + if((MWidget::m_pCapturedWidget==NULL || MWidget::m_pCapturedWidget==this)) if(OnEvent(&LocalEvent, GetListener())==true) return true; } @@ -522,31 +412,28 @@ bool MWidget::Event(MEvent* pEvent) bool MWidget::EventAccelerator(MEvent* pEvent) { - if(m_bVisible==false) return false; // º¸ÀÌ´Â À©µµ¿ì¸¸ À̺¥Æ®¸¦ ó¸®ÇÒ ¼ö ÀÖ´Ù. + if(m_bVisible==false) return false; if(m_bEnable==false) return false; if(!(pEvent->nMessage==MWM_KEYDOWN || pEvent->nMessage==MWM_SYSKEYDOWN)) return false; - // KEYDOWNÀ϶§ Edit¿¡ Focus°¡ ÀÖÀ» °æ¿ì Accelerator´Â ¹«½ÃµÈ´Ù. (SYSKEYDOWN¸¸ À¯È¿ÇÏ°Ô µÈ´Ù) if(pEvent->nMessage==MWM_KEYDOWN) if(MWidget::m_pFocusedWidget!=NULL) if(strcmp(MWidget::m_pFocusedWidget->GetClassName(), MINT_EDIT)==0) return false; if(GetLatestExclusive()!=NULL){ if(GetLatestExclusive()->EventAccelerator(pEvent)==true) return true; - if(GetLatestExclusive()!=NULL) return false; // À̺¥Æ® Çڵ鷯¿¡ ÀÇÇØ Exclusive°¡ Ç®¸®´Â °æ¿ì°¡ ÀÖÀ¸¸é ´ÙÀ½À¸·Î ³Ñ¾î°£´Ù. + if(GetLatestExclusive()!=NULL) return false; } if(GetLatestExclusive()==NULL){ - for(int i=m_Children.GetCount()-1; i>=0; i--){ // ¸¶Áö¸·¿¡ Ãß°¡µÈ À©µµ¿ìºÎÅÍ + for(int i=m_Children.GetCount()-1; i>=0; i--){ MWidget* pCurWnd = m_Children.Get(i); if(pCurWnd->EventAccelerator(pEvent)==true) return true; } } - // Accelerator char szKey[2] = {(char)pEvent->nKey, 0}; -// _strupr(szKey); if(m_nAccelerator==szKey[0]) { m_bEventAcceleratorCall = true; @@ -563,18 +450,18 @@ bool MWidget::EventAccelerator(MEvent* pEvent) bool MWidget::EventDefaultKey(MEvent* pEvent) { - if(m_bVisible==false) return false; // º¸ÀÌ´Â À©µµ¿ì¸¸ À̺¥Æ®¸¦ ó¸®ÇÒ ¼ö ÀÖ´Ù. + if(m_bVisible==false) return false; if(m_bEnable==false) return false; if(!(pEvent->nMessage==MWM_KEYDOWN))return false; if(GetLatestExclusive()!=NULL){ if(GetLatestExclusive()->EventDefaultKey(pEvent)==true) return true; - if(GetLatestExclusive()!=NULL) return false; // À̺¥Æ® Çڵ鷯¿¡ ÀÇÇØ Exclusive°¡ Ç®¸®´Â °æ¿ì°¡ ÀÖÀ¸¸é ´ÙÀ½À¸·Î ³Ñ¾î°£´Ù. + if(GetLatestExclusive()!=NULL) return false; } if(GetLatestExclusive()==NULL){ - for(int i=m_Children.GetCount()-1; i>=0; i--){ // ¸¶Áö¸·¿¡ Ãß°¡µÈ À©µµ¿ìºÎÅÍ + for(int i=m_Children.GetCount()-1; i>=0; i--){ MWidget* pCurWnd = m_Children.Get(i); if(pCurWnd->EventDefaultKey(pEvent)==true) return true; } @@ -590,28 +477,9 @@ bool MWidget::EventDefaultKey(MEvent* pEvent) return false; } -bool MWidget::OnShow(void) -{ - return true; -} - -void MWidget::OnHide(void) -{ -} - -void MWidget::OnSize(int w, int h) -{ -} - -/* -void MWidget::OnReSize() -{ -} -*/ - void MWidget::OnShow(bool bVisible) { - for(int i=m_Children.GetCount()-1; i>=0; i--){ // ¸¶Áö¸·¿¡ Ãß°¡µÈ À©µµ¿ìºÎÅÍ + for(int i=m_Children.GetCount()-1; i>=0; i--){ MWidget* pCurWnd = m_Children.Get(i); if(pCurWnd->m_bVisible==true) pCurWnd->OnShow(bVisible); } @@ -658,7 +526,7 @@ void MWidget::ResizeChildrenByAnchor(int w, int h) MWidget* pChild = m_Children.Get(i); if(pChild->GetBoundsAlignment()!=0){ pChild->SetBoundsAlignment(pChild->GetBoundsAlignment(), w, h); - continue; // Bounds Alignment¿¡ ¿ì¼±¼øÀ§°¡ ÀÖ´Ù. + continue; } MRECT r = pChild->m_Rect; @@ -704,12 +572,12 @@ void MWidget::Enable(bool bEnable) m_bEnable = bEnable; } -bool MWidget::IsVisible(void) +bool MWidget::IsVisible() { return m_bVisible; } -bool MWidget::IsEnable(void) +bool MWidget::IsEnable() { return m_bEnable; } @@ -719,7 +587,7 @@ void MWidget::SetResizable(bool bEnable) m_bResizable = bEnable; } -bool MWidget::IsResizable(void) +bool MWidget::IsResizable() { return m_bResizable; } @@ -729,12 +597,12 @@ void MWidget::SetListener(MListener* pListener) m_pListener = pListener; } -MListener* MWidget::GetListener(void) +MListener* MWidget::GetListener() { return m_pListener; } -int MWidget::GetID(void) +int MWidget::GetID() { return m_nID; } @@ -754,20 +622,19 @@ void MWidget::SetText(const char* szText) if(m_pToolTip!=NULL) if(m_pToolTip->IsUseParentName()==true) m_pToolTip->SetBounds(); SetLabelAccelerator(); - //if(m_nAcceleratorType==1) UseAcceleratorAndCharacter(szText); } -const char* MWidget::GetText(void) +const char* MWidget::GetText() { return m_szName; } -void MWidget::SetCapture(void) +void MWidget::SetCapture() { MWidget::m_pCapturedWidget = this; } -void MWidget::ReleaseCapture(void) +void MWidget::ReleaseCapture() { MWidget::m_pCapturedWidget = NULL; } @@ -777,32 +644,17 @@ void MWidget::SetFocusEnable(bool bEnable) m_bFocusEnable = bEnable; } -bool MWidget::IsFocusEnable(void) +bool MWidget::IsFocusEnable() { return m_bFocusEnable; } -void MWidget::SetFocus(void) +void MWidget::SetFocus() { if(m_bFocusEnable==false) return; - /* - if(m_pParent!=NULL){ - if(m_pParent->m_pExclusive!=NULL && m_pParent->m_pExclusive!=MWidget::m_pFocusedWidget) return; - } - */ - // ÀÚ½ÄÁß¿¡ Exclusive À§Á¬ÀÌ Àִ°æ¿ì, - // ÇöÀç Exclusive À§Á¬°ú ±× Children¿¡°Ô¸¸ Focus°¡ °¥ ¼ö ÀÖµµ·Ï ÇÑ´Ù. + MWidget* pExDes = FindExclusiveDescendant(); if(pExDes!=NULL) return; - /* - if(MWidget::m_pFocusedWidget!=NULL){ - if(MWidget::m_pFocusedWidget->m_pParent!=NULL){ - if(MWidget::m_pFocusedWidget->m_pParent->m_pExclusive==MWidget::m_pFocusedWidget){ - return; - } - } - } - */ if(MWidget::m_pFocusedWidget==this) return; @@ -812,24 +664,24 @@ void MWidget::SetFocus(void) OnSetFocus(); } -void MWidget::ReleaseFocus(void) +void MWidget::ReleaseFocus() { if(MWidget::m_pFocusedWidget==this) OnReleaseFocus(); MWidget::m_pFocusedWidget = NULL; } -bool MWidget::IsFocus(void) +bool MWidget::IsFocus() { if(MWidget::m_pFocusedWidget==this) return true; return false; } -MWidget* MWidget::GetParent(void) +MWidget* MWidget::GetParent() { return m_pParent; } -int MWidget::GetChildCount(void) +int MWidget::GetChildCount() { return m_Children.GetCount(); } @@ -853,7 +705,7 @@ void MWidget::SetExclusive(void) { if(m_pParent!=NULL){ m_pParent->AddExclusive(this); - SetFocus(); // Exclusive·Î º¸¿©Áú¶§ Æ÷Ä¿½Ì. + SetFocus(); } } @@ -893,7 +745,6 @@ void MWidget::SetSize(int w, int h) if(w<0) w = 1; if(h<0) h = 1; - // TODO: 100,100 À¸·Î ÁöÁ¤Çϸé default size °¡ µÇ¾î onsize°¡ ºÒ¸®Áö ¾ÊÀ½. if(w==m_Rect.w && h==m_Rect.h) return; ResizeChildrenByAnchor(w, h); @@ -914,9 +765,6 @@ void MWidget::SetPosition(int x, int y) { MPOINT p; - //if(m_BoundsAlignment!=MAM_NOTALIGN) return; // ¾ó¶óÀÎ ¸ðµå ¼³Á¤µÈ À§Á¬Àº À§Ä¡ Àç¼³Á¤À» Çã¿ëÇÏÁö ¾Ê´Â´Ù. - //m_BoundsAlignment = MAM_NOTALIGN; // À§Ä¡¸¦ ¹Ù²Ù¸é ¾ó¶óÀÎÀÌ ¾ø¾îÁø´Ù. - m_Rect.x = x; m_Rect.y = y; @@ -935,36 +783,24 @@ void MWidget::SetBounds(const MRECT& r) void MWidget::SetBounds(int x, int y, int w, int h) { SetPosition(x, y); - //m_Rect.x = x; - //m_Rect.y = y; if(w<0) w = 1; if(h<0) h = 1; SetSize(w, h); - /* - bool bResized = false; - if(w!=m_Rect.w || h!=m_Rect.h){ - m_Rect.w = w; - m_Rect.h = h; - bResized = true; - } - */ - - //if(bResized==true) OnSize(w, h); } -MPOINT MWidget::GetPosition(void) +MPOINT MWidget::GetPosition() { return MPOINT(m_Rect.x, m_Rect.y); } -MRECT MWidget::GetRect(void) +MRECT MWidget::GetRect() { return m_Rect; } -MRECT MWidget::GetIDLRect(void) +MRECT MWidget::GetIDLRect() { return m_IDLRect; } @@ -1000,7 +836,6 @@ void MWidget::SetBoundsAlignment(MAlignmentMode am, int w, int h) MPOINT p; GetBoundsAlignmentPosition(&p, m_BoundsAlignment, w, h); - // Æ÷Áö¼Ç Á¤·Ä¿¡ ÀÇÇØ Àç¼³Á¤ m_Rect.x = p.x; m_Rect.y = p.y; } @@ -1011,7 +846,7 @@ MAlignmentMode MWidget::GetBoundsAlignment(void) } -MRECT MWidget::GetScreenRect(void) const +MRECT MWidget::GetScreenRect() const { if(m_pParent!=NULL){ MRECT sr = m_pParent->GetScreenRect(); @@ -1048,17 +883,16 @@ MToolTip* MWidget::GetToolTip(void) void MWidget::SetAccelerator(int a) { - //m_nAcceleratorType = 0; // use custom accelerator type if(a==0) m_nAccelerator = -1; else m_nAccelerator = a; } -void MWidget::SetLabelAccelerator(void) +void MWidget::SetLabelAccelerator() { SetAccelerator(GetLabelAccelerator()); } -char MWidget::GetLabelAccelerator(void) +char MWidget::GetLabelAccelerator() { char szAnd[2] = {GetAndChar(m_szName), 0}; _strupr_s(szAnd); @@ -1066,7 +900,7 @@ char MWidget::GetLabelAccelerator(void) return szAnd[0]; } -char MWidget::GetToolTipAccelerator(void) +char MWidget::GetToolTipAccelerator() { if(m_pToolTip!=NULL){ char szAnd[2] = {GetAndChar(m_pToolTip->m_szName), 0}; @@ -1078,34 +912,13 @@ char MWidget::GetToolTipAccelerator(void) return -1; } } -/* -void MWidget::SetLabelAccelerator(void) -{ - m_nAcceleratorType = 1; // use label's & character - UseAcceleractorAndCharacter(m_szName); -} -void MWidget::SetToolTipAccelerator(void) -{ - m_nAcceleratorType = 2; // use tooltip's & character - if(m_pToolTip!=NULL) - UseAcceleractorAndCharacter(m_pToolTip->m_szName); - else - UseAcceleractorAndCharacter(NULL); -} - -void MWidget::EnableAccelerator(bool bEnabled) -{ - m_bAcceleratorEnabled = bEnabled; -} -*/ - -MRECT MWidget::GetClientRect(void) +MRECT MWidget::GetClientRect() { return MRECT(0, 0, m_Rect.w, m_Rect.h); } -MRECT MWidget::GetInitialClientRect(void) +MRECT MWidget::GetInitialClientRect() { return MWidget::GetClientRect(); } @@ -1129,7 +942,7 @@ void MWidget::SetZOrder(MZOrder z) MWidget* MWidget::FindExclusiveDescendant(void) { - if(m_Exclusive.GetCount()>0) return m_Exclusive.Get(m_Exclusive.GetCount()-1); // ¸¶Áö¸·¿¡ Ãß°¡µÈ°Í + if(m_Exclusive.GetCount()>0) return m_Exclusive.Get(m_Exclusive.GetCount()-1); for(int i=0; iSetOpacity(nOpacity); - } - */ } -unsigned char MWidget::GetOpacity() +unsigned char MWidget::GetOpacity() const { return m_nOpacity; }