[Wgui-cvs] wgui/includes wg_frame.h,1.17,1.18 wg_message.h,1.30,1.31 wg_messagebox.h,1.3,1.4 wg_poin
Status: Beta
Brought to you by:
greenwire
|
From: Rob W. <gre...@us...> - 2004-12-27 04:59:48
|
Update of /cvsroot/wgui/wgui/includes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24643/includes Modified Files: wg_frame.h wg_message.h wg_messagebox.h wg_point.h wg_rect.h wgui.h Log Message: Started work on the CMessageBox class. Index: wg_message.h =================================================================== RCS file: /cvsroot/wgui/wgui/includes/wg_message.h,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** wg_message.h 3 Jun 2004 19:10:52 -0000 1.30 --- wg_message.h 27 Dec 2004 04:59:36 -0000 1.31 *************** *** 68,71 **** --- 68,72 ---- CTRL_GAININGMOUSEFOCUS, //!< CMessage used to tell a control that it's getting the mouse focus CTRL_LOSINGMOUSEFOCUS, //!< CMessage used to tell a control that it's losing the mouse focus + CTRL_MESSAGEBOXRETURN, //!< CValueMessage sent when a CMessageBox closes APP_PAINT, //!< CMessage used to tell controls or windows to redraw themselves APP_EXIT, //!< CMessage used to tell controls or windows that the application is closing Index: wg_frame.h =================================================================== RCS file: /cvsroot/wgui/wgui/includes/wg_frame.h,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** wg_frame.h 23 Nov 2004 23:05:08 -0000 1.17 --- wg_frame.h 27 Dec 2004 04:59:36 -0000 1.18 *************** *** 34,39 **** { - //! NOTE - This class is not yet fully functional! - //! Frames are windows within a view that have their own window management controls --- 34,37 ---- *************** *** 47,54 **** //! \param pParent A pointer to the parent view //! \param pFontEngine A pointer to the font engine to use when drawing the control ! //! If this is left out (or set to 0) it will use the default font engine specified by the CApplication (which must be set before instantiating this object) //! \param sTitle The window title, which will appear in the title bar of the view //! \param bResizable If true, the window will be resizable ! CFrame(const CRect& WindowRect, CView* pParent, CFontEngine* pFontEngine, std::string sTitle, bool bResizable = true); //! Standard destructor --- 45,52 ---- //! \param pParent A pointer to the parent view //! \param pFontEngine A pointer to the font engine to use when drawing the control ! //! If this is set to 0 it will use the default font engine specified by the CApplication (which must be set before instantiating this object) //! \param sTitle The window title, which will appear in the title bar of the view //! \param bResizable If true, the window will be resizable ! CFrame(const CRect& WindowRect, CView* pParent, CFontEngine* pFontEngine, const std::string& sTitle, bool bResizable = true); //! Standard destructor Index: wg_messagebox.h =================================================================== RCS file: /cvsroot/wgui/wgui/includes/wg_messagebox.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** wg_messagebox.h 2 Apr 2004 17:26:14 -0000 1.3 --- wg_messagebox.h 27 Dec 2004 04:59:36 -0000 1.4 *************** *** 22,23 **** --- 22,81 ---- // + + #ifndef _WG_MESSAGEBOX_H_ + #define _WG_MESSAGEBOX_H_ + + #include "wg_frame.h" + #include "wg_label.h" + + namespace wGui + { + + //! The CMessageBox class is a simple class that brings up a modal dialog box with a message and waits for user input + + class CMessageBox : public CFrame + { + public: + //! \param WindowRect A CRect that defines the outer limits of the control + //! \param pParent A pointer to the parent view + //! \param pFontEngine A pointer to the font engine to use when drawing the control + //! If this is set to 0 it will use the default font engine specified by the CApplication (which must be set before instantiating this object) + //! \param sTitle The window title, which will appear in the title bar of the view + //! \param sMessage The message to display in the message box + //! \param iButtons A flag field to indicate which buttons to display in the message box + CMessageBox(CView* pParent, CFontEngine* pFontEngine, const std::string& sTitle, const std::string& sMessage, int iButtons); + + //! The + enum EButton { + BUTTON_INVALID = 0, + BUTTON_CANCEL = 1, + BUTTON_OK = 2, + BUTTON_NO = 4, + BUTTON_YES = 8 + }; + + //! Shows the message box as a modal dialog + //! \return The enum of the button that was clicked + // EButton DoModal(void); + + + // CMessageClient overrides + //! CScrollBars handle MOUSE_BUTTONDOWN and MOUSE_BUTTONUP messages + //! \param pMessage A pointer to the message + virtual bool HandleMessage(CMessage* pMessage); + + + protected: + CLabel* m_pMessageLabel; //!< The label that is used for the message + std::map<EButton, CButton*> m_ButtonMap; //!< A map for the buttons + int m_iButtons; //!< The ORed value of the buttons to display in the message box + EButton m_ReturnValue; + + + private: + void operator=(CMessageBox) { } //!< The assignment operator is not allowed for CWindow derived objects + }; + + } + + #endif // _WG_MESSAGEBOX_H_ Index: wg_point.h =================================================================== RCS file: /cvsroot/wgui/wgui/includes/wg_point.h,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** wg_point.h 3 Jun 2004 19:10:52 -0000 1.17 --- wg_point.h 27 Dec 2004 04:59:36 -0000 1.18 *************** *** 26,29 **** --- 26,30 ---- #define _WG_POINT_H_ + #include "std_ex.h" namespace wGui *************** *** 99,102 **** --- 100,106 ---- bool below(const CPoint& p) const { return (m_YPos > p.m_YPos); } + //! Gives a string representation of the coordinates + //! \return The coordinates in a string "<x>,<y>" i.e. "10,20" + std::string ToString(void) const { return stdex::itoa(m_XPos) + "," + stdex::itoa(m_YPos); } protected: Index: wg_rect.h =================================================================== RCS file: /cvsroot/wgui/wgui/includes/wg_rect.h,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** wg_rect.h 15 Jul 2004 18:26:14 -0000 1.32 --- wg_rect.h 27 Dec 2004 04:59:36 -0000 1.33 *************** *** 27,30 **** --- 27,31 ---- #include "wg_point.h" + #include "std_ex.h" #include "SDL.h" #include <stdlib.h> *************** *** 206,209 **** --- 207,214 ---- unsigned int HitTest(const CPoint& p) const; + //! Returns the coordinates of the rectangle as a string + //! \return A std::string with the coordinates listed as "<left>,<top>,<right>,<bottom>", i.e. "1,2,3,4" + std::string ToString(void) const + { return stdex::itoa(m_Left) + "," + stdex::itoa(m_Top) + "," + stdex::itoa(m_Right) + "," + stdex::itoa(m_Bottom); } protected: Index: wgui.h =================================================================== RCS file: /cvsroot/wgui/wgui/includes/wgui.h,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** wgui.h 26 Apr 2004 22:38:00 -0000 1.33 --- wgui.h 27 Dec 2004 04:59:36 -0000 1.34 *************** *** 64,67 **** --- 64,68 ---- #include "wg_resource_handle.h" #include "wg_resources.h" + #include "wg_messagebox.h" #endif // _WGUI_H_ |