wgui-cvs Mailing List for wGui (Page 3)
Status: Beta
Brought to you by:
greenwire
You can subscribe to this list here.
| 2004 |
Jan
|
Feb
|
Mar
|
Apr
(47) |
May
(7) |
Jun
(29) |
Jul
(41) |
Aug
(5) |
Sep
(4) |
Oct
|
Nov
(5) |
Dec
(15) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2005 |
Jan
(14) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(16) |
Oct
(1) |
Nov
|
Dec
(5) |
| 2006 |
Jan
(5) |
Feb
(10) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(2) |
Nov
|
Dec
|
|
From: Rob W. <gre...@us...> - 2005-01-05 21:09:43
|
Update of /cvsroot/wgui/wgui/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25490/src Modified Files: wg_frame.cpp wg_messagebox.cpp Log Message: Work on the message box. Index: wg_messagebox.cpp =================================================================== RCS file: /cvsroot/wgui/wgui/src/wg_messagebox.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** wg_messagebox.cpp 27 Dec 2004 22:59:35 -0000 1.5 --- wg_messagebox.cpp 5 Jan 2005 21:09:32 -0000 1.6 *************** *** 30,38 **** CMessageBox::CMessageBox(CView* pParent, CFontEngine* pFontEngine, const std::string& sTitle, const std::string& sMessage, int iButtons) : ! CFrame(CRect(0, 0, 300, 90), pParent, pFontEngine, sTitle), m_iButtons(iButtons) { m_pMessageLabel = new CLabel(CRect(10, 10, 290, 26), this, sMessage); - // m_bVisible = false; CPoint BottomRight(290, 60); if (iButtons & CMessageBox::BUTTON_CANCEL) --- 30,37 ---- CMessageBox::CMessageBox(CView* pParent, CFontEngine* pFontEngine, const std::string& sTitle, const std::string& sMessage, int iButtons) : ! CFrame(CRect(20, 20, 320, 110), pParent, pFontEngine, sTitle), m_iButtons(iButtons) { m_pMessageLabel = new CLabel(CRect(10, 10, 290, 26), this, sMessage); CPoint BottomRight(290, 60); if (iButtons & CMessageBox::BUTTON_CANCEL) *************** *** 58,67 **** } - /* - CMessageBox::EButton CMessageBox::DoModal(void) - { - SetVisible(true); - } - */ bool CMessageBox::HandleMessage(CMessage* pMessage) --- 57,60 ---- *************** *** 82,89 **** { CMessageServer::Instance().QueueMessage(new CValueMessage<CMessageBox::EButton>(CMessage::CTRL_MESSAGEBOXRETURN, m_pParentWindow, 0, iter->first)); ! SetNewParent(0); ! CMessageServer::Instance().QueueMessage(new CMessage(CMessage::APP_PAINT, 0, this)); ! delete this; bHandled = true; } } --- 75,81 ---- { CMessageServer::Instance().QueueMessage(new CValueMessage<CMessageBox::EButton>(CMessage::CTRL_MESSAGEBOXRETURN, m_pParentWindow, 0, iter->first)); ! CloseFrame(); bHandled = true; + break; } } Index: wg_frame.cpp =================================================================== RCS file: /cvsroot/wgui/wgui/src/wg_frame.cpp,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** wg_frame.cpp 27 Dec 2004 04:59:36 -0000 1.27 --- wg_frame.cpp 5 Jan 2005 21:09:32 -0000 1.28 *************** *** 70,73 **** --- 70,82 ---- + void CFrame::CloseFrame(void) + { + // suicide the frame by detaching it from it's parent, queing up an APP_PAINT message, then deleting itself + SetNewParent(0); + CMessageServer::Instance().QueueMessage(new CMessage(CMessage::APP_PAINT, 0, this)); + delete this; + } + + void CFrame::Draw(void) const // virtual { *************** *** 246,253 **** if (pMessage->Source() == m_pFrameCloseButton) { ! // suicide the frame by detaching it from it's parent, queing up an APP_PAINT message, then deleting itself ! SetNewParent(0); ! CMessageServer::Instance().QueueMessage(new CMessage(CMessage::APP_PAINT, 0, this)); ! delete this; bHandled = true; } --- 255,259 ---- if (pMessage->Source() == m_pFrameCloseButton) { ! CloseFrame(); bHandled = true; } |
|
From: Rob W. <gre...@us...> - 2005-01-05 21:09:42
|
Update of /cvsroot/wgui/wgui In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25490 Modified Files: CHANGES Log Message: Work on the message box. Index: CHANGES =================================================================== RCS file: /cvsroot/wgui/wgui/CHANGES,v retrieving revision 1.154 retrieving revision 1.155 diff -C2 -d -r1.154 -r1.155 *** CHANGES 27 Dec 2004 04:59:35 -0000 1.154 --- CHANGES 5 Jan 2005 21:09:31 -0000 1.155 *************** *** 3,6 **** --- 3,7 ---- + Added CRect: ToString() which returns the coordinates of the point in a string + Added CMessageBox class which derives from CFrame to make a simple message box + + Added CFrame::CloseFrame() which closes the frame and causes it to delete itself |
|
From: Rob W. <gre...@us...> - 2005-01-05 21:09:42
|
Update of /cvsroot/wgui/wgui/includes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25490/includes Modified Files: wg_frame.h Log Message: Work on the message box. Index: wg_frame.h =================================================================== RCS file: /cvsroot/wgui/wgui/includes/wg_frame.h,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** wg_frame.h 27 Dec 2004 04:59:36 -0000 1.18 --- wg_frame.h 5 Jan 2005 21:09:32 -0000 1.19 *************** *** 77,80 **** --- 77,83 ---- CMenu* GetMenu(void) { return m_pMenu; } + //! Closes the frame and causes it to delete itself + void CloseFrame(void); + // CWindow overrides |
|
From: Rob W. <gre...@us...> - 2004-12-27 22:59:49
|
Update of /cvsroot/wgui/wgui/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21641/src Modified Files: wg_messagebox.cpp Log Message: Work on the message box. Index: wg_messagebox.cpp =================================================================== RCS file: /cvsroot/wgui/wgui/src/wg_messagebox.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** wg_messagebox.cpp 27 Dec 2004 04:59:36 -0000 1.4 --- wg_messagebox.cpp 27 Dec 2004 22:59:35 -0000 1.5 *************** *** 29,68 **** { ! CMessageBox::CMessageBox(CView* pParent, CFontEngine* pFontEngine, const std::string& sTitle, const std::string& sMessage, int iButtons) : ! CFrame(CRect(0, 0, 300, 90), pParent, pFontEngine, sTitle), ! m_iButtons(iButtons), ! m_ReturnValue(BUTTON_INVALID) { ! m_pMessageLabel = new CLabel(CRect(10, 10, 290, 26), this, sMessage); ! // m_bVisible = false; ! CPoint BottomRight(290, 60); ! if (iButtons & CMessageBox::BUTTON_CANCEL) ! { ! m_ButtonMap.insert(std::make_pair(CMessageBox::BUTTON_CANCEL, new CButton(CRect(BottomRight - CPoint(50, 18), BottomRight), this, "Cancel"))); ! BottomRight = BottomRight - CPoint(60, 0); ! } ! if (iButtons & CMessageBox::BUTTON_OK) ! { ! m_ButtonMap.insert(std::make_pair(CMessageBox::BUTTON_OK, new CButton(CRect(BottomRight - CPoint(50, 18), BottomRight), this, "Ok"))); ! BottomRight = BottomRight - CPoint(60, 0); ! } ! if (iButtons & CMessageBox::BUTTON_NO) ! { ! m_ButtonMap.insert(std::make_pair(CMessageBox::BUTTON_NO, new CButton(CRect(BottomRight - CPoint(50, 18), BottomRight), this, "No"))); ! BottomRight = BottomRight - CPoint(60, 0); ! } ! if (iButtons & CMessageBox::BUTTON_YES) ! { ! m_ButtonMap.insert(std::make_pair(CMessageBox::BUTTON_YES, new CButton(CRect(BottomRight - CPoint(50, 18), BottomRight), this, "Yes"))); ! BottomRight = BottomRight - CPoint(60, 0); ! } } ! /* ! CMessageBox::EButton CMessageBox::DoModal(void) ! { ! SetVisible(true); ! } ! */ bool CMessageBox::HandleMessage(CMessage* pMessage) --- 29,67 ---- { ! CMessageBox::CMessageBox(CView* pParent, CFontEngine* pFontEngine, const std::string& sTitle, const std::string& sMessage, int iButtons) : ! CFrame(CRect(0, 0, 300, 90), pParent, pFontEngine, sTitle), ! m_iButtons(iButtons) { ! m_pMessageLabel = new CLabel(CRect(10, 10, 290, 26), this, sMessage); ! // m_bVisible = false; ! CPoint BottomRight(290, 60); ! if (iButtons & CMessageBox::BUTTON_CANCEL) ! { ! m_ButtonMap.insert(std::make_pair(CMessageBox::BUTTON_CANCEL, new CButton(CRect(BottomRight - CPoint(50, 18), BottomRight), this, "Cancel"))); ! BottomRight = BottomRight - CPoint(60, 0); ! } ! if (iButtons & CMessageBox::BUTTON_OK) ! { ! m_ButtonMap.insert(std::make_pair(CMessageBox::BUTTON_OK, new CButton(CRect(BottomRight - CPoint(50, 18), BottomRight), this, "Ok"))); ! BottomRight = BottomRight - CPoint(60, 0); ! } ! if (iButtons & CMessageBox::BUTTON_NO) ! { ! m_ButtonMap.insert(std::make_pair(CMessageBox::BUTTON_NO, new CButton(CRect(BottomRight - CPoint(50, 18), BottomRight), this, "No"))); ! BottomRight = BottomRight - CPoint(60, 0); ! } ! if (iButtons & CMessageBox::BUTTON_YES) ! { ! m_ButtonMap.insert(std::make_pair(CMessageBox::BUTTON_YES, new CButton(CRect(BottomRight - CPoint(50, 18), BottomRight), this, "Yes"))); ! BottomRight = BottomRight - CPoint(60, 0); ! } } ! /* ! CMessageBox::EButton CMessageBox::DoModal(void) ! { ! SetVisible(true); ! } ! */ bool CMessageBox::HandleMessage(CMessage* pMessage) *************** *** 79,96 **** { for (std::map<EButton, CButton*>::iterator iter = m_ButtonMap.begin(); iter != m_ButtonMap.end(); ++iter) ! if (pMessage->Source() == iter->second) ! { ! m_ReturnValue = iter->first; ! SetNewParent(0); ! CMessageServer::Instance().QueueMessage(new CValueMessage<CMessageBox::EButton>(CMessage::CTRL_MESSAGEBOXRETURN, m_pParentWindow, 0, iter->first)); ! CMessageServer::Instance().QueueMessage(new CMessage(CMessage::APP_PAINT, 0, this)); ! delete this; ! bHandled = true; ! } } break; } default: ! break; } if (!bHandled) --- 78,96 ---- { for (std::map<EButton, CButton*>::iterator iter = m_ButtonMap.begin(); iter != m_ButtonMap.end(); ++iter) ! { ! if (pMessage->Source() == iter->second) ! { ! CMessageServer::Instance().QueueMessage(new CValueMessage<CMessageBox::EButton>(CMessage::CTRL_MESSAGEBOXRETURN, m_pParentWindow, 0, iter->first)); ! SetNewParent(0); ! CMessageServer::Instance().QueueMessage(new CMessage(CMessage::APP_PAINT, 0, this)); ! delete this; ! bHandled = true; ! } ! } } break; } default: ! break; } if (!bHandled) |
|
From: Rob W. <gre...@us...> - 2004-12-27 22:59:48
|
Update of /cvsroot/wgui/wgui/includes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21641/includes Modified Files: wg_messagebox.h Log Message: Work on the message box. Index: wg_messagebox.h =================================================================== RCS file: /cvsroot/wgui/wgui/includes/wg_messagebox.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** wg_messagebox.h 27 Dec 2004 04:59:36 -0000 1.4 --- wg_messagebox.h 27 Dec 2004 22:59:34 -0000 1.5 *************** *** 32,56 **** { ! //! 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 }; --- 32,56 ---- { ! //! 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 }; *************** *** 68,74 **** 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; --- 68,73 ---- 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 |
|
From: Rob W. <gre...@us...> - 2004-12-27 22:59:44
|
Update of /cvsroot/wgui/wgui/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21641/tests Modified Files: TestView2.cpp Log Message: Work on the message box. Index: TestView2.cpp =================================================================== RCS file: /cvsroot/wgui/wgui/tests/TestView2.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** TestView2.cpp 27 Dec 2004 04:59:36 -0000 1.11 --- TestView2.cpp 27 Dec 2004 22:59:35 -0000 1.12 *************** *** 59,64 **** else if (pMessage->Source() == m_pShowMessageBoxButton) { ! new wGui::CMessageBox(this, 0, "Test MessageBox", "This is a message box.", wGui::CMessageBox::BUTTON_OK); ! new wGui::CMessageBox(this, 0, "Test MessageBox", "This is another message box.", wGui::CMessageBox::BUTTON_OK | wGui::CMessageBox::BUTTON_YES | wGui::CMessageBox::BUTTON_NO); wGui::CMessageServer::Instance().QueueMessage(new wGui::CMessage(wGui::CMessage::APP_PAINT, 0, this)); bHandled = true; --- 59,63 ---- else if (pMessage->Source() == m_pShowMessageBoxButton) { ! new wGui::CMessageBox(this, 0, "Test MessageBox", "This is a message box.", wGui::CMessageBox::BUTTON_OK | wGui::CMessageBox::BUTTON_CANCEL); wGui::CMessageServer::Instance().QueueMessage(new wGui::CMessage(wGui::CMessage::APP_PAINT, 0, this)); bHandled = true; |
|
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_ |
|
From: Rob W. <gre...@us...> - 2004-12-27 04:59:46
|
Update of /cvsroot/wgui/wgui/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24643/tests Modified Files: TestFrame2.cpp TestView1.cpp TestView2.cpp TestView2.h Log Message: Started work on the CMessageBox class. Index: TestView1.cpp =================================================================== RCS file: /cvsroot/wgui/wgui/tests/TestView1.cpp,v retrieving revision 1.78 retrieving revision 1.79 diff -C2 -d -r1.78 -r1.79 *** TestView1.cpp 12 Dec 2004 19:45:06 -0000 1.78 --- TestView1.cpp 27 Dec 2004 04:59:36 -0000 1.79 *************** *** 32,35 **** --- 32,37 ---- const long int EXIT_APP = 14; const long int NEXT_BUTTON_PICTURE = 15; + const long int SHOW_MESSAGE_BOX_1 = 16; + const long int SHOW_MESSAGE_BOX_2 = 17; CTestWindow::CTestWindow(const wGui::CRect& WindowRect, wGui::CWindow* pParent) : *************** *** 74,79 **** AttachMenu(new wGui::CMenu(wGui::CRect(0, 0, 80, 22), this)); wGui::CPopupMenu* pContextSubmenu = new wGui::CPopupMenu(wGui::CRect(0, 0, 140, 50), this); ! pContextSubmenu->InsertMenuItem(wGui::SMenuItem("Do Something")); ! pContextSubmenu->InsertMenuItem(wGui::SMenuItem("Do Something Else")); pContextSubmenu->InsertMenuItem(wGui::SMenuItem()); // instert a spacer pContextSubmenu->InsertMenuItem(wGui::SMenuItem("Exit", EXIT_APP)); --- 76,81 ---- AttachMenu(new wGui::CMenu(wGui::CRect(0, 0, 80, 22), this)); wGui::CPopupMenu* pContextSubmenu = new wGui::CPopupMenu(wGui::CRect(0, 0, 140, 50), this); ! pContextSubmenu->InsertMenuItem(wGui::SMenuItem("Do Something"/*, SHOW_MESSAGE_BOX_1*/)); ! pContextSubmenu->InsertMenuItem(wGui::SMenuItem("Do Something Else"/*, SHOW_MESSAGE_BOX_2*/)); pContextSubmenu->InsertMenuItem(wGui::SMenuItem()); // instert a spacer pContextSubmenu->InsertMenuItem(wGui::SMenuItem("Exit", EXIT_APP)); *************** *** 329,332 **** --- 331,346 ---- } m_pBtnPictureButton->SetPicture(wGui::CwgBitmapResourceHandle(m_eCurrentPicture)); + break; + /* + case SHOW_MESSAGE_BOX_1: + wGui::CMessageBox(this, 0, "Message Box 1", "This is a test of the message box.", wGui::CMessageBox::BUTTON_OK).DoModal(); + break; + case SHOW_MESSAGE_BOX_2: + if (wGui::CMessageBox(this, 0, "Message Box 2", "Show another message box?", wGui::CMessageBox::BUTTON_YES | wGui::CMessageBox::BUTTON_NO).DoModal() == wGui::CMessageBox::BUTTON_YES) + { + wGui::CMessageBox(this, 0, "Message Box 2", "Here's your extra message box.", wGui::CMessageBox::BUTTON_OK).DoModal(); + } + break; + */ default: break; Index: TestFrame2.cpp =================================================================== RCS file: /cvsroot/wgui/wgui/tests/TestFrame2.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** TestFrame2.cpp 12 Dec 2004 09:08:19 -0000 1.9 --- TestFrame2.cpp 27 Dec 2004 04:59:36 -0000 1.10 *************** *** 36,40 **** wGui::CFrame(wGui::CRect(0, 0, 140, 80) + Location, pParent, pFontEngine, "Simple Frame", false) { ! m_pButton = new wGui::CButton(wGui::CRect(20, 20, 150, 40), this, "Test Button"); } --- 36,40 ---- wGui::CFrame(wGui::CRect(0, 0, 140, 80) + Location, pParent, pFontEngine, "Simple Frame", false) { ! m_pButton = new wGui::CButton(wGui::CRect(20, 20, 100, 40), this, "Test Button"); } Index: TestView2.h =================================================================== RCS file: /cvsroot/wgui/wgui/tests/TestView2.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** TestView2.h 2 Apr 2004 17:26:16 -0000 1.4 --- TestView2.h 27 Dec 2004 04:59:36 -0000 1.5 *************** *** 40,43 **** --- 40,44 ---- protected: wGui::CButton* m_pCreateFrameButton; + wGui::CButton* m_pShowMessageBoxButton; wGui::CButton* m_pExitButton; }; Index: TestView2.cpp =================================================================== RCS file: /cvsroot/wgui/wgui/tests/TestView2.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** TestView2.cpp 23 Nov 2004 23:05:28 -0000 1.10 --- TestView2.cpp 27 Dec 2004 04:59:36 -0000 1.11 *************** *** 31,36 **** SetWindowText(std::string("Test App 2 - wGui version ") + wGui::CwgStringResourceHandle(wGui::WGRES_VERSION_STRING).String()); ! m_pCreateFrameButton = new wGui::CButton(ClientToView(wGui::CRect(20, 20, 140, 40)), this, "Create Frame"); ! m_pExitButton = new wGui::CButton(ClientToView(wGui::CRect(20, 50, 140, 70)), this, "Exit"); wGui::CMessageServer::Instance().RegisterMessageClient(this, wGui::CMessage::CTRL_LCLICK); --- 31,37 ---- SetWindowText(std::string("Test App 2 - wGui version ") + wGui::CwgStringResourceHandle(wGui::WGRES_VERSION_STRING).String()); ! m_pCreateFrameButton = new wGui::CButton(ClientToView(wGui::CRect(20, 20, 160, 40)), this, "Create Frame"); ! m_pShowMessageBoxButton = new wGui::CButton(ClientToView(wGui::CRect(20, 50, 160, 70)), this, "Show Message Box"); ! m_pExitButton = new wGui::CButton(ClientToView(wGui::CRect(20, 80, 160, 100)), this, "Exit"); wGui::CMessageServer::Instance().RegisterMessageClient(this, wGui::CMessage::CTRL_LCLICK); *************** *** 56,59 **** --- 57,67 ---- bHandled = true; } + else if (pMessage->Source() == m_pShowMessageBoxButton) + { + new wGui::CMessageBox(this, 0, "Test MessageBox", "This is a message box.", wGui::CMessageBox::BUTTON_OK); + new wGui::CMessageBox(this, 0, "Test MessageBox", "This is another message box.", wGui::CMessageBox::BUTTON_OK | wGui::CMessageBox::BUTTON_YES | wGui::CMessageBox::BUTTON_NO); + wGui::CMessageServer::Instance().QueueMessage(new wGui::CMessage(wGui::CMessage::APP_PAINT, 0, this)); + bHandled = true; + } else if (pMessage->Source() == m_pExitButton) { |
|
From: Rob W. <gre...@us...> - 2004-12-27 04:59:45
|
Update of /cvsroot/wgui/wgui/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24643/src Modified Files: wg_frame.cpp wg_messagebox.cpp Log Message: Started work on the CMessageBox class. Index: wg_messagebox.cpp =================================================================== RCS file: /cvsroot/wgui/wgui/src/wg_messagebox.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** wg_messagebox.cpp 2 Apr 2004 17:26:16 -0000 1.3 --- wg_messagebox.cpp 27 Dec 2004 04:59:36 -0000 1.4 *************** *** 22,23 **** --- 22,105 ---- // + + #include "wgui_include_config.h" + #include "wg_messagebox.h" + + namespace wGui + { + + CMessageBox::CMessageBox(CView* pParent, CFontEngine* pFontEngine, const std::string& sTitle, const std::string& sMessage, int iButtons) : + CFrame(CRect(0, 0, 300, 90), pParent, pFontEngine, sTitle), + m_iButtons(iButtons), + m_ReturnValue(BUTTON_INVALID) + { + m_pMessageLabel = new CLabel(CRect(10, 10, 290, 26), this, sMessage); + // m_bVisible = false; + CPoint BottomRight(290, 60); + if (iButtons & CMessageBox::BUTTON_CANCEL) + { + m_ButtonMap.insert(std::make_pair(CMessageBox::BUTTON_CANCEL, new CButton(CRect(BottomRight - CPoint(50, 18), BottomRight), this, "Cancel"))); + BottomRight = BottomRight - CPoint(60, 0); + } + if (iButtons & CMessageBox::BUTTON_OK) + { + m_ButtonMap.insert(std::make_pair(CMessageBox::BUTTON_OK, new CButton(CRect(BottomRight - CPoint(50, 18), BottomRight), this, "Ok"))); + BottomRight = BottomRight - CPoint(60, 0); + } + if (iButtons & CMessageBox::BUTTON_NO) + { + m_ButtonMap.insert(std::make_pair(CMessageBox::BUTTON_NO, new CButton(CRect(BottomRight - CPoint(50, 18), BottomRight), this, "No"))); + BottomRight = BottomRight - CPoint(60, 0); + } + if (iButtons & CMessageBox::BUTTON_YES) + { + m_ButtonMap.insert(std::make_pair(CMessageBox::BUTTON_YES, new CButton(CRect(BottomRight - CPoint(50, 18), BottomRight), this, "Yes"))); + BottomRight = BottomRight - CPoint(60, 0); + } + } + + /* + CMessageBox::EButton CMessageBox::DoModal(void) + { + SetVisible(true); + } + */ + + bool CMessageBox::HandleMessage(CMessage* pMessage) + { + bool bHandled = false; + + if (pMessage) + { + switch(pMessage->MessageType()) + { + case CMessage::CTRL_LCLICK: + { + if (pMessage->Destination() == this) + { + for (std::map<EButton, CButton*>::iterator iter = m_ButtonMap.begin(); iter != m_ButtonMap.end(); ++iter) + if (pMessage->Source() == iter->second) + { + m_ReturnValue = iter->first; + SetNewParent(0); + CMessageServer::Instance().QueueMessage(new CValueMessage<CMessageBox::EButton>(CMessage::CTRL_MESSAGEBOXRETURN, m_pParentWindow, 0, iter->first)); + CMessageServer::Instance().QueueMessage(new CMessage(CMessage::APP_PAINT, 0, this)); + delete this; + bHandled = true; + } + } + break; + } + default: + break; + } + if (!bHandled) + { + bHandled = CFrame::HandleMessage(pMessage); + } + } + + return bHandled; + } + + } Index: wg_frame.cpp =================================================================== RCS file: /cvsroot/wgui/wgui/src/wg_frame.cpp,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** wg_frame.cpp 12 Dec 2004 09:08:19 -0000 1.26 --- wg_frame.cpp 27 Dec 2004 04:59:36 -0000 1.27 *************** *** 30,34 **** { ! CFrame::CFrame(const CRect& WindowRect, CView* pParent, CFontEngine* pFontEngine, std::string sTitle, bool bResizable) : CWindow(WindowRect, pParent), m_TitleBarColor(COLOR_BLUE), --- 30,34 ---- { ! CFrame::CFrame(const CRect& WindowRect, CView* pParent, CFontEngine* pFontEngine, const std::string& sTitle, bool bResizable) : CWindow(WindowRect, pParent), m_TitleBarColor(COLOR_BLUE), *************** *** 64,68 **** ! CFrame::~CFrame(void) { SDL_FreeSurface(m_pSavedSurface); --- 64,68 ---- ! CFrame::~CFrame(void) // virtual { SDL_FreeSurface(m_pSavedSurface); *************** *** 70,74 **** ! void CFrame::Draw(void) const { CWindow::Draw(); --- 70,74 ---- ! void CFrame::Draw(void) const // virtual { CWindow::Draw(); *************** *** 122,135 **** ! void CFrame::SetWindowRect(const CRect& WindowRect) { ! CWindow::SetWindowRect(WindowRect); ! m_TitleBarRect = CRect(2, 0, WindowRect.Width() - 3, m_iTitleBarHeight); ! m_pFrameCloseButton->SetWindowRect(CRect(WindowRect.Width() - 20, (-m_iTitleBarHeight / 2) - 5, WindowRect.Width() - 8, (-m_iTitleBarHeight / 2) + 7)); m_ClientRect = CRect(2, m_iTitleBarHeight + 2, WindowRect.Width() - 1, WindowRect.Height() - 1); } ! void CFrame::SetWindowText(const std::string& sWindowText) { std::auto_ptr<CRenderedString> pRenderedString(new CRenderedString(m_pFontEngine, sWindowText, CRenderedString::VALIGN_CENTER)); --- 122,136 ---- ! void CFrame::SetWindowRect(const CRect& WindowRect) // virtual { ! m_TitleBarRect = CRect(2, 2, WindowRect.Width() - 5, m_iTitleBarHeight); ! m_pFrameCloseButton->SetWindowRect(CRect(WindowRect.Width() - 20, (-m_iTitleBarHeight / 2) - 7, WindowRect.Width() - 8, (-m_iTitleBarHeight / 2) + 5)); m_ClientRect = CRect(2, m_iTitleBarHeight + 2, WindowRect.Width() - 1, WindowRect.Height() - 1); + // SetWindowRect() must be called last since it calls Draw(), and needs the titlebar rect and such to be set first + CWindow::SetWindowRect(WindowRect); } ! void CFrame::SetWindowText(const std::string& sWindowText) // virtual { std::auto_ptr<CRenderedString> pRenderedString(new CRenderedString(m_pFontEngine, sWindowText, CRenderedString::VALIGN_CENTER)); *************** *** 139,143 **** ! bool CFrame::OnMouseButtonDown(CPoint Point, unsigned int Button) { bool bResult = false; --- 140,144 ---- ! bool CFrame::OnMouseButtonDown(CPoint Point, unsigned int Button) // virtual { bool bResult = false; *************** *** 159,163 **** ! bool CFrame::HandleMessage(CMessage* pMessage) { bool bHandled = false; --- 160,164 ---- ! bool CFrame::HandleMessage(CMessage* pMessage) // virtual { bool bHandled = false; |
|
From: Rob W. <gre...@us...> - 2004-12-27 04:59:45
|
Update of /cvsroot/wgui/wgui In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24643 Modified Files: CHANGES configure Log Message: Started work on the CMessageBox class. Index: CHANGES =================================================================== RCS file: /cvsroot/wgui/wgui/CHANGES,v retrieving revision 1.153 retrieving revision 1.154 diff -C2 -d -r1.153 -r1.154 *** CHANGES 7 Dec 2004 21:17:56 -0000 1.153 --- CHANGES 27 Dec 2004 04:59:35 -0000 1.154 *************** *** 1,2 **** --- 1,8 ---- + 0.4.0 -> 0.4.1 + + Added CPoint: ToString() which returns the coordinates of the rectangle in a string + + Added CRect: ToString() which returns the coordinates of the point in a string + + Added CMessageBox class which derives from CFrame to make a simple message box + + 0.3.3 -> 0.4.0 + Added CDropDown: SetListboxHeight() which allows the height of the drop list to be changed Index: configure =================================================================== RCS file: /cvsroot/wgui/wgui/configure,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** configure 12 Dec 2004 19:45:05 -0000 1.20 --- configure 27 Dec 2004 04:59:35 -0000 1.21 *************** *** 1330,1334 **** WGUI_VERSION_MAJOR=0 WGUI_VERSION_MINOR=4 ! WGUI_VERSION_REVISION=0 WGUI_VERSION=$WGUI_VERSION_MAJOR.$WGUI_VERSION_MINOR.$WGUI_VERSION_REVISION VERSION=$WGUI_VERSION --- 1330,1334 ---- WGUI_VERSION_MAJOR=0 WGUI_VERSION_MINOR=4 ! WGUI_VERSION_REVISION=1 WGUI_VERSION=$WGUI_VERSION_MAJOR.$WGUI_VERSION_MINOR.$WGUI_VERSION_REVISION VERSION=$WGUI_VERSION |
|
From: Rob W. <gre...@us...> - 2004-12-12 23:07:13
|
Update of /cvsroot/wgui/wgui In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7452 Modified Files: Doxyfile NEWS configure.in Log Message: Version bump to 0.4.1 Index: Doxyfile =================================================================== RCS file: /cvsroot/wgui/wgui/Doxyfile,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** Doxyfile 17 Jun 2004 15:31:03 -0000 1.16 --- Doxyfile 12 Dec 2004 23:06:52 -0000 1.17 *************** *** 24,28 **** # if some version control system is used. ! PROJECT_NUMBER = 0.4.0 # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) --- 24,28 ---- # if some version control system is used. ! PROJECT_NUMBER = 0.4.1 # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) Index: NEWS =================================================================== RCS file: /cvsroot/wgui/wgui/NEWS,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** NEWS 8 Jun 2004 15:18:27 -0000 1.9 --- NEWS 12 Dec 2004 23:07:01 -0000 1.10 *************** *** 1,4 **** --- 1,6 ---- For more current news, see Sourceforge at http://sourceforge.net/projects/wgui/ + 12/12/04 - Version 0.4.0 is released. + 06/08/04 - Version 0.3.3 is released. Index: configure.in =================================================================== RCS file: /cvsroot/wgui/wgui/configure.in,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** configure.in 12 Dec 2004 19:45:05 -0000 1.16 --- configure.in 12 Dec 2004 23:07:01 -0000 1.17 *************** *** 5,9 **** WGUI_VERSION_MAJOR=0 WGUI_VERSION_MINOR=4 ! WGUI_VERSION_REVISION=0 WGUI_VERSION=$WGUI_VERSION_MAJOR.$WGUI_VERSION_MINOR.$WGUI_VERSION_REVISION VERSION=$WGUI_VERSION --- 5,9 ---- WGUI_VERSION_MAJOR=0 WGUI_VERSION_MINOR=4 ! WGUI_VERSION_REVISION=1 WGUI_VERSION=$WGUI_VERSION_MAJOR.$WGUI_VERSION_MINOR.$WGUI_VERSION_REVISION VERSION=$WGUI_VERSION |
|
From: Rob W. <gre...@us...> - 2004-12-12 23:07:13
|
Update of /cvsroot/wgui/wgui/includes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7452/includes Modified Files: wgui_win32_config.h Log Message: Version bump to 0.4.1 Index: wgui_win32_config.h =================================================================== RCS file: /cvsroot/wgui/wgui/includes/wgui_win32_config.h,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** wgui_win32_config.h 17 Jun 2004 15:31:03 -0000 1.10 --- wgui_win32_config.h 12 Dec 2004 23:07:01 -0000 1.11 *************** *** 3,6 **** /* Version number of package */ ! #define VERSION "0.4.0" --- 3,6 ---- /* Version number of package */ ! #define VERSION "0.4.1" |
|
From: Rob W. <gre...@us...> - 2004-12-12 19:45:18
|
Update of /cvsroot/wgui/wgui/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27283/src Modified Files: wg_message_server.cpp wg_window.cpp Log Message: Commented out some code in TestView1.cpp so that it wouldn't segfault. This is a temporary measure that needs to be fixed properly. Index: wg_message_server.cpp =================================================================== RCS file: /cvsroot/wgui/wgui/src/wg_message_server.cpp,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** wg_message_server.cpp 3 Jun 2004 18:40:52 -0000 1.28 --- wg_message_server.cpp 12 Dec 2004 19:45:06 -0000 1.29 *************** *** 25,28 **** --- 25,29 ---- #include "wgui_include_config.h" #include "wg_message_server.h" + #include "wg_application.h" #include "std_ex.h" #include "wg_message_client.h" *************** *** 69,73 **** void CMessageServer::RegisterMessageClient(CMessageClient* pClient, CMessage::EMessageType eMessageType, unsigned char Priority) { ! m_MessageClients[eMessageType].insert(std::make_pair(Priority, std::make_pair(pClient, false))); } --- 70,82 ---- void CMessageServer::RegisterMessageClient(CMessageClient* pClient, CMessage::EMessageType eMessageType, unsigned char Priority) { ! if (!pClient) ! { ! CApplication::Instance()->GetApplicationLog().AddLogEntry( ! "CMessageServer::RegisterMessageClient : Attempting to register a non-existent message client.", APP_LOG_ERROR); ! } ! else ! { ! m_MessageClients[eMessageType].insert(std::make_pair(Priority, std::make_pair(pClient, false))); ! } } Index: wg_window.cpp =================================================================== RCS file: /cvsroot/wgui/wgui/src/wg_window.cpp,v retrieving revision 1.54 retrieving revision 1.55 diff -C2 -d -r1.54 -r1.55 *** wg_window.cpp 12 Dec 2004 09:08:19 -0000 1.54 --- wg_window.cpp 12 Dec 2004 19:45:06 -0000 1.55 *************** *** 276,280 **** for (std::list<CWindow*>::const_iterator iter = m_ChildWindows.begin(); iter != m_ChildWindows.end(); ++iter) { ! (*iter)->PaintToSurface(ScreenSurface, FloatingSurface, NewOffset); } } --- 276,283 ---- for (std::list<CWindow*>::const_iterator iter = m_ChildWindows.begin(); iter != m_ChildWindows.end(); ++iter) { ! if (*iter) ! { ! (*iter)->PaintToSurface(ScreenSurface, FloatingSurface, NewOffset); ! } } } |
|
From: Rob W. <gre...@us...> - 2004-12-12 19:45:17
|
Update of /cvsroot/wgui/wgui In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27283 Modified Files: BUGS configure configure.in Log Message: Commented out some code in TestView1.cpp so that it wouldn't segfault. This is a temporary measure that needs to be fixed properly. Index: BUGS =================================================================== RCS file: /cvsroot/wgui/wgui/BUGS,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** BUGS 7 Dec 2004 21:17:55 -0000 1.15 --- BUGS 12 Dec 2004 19:45:05 -0000 1.16 *************** *** 1,4 **** --- 1,6 ---- Known bugs for 0.4.0 + - There appears to be some problem with the CMenu class. TestApp1 segfaults on Fedora Linux, but commenting out the code that creates the + submenus for the popup menu seems to fix it. So this code has been commented out for the 0.4.0 release. - The CFrame class is far from complete. Currently the title bar does not draw correctly, and the frame doesn't clip it's child controls. - The wGui library is currently built to the src directory instead of the lib directory when using GNU Make Index: configure =================================================================== RCS file: /cvsroot/wgui/wgui/configure,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** configure 8 Jun 2004 15:18:27 -0000 1.19 --- configure 12 Dec 2004 19:45:05 -0000 1.20 *************** *** 1329,1334 **** WGUI_VERSION_MAJOR=0 ! WGUI_VERSION_MINOR=3 ! WGUI_VERSION_REVISION=3 WGUI_VERSION=$WGUI_VERSION_MAJOR.$WGUI_VERSION_MINOR.$WGUI_VERSION_REVISION VERSION=$WGUI_VERSION --- 1329,1334 ---- WGUI_VERSION_MAJOR=0 ! WGUI_VERSION_MINOR=4 ! WGUI_VERSION_REVISION=0 WGUI_VERSION=$WGUI_VERSION_MAJOR.$WGUI_VERSION_MINOR.$WGUI_VERSION_REVISION VERSION=$WGUI_VERSION Index: configure.in =================================================================== RCS file: /cvsroot/wgui/wgui/configure.in,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** configure.in 23 Apr 2004 03:45:43 -0000 1.15 --- configure.in 12 Dec 2004 19:45:05 -0000 1.16 *************** *** 4,9 **** WGUI_VERSION_MAJOR=0 ! WGUI_VERSION_MINOR=3 ! WGUI_VERSION_REVISION=3 WGUI_VERSION=$WGUI_VERSION_MAJOR.$WGUI_VERSION_MINOR.$WGUI_VERSION_REVISION VERSION=$WGUI_VERSION --- 4,9 ---- WGUI_VERSION_MAJOR=0 ! WGUI_VERSION_MINOR=4 ! WGUI_VERSION_REVISION=0 WGUI_VERSION=$WGUI_VERSION_MAJOR.$WGUI_VERSION_MINOR.$WGUI_VERSION_REVISION VERSION=$WGUI_VERSION |
|
From: Rob W. <gre...@us...> - 2004-12-12 19:45:17
|
Update of /cvsroot/wgui/wgui/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27283/tests Modified Files: TestView1.cpp Log Message: Commented out some code in TestView1.cpp so that it wouldn't segfault. This is a temporary measure that needs to be fixed properly. Index: TestView1.cpp =================================================================== RCS file: /cvsroot/wgui/wgui/tests/TestView1.cpp,v retrieving revision 1.77 retrieving revision 1.78 diff -C2 -d -r1.77 -r1.78 *** TestView1.cpp 12 Dec 2004 09:08:19 -0000 1.77 --- TestView1.cpp 12 Dec 2004 19:45:06 -0000 1.78 *************** *** 160,163 **** --- 160,168 ---- m_pContextMenu->InsertMenuItem(wGui::SMenuItem("Menu Item 1")); m_pContextMenu->InsertMenuItem(wGui::SMenuItem("Menu Item 2")); + + // For some reason including this block of code causes it to Segfault on Fedora Linux + // So it's being commented out for the purposes of getting 0.4.0 released + // There's probably something wrong with the CMenu class, but I haven't figured it out yet + /* pContextSubmenu = new wGui::CPopupMenu(wGui::CRect(0, 0, 80, 50), m_pContextMenu); pContextSubmenu->InsertMenuItem(wGui::SMenuItem("Clear", CLEAR_EDIT_BOX_1)); *************** *** 176,179 **** --- 181,185 ---- wGui::CPopupMenu* pContextSubmenu4 = new wGui::CPopupMenu(wGui::CRect(0, 0, 140, 50), pContextSubmenu3); pContextSubmenu3->InsertMenuItem(wGui::SMenuItem("Empty submenu 3", 0, pContextSubmenu4)); + */ m_pDropDown = new wGui::CDropDown(wGui::CRect(10, 55, 205, 73), m_pGroupBox); |
|
From: Rob W. <gre...@us...> - 2004-12-12 09:08:31
|
Update of /cvsroot/wgui/wgui/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18285/src Modified Files: wg_button.cpp wg_checkbox.cpp wg_editbox.cpp wg_frame.cpp wg_groupbox.cpp wg_label.cpp wg_listbox.cpp wg_menu.cpp wg_picture.cpp wg_progress.cpp wg_scrollbar.cpp wg_textbox.cpp wg_tooltip.cpp wg_window.cpp Log Message: Added some safety checks. Index: wg_editbox.cpp =================================================================== RCS file: /cvsroot/wgui/wgui/src/wg_editbox.cpp,v retrieving revision 1.95 retrieving revision 1.96 diff -C2 -d -r1.95 -r1.96 *** wg_editbox.cpp 23 Nov 2004 23:05:11 -0000 1.95 --- wg_editbox.cpp 12 Dec 2004 09:08:18 -0000 1.96 *************** *** 173,283 **** CWindow::Draw(); ! CPainter Painter(m_pSDLSurface); ! CRect SubRect(m_WindowRect.SizeRect()); ! SubRect.Grow(-3); ! Painter.DrawRect(m_WindowRect.SizeRect(), false, COLOR_BLACK); ! CPoint FontCenterPoint = m_WindowRect.SizeRect().Center(); ! ! if (m_bUseMask) ! { ! m_pRenderedString->SetMaskChar('*'); ! } ! else ! { ! m_pRenderedString->SetMaskChar(' '); ! } ! ! CRGBColor FontColor = m_bReadOnly ? DEFAULT_DISABLED_LINE_COLOR : DEFAULT_LINE_COLOR; ! if (CApplication::Instance()->GetKeyFocus() == dynamic_cast<const CWindow*>(this) && !m_bReadOnly) { ! CPoint BoundedDims; ! CPoint Offset; ! std::vector<CRect> CharRects; ! m_pRenderedString->GetMetrics(&BoundedDims, &Offset, &CharRects); ! std::string::size_type SelStartNorm = 0; ! std::string::size_type SelLenNorm = abs(m_SelLength); ! if (m_SelLength < 0) { ! SelStartNorm = m_SelStart + m_SelLength; } else { ! SelStartNorm = m_SelStart; } ! // Handle scrolling ! // Patch for "Scrolling while selecting to left in editbox" by Oldrich Dlouhy ! if (! m_bMouseDown) { ! if (CharRects.empty() || BoundedDims.XPos() < SubRect.Width()) { ! m_ScrollOffset = 0; } else { ! int iCursorPos = 0; ! if (m_SelStart + m_SelLength >= CharRects.size()) { ! iCursorPos = CharRects.back().Right() + Offset.XPos() + SubRect.Left() + m_ScrollOffset; } else { ! iCursorPos = CharRects.at(m_SelStart + m_SelLength).Left() + Offset.XPos() + SubRect.Left() + m_ScrollOffset; ! } ! if (iCursorPos < SubRect.Left()) ! { ! m_ScrollOffset = -(iCursorPos - m_ScrollOffset - SubRect.Left() - Offset.XPos()); ! } ! else if (iCursorPos > SubRect.Right()) ! { ! m_ScrollOffset = -(iCursorPos - m_ScrollOffset - SubRect.Left() - Offset.XPos() - SubRect.Width() + 1); ! } ! if (m_ScrollOffset < 0 && (CharRects.back().Right() + Offset.XPos() + SubRect.Left() + m_ScrollOffset < SubRect.Right())) ! { ! m_ScrollOffset = SubRect.Right() - CharRects.back().Right() - 1; ! if (m_ScrollOffset > 0) { ! m_ScrollOffset = 0; } } } - } ! // Selection ! if (m_SelLength != 0) ! { ! CRect SelRect; ! SelRect.SetBottom(SubRect.Bottom()); ! SelRect.SetTop(SubRect.Top()); ! SelRect.SetLeft(CharRects.at(SelStartNorm).Left() + Offset.XPos() + SubRect.Left() + m_ScrollOffset); ! SelRect.SetRight(CharRects.at(SelLenNorm + SelStartNorm - 1).Right() + Offset.XPos() + SubRect.Left() + m_ScrollOffset); ! SelRect.ClipTo(SubRect); ! Painter.DrawRect(SelRect, true, CApplication::Instance()->GetDefaultSelectionColor(), CApplication::Instance()->GetDefaultSelectionColor()); ! } ! else if (m_bDrawCursor) ! { ! //RenderStringWithCursor ! int CursorPos = Offset.XPos() + SubRect.Left() + m_ScrollOffset; ! if (m_SelStart + m_SelLength >= CharRects.size() && !CharRects.empty()) ! { ! CursorPos += CharRects.back().Right(); ! } ! else if (m_SelStart + m_SelLength >= 0 && m_SelStart + m_SelLength < CharRects.size()) { ! CursorPos += CharRects.at(m_SelStart + m_SelLength).Left(); } ! if (CursorPos >= SubRect.Left() && CursorPos <= SubRect.Right()) { ! Painter.DrawVLine(SubRect.Top(), SubRect.Bottom(), CursorPos, COLOR_BLACK); } } - } ! if (m_pRenderedString.get()) ! { ! m_pRenderedString->Draw(m_pSDLSurface, SubRect, ! CPoint(SubRect.Left() + m_ScrollOffset, SubRect.Bottom() - m_pRenderedString->GetMaxFontHeight() / 4), FontColor); } } --- 173,286 ---- CWindow::Draw(); ! if (m_pSDLSurface) { ! CPainter Painter(m_pSDLSurface); ! CRect SubRect(m_WindowRect.SizeRect()); ! SubRect.Grow(-3); ! Painter.DrawRect(m_WindowRect.SizeRect(), false, COLOR_BLACK); ! CPoint FontCenterPoint = m_WindowRect.SizeRect().Center(); ! if (m_bUseMask) { ! m_pRenderedString->SetMaskChar('*'); } else { ! m_pRenderedString->SetMaskChar(' '); } ! CRGBColor FontColor = m_bReadOnly ? DEFAULT_DISABLED_LINE_COLOR : DEFAULT_LINE_COLOR; ! if (CApplication::Instance()->GetKeyFocus() == dynamic_cast<const CWindow*>(this) && !m_bReadOnly) { ! CPoint BoundedDims; ! CPoint Offset; ! std::vector<CRect> CharRects; ! m_pRenderedString->GetMetrics(&BoundedDims, &Offset, &CharRects); ! ! std::string::size_type SelStartNorm = 0; ! std::string::size_type SelLenNorm = abs(m_SelLength); ! if (m_SelLength < 0) { ! SelStartNorm = m_SelStart + m_SelLength; } else { ! SelStartNorm = m_SelStart; ! } ! ! // Handle scrolling ! // Patch for "Scrolling while selecting to left in editbox" by Oldrich Dlouhy ! if (! m_bMouseDown) ! { ! if (CharRects.empty() || BoundedDims.XPos() < SubRect.Width()) { ! m_ScrollOffset = 0; } else { ! int iCursorPos = 0; ! if (m_SelStart + m_SelLength >= CharRects.size()) ! { ! iCursorPos = CharRects.back().Right() + Offset.XPos() + SubRect.Left() + m_ScrollOffset; ! } ! else ! { ! iCursorPos = CharRects.at(m_SelStart + m_SelLength).Left() + Offset.XPos() + SubRect.Left() + m_ScrollOffset; ! } ! if (iCursorPos < SubRect.Left()) ! { ! m_ScrollOffset = -(iCursorPos - m_ScrollOffset - SubRect.Left() - Offset.XPos()); ! } ! else if (iCursorPos > SubRect.Right()) ! { ! m_ScrollOffset = -(iCursorPos - m_ScrollOffset - SubRect.Left() - Offset.XPos() - SubRect.Width() + 1); ! } ! if (m_ScrollOffset < 0 && (CharRects.back().Right() + Offset.XPos() + SubRect.Left() + m_ScrollOffset < SubRect.Right())) { ! m_ScrollOffset = SubRect.Right() - CharRects.back().Right() - 1; ! if (m_ScrollOffset > 0) ! { ! m_ScrollOffset = 0; ! } } } } ! // Selection ! if (m_SelLength != 0) { ! CRect SelRect; ! SelRect.SetBottom(SubRect.Bottom()); ! SelRect.SetTop(SubRect.Top()); ! SelRect.SetLeft(CharRects.at(SelStartNorm).Left() + Offset.XPos() + SubRect.Left() + m_ScrollOffset); ! SelRect.SetRight(CharRects.at(SelLenNorm + SelStartNorm - 1).Right() + Offset.XPos() + SubRect.Left() + m_ScrollOffset); ! SelRect.ClipTo(SubRect); ! Painter.DrawRect(SelRect, true, CApplication::Instance()->GetDefaultSelectionColor(), CApplication::Instance()->GetDefaultSelectionColor()); } ! else if (m_bDrawCursor) { ! //RenderStringWithCursor ! int CursorPos = Offset.XPos() + SubRect.Left() + m_ScrollOffset; ! if (m_SelStart + m_SelLength >= CharRects.size() && !CharRects.empty()) ! { ! CursorPos += CharRects.back().Right(); ! } ! else if (m_SelStart + m_SelLength >= 0 && m_SelStart + m_SelLength < CharRects.size()) ! { ! CursorPos += CharRects.at(m_SelStart + m_SelLength).Left(); ! } ! if (CursorPos >= SubRect.Left() && CursorPos <= SubRect.Right()) ! { ! Painter.DrawVLine(SubRect.Top(), SubRect.Bottom(), CursorPos, COLOR_BLACK); ! } } } ! if (m_pRenderedString.get()) ! { ! m_pRenderedString->Draw(m_pSDLSurface, SubRect, ! CPoint(SubRect.Left() + m_ScrollOffset, SubRect.Bottom() - m_pRenderedString->GetMaxFontHeight() / 4), FontColor); ! } } } Index: wg_checkbox.cpp =================================================================== RCS file: /cvsroot/wgui/wgui/src/wg_checkbox.cpp,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** wg_checkbox.cpp 16 Jul 2004 16:41:36 -0000 1.23 --- wg_checkbox.cpp 12 Dec 2004 09:08:18 -0000 1.24 *************** *** 63,80 **** CWindow::Draw(); ! CRect SubRect(m_WindowRect.SizeRect()); ! SubRect.Grow(-1); ! CPainter Painter(m_pSDLSurface); ! Painter.DrawRect(m_WindowRect.SizeRect(), false, COLOR_BLACK); ! if (m_eCheckBoxState != DISABLED) { ! Painter.DrawRect(SubRect, false, COLOR_LIGHTGRAY); ! Painter.DrawHLine(SubRect.Left(), SubRect.Right(), SubRect.Top(), COLOR_DARKGRAY); ! Painter.DrawVLine(SubRect.Top(), SubRect.Bottom(), SubRect.Left(), COLOR_DARKGRAY); ! SubRect.Grow(-2); ! if (m_eCheckBoxState == CHECKED) { ! Painter.DrawLine(SubRect.TopLeft(), SubRect.BottomRight(), DEFAULT_LINE_COLOR); ! Painter.DrawLine(SubRect.BottomLeft(), SubRect.TopRight(), DEFAULT_LINE_COLOR); } } --- 63,83 ---- CWindow::Draw(); ! if (m_pSDLSurface) { ! CRect SubRect(m_WindowRect.SizeRect()); ! SubRect.Grow(-1); ! CPainter Painter(m_pSDLSurface); ! Painter.DrawRect(m_WindowRect.SizeRect(), false, COLOR_BLACK); ! if (m_eCheckBoxState != DISABLED) { ! Painter.DrawRect(SubRect, false, COLOR_LIGHTGRAY); ! Painter.DrawHLine(SubRect.Left(), SubRect.Right(), SubRect.Top(), COLOR_DARKGRAY); ! Painter.DrawVLine(SubRect.Top(), SubRect.Bottom(), SubRect.Left(), COLOR_DARKGRAY); ! SubRect.Grow(-2); ! if (m_eCheckBoxState == CHECKED) ! { ! Painter.DrawLine(SubRect.TopLeft(), SubRect.BottomRight(), DEFAULT_LINE_COLOR); ! Painter.DrawLine(SubRect.BottomLeft(), SubRect.TopRight(), DEFAULT_LINE_COLOR); ! } } } Index: wg_tooltip.cpp =================================================================== RCS file: /cvsroot/wgui/wgui/src/wg_tooltip.cpp,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** wg_tooltip.cpp 23 Nov 2004 23:05:17 -0000 1.27 --- wg_tooltip.cpp 12 Dec 2004 09:08:19 -0000 1.28 *************** *** 84,94 **** CWindow::Draw(); ! CPainter Painter(m_pSDLSurface); ! Painter.DrawRect(m_WindowRect.SizeRect(), false); ! CRect SubRect(m_WindowRect.SizeRect()); ! SubRect.Grow(-2); ! if (m_pRenderedString.get()) { ! m_pRenderedString->Draw(m_pSDLSurface, SubRect, SubRect.TopLeft(), m_FontColor); } } --- 84,97 ---- CWindow::Draw(); ! if (m_pSDLSurface) { ! CPainter Painter(m_pSDLSurface); ! Painter.DrawRect(m_WindowRect.SizeRect(), false); ! CRect SubRect(m_WindowRect.SizeRect()); ! SubRect.Grow(-2); ! if (m_pRenderedString.get()) ! { ! m_pRenderedString->Draw(m_pSDLSurface, SubRect, SubRect.TopLeft(), m_FontColor); ! } } } Index: wg_progress.cpp =================================================================== RCS file: /cvsroot/wgui/wgui/src/wg_progress.cpp,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** wg_progress.cpp 16 Jul 2004 16:41:36 -0000 1.16 --- wg_progress.cpp 12 Dec 2004 09:08:19 -0000 1.17 *************** *** 50,69 **** CWindow::Draw(); ! CRect SubRect(m_WindowRect.SizeRect()); ! SubRect.Grow(-1); ! CPainter Painter(m_pSDLSurface); ! Painter.DrawRect(m_WindowRect.SizeRect(), false, COLOR_BLACK); ! Painter.DrawRect(SubRect, false, COLOR_LIGHTGRAY); ! Painter.DrawHLine(SubRect.Left(), SubRect.Right(), SubRect.Top(), COLOR_DARKGRAY); ! Painter.DrawVLine(SubRect.Top(), SubRect.Bottom(), SubRect.Left(), COLOR_DARKGRAY); ! SubRect.Grow(-2); ! if (m_Value > m_MinLimit) { ! if (m_Value < m_MaxLimit) { ! SubRect.SetRight(stdex::safe_static_cast<int>(SubRect.Left() + ! SubRect.Width() * (stdex::safe_static_cast<double>(m_Value - m_MinLimit) / (m_MaxLimit - m_MinLimit)))); } - Painter.DrawRect(SubRect, true, m_BarColor, m_BarColor); } } --- 50,72 ---- CWindow::Draw(); ! if (m_pSDLSurface) { ! CRect SubRect(m_WindowRect.SizeRect()); ! SubRect.Grow(-1); ! CPainter Painter(m_pSDLSurface); ! Painter.DrawRect(m_WindowRect.SizeRect(), false, COLOR_BLACK); ! Painter.DrawRect(SubRect, false, COLOR_LIGHTGRAY); ! Painter.DrawHLine(SubRect.Left(), SubRect.Right(), SubRect.Top(), COLOR_DARKGRAY); ! Painter.DrawVLine(SubRect.Top(), SubRect.Bottom(), SubRect.Left(), COLOR_DARKGRAY); ! SubRect.Grow(-2); ! if (m_Value > m_MinLimit) { ! if (m_Value < m_MaxLimit) ! { ! SubRect.SetRight(stdex::safe_static_cast<int>(SubRect.Left() + ! SubRect.Width() * (stdex::safe_static_cast<double>(m_Value - m_MinLimit) / (m_MaxLimit - m_MinLimit)))); ! } ! Painter.DrawRect(SubRect, true, m_BarColor, m_BarColor); } } } Index: wg_groupbox.cpp =================================================================== RCS file: /cvsroot/wgui/wgui/src/wg_groupbox.cpp,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** wg_groupbox.cpp 23 Nov 2004 23:05:16 -0000 1.19 --- wg_groupbox.cpp 12 Dec 2004 09:08:19 -0000 1.20 *************** *** 64,78 **** CWindow::Draw(); ! CPainter Painter(m_pSDLSurface); ! Painter.DrawRect(CRect(0, 5, m_WindowRect.Width() - 1, m_WindowRect.Height() - 5), ! false, DEFAULT_LINE_COLOR); ! CPoint Dims, Offset; ! m_pRenderedString->GetMetrics(&Dims, &Offset, 0); ! Painter.DrawRect(CRect(CPoint(6, 0), CPoint(14, 0) + Dims), ! true, m_BackgroundColor, m_BackgroundColor); ! ! if (m_pRenderedString.get()) { ! m_pRenderedString->Draw(m_pSDLSurface, m_WindowRect.SizeRect(), CPoint(10, 0), m_FontColor); } } --- 64,81 ---- CWindow::Draw(); ! if (m_pSDLSurface) { ! CPainter Painter(m_pSDLSurface); ! Painter.DrawRect(CRect(0, 5, m_WindowRect.Width() - 1, m_WindowRect.Height() - 5), ! false, DEFAULT_LINE_COLOR); ! CPoint Dims, Offset; ! m_pRenderedString->GetMetrics(&Dims, &Offset, 0); ! Painter.DrawRect(CRect(CPoint(6, 0), CPoint(14, 0) + Dims), ! true, m_BackgroundColor, m_BackgroundColor); ! ! if (m_pRenderedString.get()) ! { ! m_pRenderedString->Draw(m_pSDLSurface, m_WindowRect.SizeRect(), CPoint(10, 0), m_FontColor); ! } } } Index: wg_scrollbar.cpp =================================================================== RCS file: /cvsroot/wgui/wgui/src/wg_scrollbar.cpp,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -d -r1.43 -r1.44 *** wg_scrollbar.cpp 3 Aug 2004 15:03:26 -0000 1.43 --- wg_scrollbar.cpp 12 Dec 2004 09:08:19 -0000 1.44 *************** *** 94,106 **** CWindow::Draw(); ! CPainter Painter(m_pSDLSurface); ! if (m_MinLimit != m_MaxLimit) { ! Painter.DrawRect(m_ThumbRect, false, COLOR_BLACK); ! CRect SubRect(m_ThumbRect); ! SubRect.Grow(-1); ! Painter.DrawRect(SubRect, true, COLOR_LIGHTGRAY, m_BackgroundColor); ! Painter.DrawHLine(SubRect.Left(), SubRect.Right(), SubRect.Bottom(), COLOR_DARKGRAY); ! Painter.DrawVLine(SubRect.Top(), SubRect.Bottom(), SubRect.Right(), COLOR_DARKGRAY); } } --- 94,109 ---- CWindow::Draw(); ! if (m_pSDLSurface) { ! CPainter Painter(m_pSDLSurface); ! if (m_MinLimit != m_MaxLimit) ! { ! Painter.DrawRect(m_ThumbRect, false, COLOR_BLACK); ! CRect SubRect(m_ThumbRect); ! SubRect.Grow(-1); ! Painter.DrawRect(SubRect, true, COLOR_LIGHTGRAY, m_BackgroundColor); ! Painter.DrawHLine(SubRect.Left(), SubRect.Right(), SubRect.Bottom(), COLOR_DARKGRAY); ! Painter.DrawVLine(SubRect.Top(), SubRect.Bottom(), SubRect.Right(), COLOR_DARKGRAY); ! } } } Index: wg_picture.cpp =================================================================== RCS file: /cvsroot/wgui/wgui/src/wg_picture.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** wg_picture.cpp 25 Jun 2004 19:37:51 -0000 1.13 --- wg_picture.cpp 12 Dec 2004 09:08:19 -0000 1.14 *************** *** 70,81 **** CWindow::Draw(); ! SDL_Rect SourceRect = m_ClientRect.SizeRect().SDLRect(); ! SDL_Rect DestRect = m_ClientRect.SDLRect(); ! SDL_BlitSurface(m_hBitmap.Bitmap(), &SourceRect, m_pSDLSurface, &DestRect); ! ! CPainter Painter(m_pSDLSurface); ! if (m_bDrawBorder) { ! Painter.DrawRect(m_WindowRect.SizeRect(), false, m_BorderColor); } } --- 70,84 ---- CWindow::Draw(); ! if (m_pSDLSurface) { ! SDL_Rect SourceRect = m_ClientRect.SizeRect().SDLRect(); ! SDL_Rect DestRect = m_ClientRect.SDLRect(); ! SDL_BlitSurface(m_hBitmap.Bitmap(), &SourceRect, m_pSDLSurface, &DestRect); ! ! CPainter Painter(m_pSDLSurface); ! if (m_bDrawBorder) ! { ! Painter.DrawRect(m_WindowRect.SizeRect(), false, m_BorderColor); ! } } } Index: wg_menu.cpp =================================================================== RCS file: /cvsroot/wgui/wgui/src/wg_menu.cpp,v retrieving revision 1.54 retrieving revision 1.55 diff -C2 -d -r1.54 -r1.55 *** wg_menu.cpp 23 Nov 2004 20:20:26 -0000 1.54 --- wg_menu.cpp 12 Dec 2004 09:08:19 -0000 1.55 *************** *** 234,254 **** CWindow::Draw(); ! CPainter Painter(m_pSDLSurface); ! UpdateCachedRects(); ! for (t_MenuItemVector::const_iterator iter = m_MenuItems.begin(); iter != m_MenuItems.end(); ++iter) { ! if (m_pHighlightedItem == &(iter->first)) ! { ! Painter.DrawRect(iter->second.second, true, m_HighlightColor, m_HighlightColor); ! } ! CRect TextRect(iter->second.second); ! TextRect.Grow(-2); ! if (iter->first.bSpacer) { ! Painter.DrawVLine(TextRect.Top(), TextRect.Bottom(), TextRect.Left(), COLOR_LIGHTGRAY); ! Painter.DrawVLine(TextRect.Top(), TextRect.Bottom(), TextRect.Right(), COLOR_DARKGRAY); } - else - iter->second.first.Draw(m_pSDLSurface, TextRect, CPoint(TextRect.Left(), (TextRect.Top() + TextRect.Bottom()) * 3 / 4)); } } --- 234,257 ---- CWindow::Draw(); ! if (m_pSDLSurface) { ! CPainter Painter(m_pSDLSurface); ! UpdateCachedRects(); ! for (t_MenuItemVector::const_iterator iter = m_MenuItems.begin(); iter != m_MenuItems.end(); ++iter) { ! if (m_pHighlightedItem == &(iter->first)) ! { ! Painter.DrawRect(iter->second.second, true, m_HighlightColor, m_HighlightColor); ! } ! CRect TextRect(iter->second.second); ! TextRect.Grow(-2); ! if (iter->first.bSpacer) ! { ! Painter.DrawVLine(TextRect.Top(), TextRect.Bottom(), TextRect.Left(), COLOR_LIGHTGRAY); ! Painter.DrawVLine(TextRect.Top(), TextRect.Bottom(), TextRect.Right(), COLOR_DARKGRAY); ! } ! else ! iter->second.first.Draw(m_pSDLSurface, TextRect, CPoint(TextRect.Left(), (TextRect.Top() + TextRect.Bottom()) * 3 / 4)); } } } *************** *** 523,563 **** CWindow::Draw(); ! CPainter Painter(m_pSDLSurface); ! Painter.DrawRect(m_WindowRect.SizeRect(), false, COLOR_LIGHTGRAY); ! Painter.DrawHLine(0, m_WindowRect.Width(), m_WindowRect.Height(), COLOR_DARKGRAY); ! Painter.DrawVLine(0, m_WindowRect.Height(), m_WindowRect.Width(), COLOR_DARKGRAY); ! UpdateCachedRects(); ! for (t_MenuItemVector::const_iterator iter = m_MenuItems.begin(); iter != m_MenuItems.end(); ++iter) { ! if (m_pHighlightedItem == &(iter->first)) ! { ! Painter.DrawRect(iter->second.second, true, m_HighlightColor, m_HighlightColor); ! } ! CRect TextRect(iter->second.second); ! TextRect.Grow(-2); ! if (iter->first.bSpacer) ! { ! Painter.DrawHLine(TextRect.Left(), TextRect.Right(), TextRect.Top(), COLOR_LIGHTGRAY); ! Painter.DrawHLine(TextRect.Left(), TextRect.Right(), TextRect.Bottom(), COLOR_DARKGRAY); ! } ! else ! iter->second.first.Draw(m_pSDLSurface, TextRect, TextRect.TopLeft()); ! if (iter->first.pPopup) { ! CRect ArrowRect(iter->second.second); ! ArrowRect.SetLeft(ArrowRect.Right() - m_hRightArrowBitmap.Bitmap()->w); ! SDL_Rect SourceRect; ! SourceRect.x = stdex::safe_static_cast<short int>(0); ! SourceRect.y = stdex::safe_static_cast<short int>((m_hRightArrowBitmap.Bitmap()->h - ArrowRect.Height()) / 2 < 0 ? ! 0 : (m_hRightArrowBitmap.Bitmap()->h - ArrowRect.Height()) / 2); ! SourceRect.w = stdex::safe_static_cast<short int>(m_hRightArrowBitmap.Bitmap()->w); ! SourceRect.h = stdex::safe_static_cast<short int>(std::min(ArrowRect.Height(), m_hRightArrowBitmap.Bitmap()->h)); ! SDL_Rect DestRect; ! DestRect.x = stdex::safe_static_cast<short int>(ArrowRect.Left()); ! DestRect.y = stdex::safe_static_cast<short int>((ArrowRect.Height() - m_hRightArrowBitmap.Bitmap()->h) / 2 < 0 ? ! ArrowRect.Top() : ArrowRect.Top() + (ArrowRect.Height() - m_hRightArrowBitmap.Bitmap()->h) / 2); ! DestRect.w = stdex::safe_static_cast<short int>(m_hRightArrowBitmap.Bitmap()->w); ! DestRect.h = stdex::safe_static_cast<short int>(std::min(ArrowRect.Height(), m_hRightArrowBitmap.Bitmap()->h)); ! SDL_BlitSurface(m_hRightArrowBitmap.Bitmap(), &SourceRect, m_pSDLSurface, &DestRect); } } --- 526,569 ---- CWindow::Draw(); ! if (m_pSDLSurface) { ! CPainter Painter(m_pSDLSurface); ! Painter.DrawRect(m_WindowRect.SizeRect(), false, COLOR_LIGHTGRAY); ! Painter.DrawHLine(0, m_WindowRect.Width(), m_WindowRect.Height(), COLOR_DARKGRAY); ! Painter.DrawVLine(0, m_WindowRect.Height(), m_WindowRect.Width(), COLOR_DARKGRAY); ! UpdateCachedRects(); ! for (t_MenuItemVector::const_iterator iter = m_MenuItems.begin(); iter != m_MenuItems.end(); ++iter) { ! if (m_pHighlightedItem == &(iter->first)) ! { ! Painter.DrawRect(iter->second.second, true, m_HighlightColor, m_HighlightColor); ! } ! CRect TextRect(iter->second.second); ! TextRect.Grow(-2); ! if (iter->first.bSpacer) ! { ! Painter.DrawHLine(TextRect.Left(), TextRect.Right(), TextRect.Top(), COLOR_LIGHTGRAY); ! Painter.DrawHLine(TextRect.Left(), TextRect.Right(), TextRect.Bottom(), COLOR_DARKGRAY); ! } ! else ! iter->second.first.Draw(m_pSDLSurface, TextRect, TextRect.TopLeft()); ! if (iter->first.pPopup) ! { ! CRect ArrowRect(iter->second.second); ! ArrowRect.SetLeft(ArrowRect.Right() - m_hRightArrowBitmap.Bitmap()->w); ! SDL_Rect SourceRect; ! SourceRect.x = stdex::safe_static_cast<short int>(0); ! SourceRect.y = stdex::safe_static_cast<short int>((m_hRightArrowBitmap.Bitmap()->h - ArrowRect.Height()) / 2 < 0 ? ! 0 : (m_hRightArrowBitmap.Bitmap()->h - ArrowRect.Height()) / 2); ! SourceRect.w = stdex::safe_static_cast<short int>(m_hRightArrowBitmap.Bitmap()->w); ! SourceRect.h = stdex::safe_static_cast<short int>(std::min(ArrowRect.Height(), m_hRightArrowBitmap.Bitmap()->h)); ! SDL_Rect DestRect; ! DestRect.x = stdex::safe_static_cast<short int>(ArrowRect.Left()); ! DestRect.y = stdex::safe_static_cast<short int>((ArrowRect.Height() - m_hRightArrowBitmap.Bitmap()->h) / 2 < 0 ? ! ArrowRect.Top() : ArrowRect.Top() + (ArrowRect.Height() - m_hRightArrowBitmap.Bitmap()->h) / 2); ! DestRect.w = stdex::safe_static_cast<short int>(m_hRightArrowBitmap.Bitmap()->w); ! DestRect.h = stdex::safe_static_cast<short int>(std::min(ArrowRect.Height(), m_hRightArrowBitmap.Bitmap()->h)); ! SDL_BlitSurface(m_hRightArrowBitmap.Bitmap(), &SourceRect, m_pSDLSurface, &DestRect); ! } } } Index: wg_button.cpp =================================================================== RCS file: /cvsroot/wgui/wgui/src/wg_button.cpp,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** wg_button.cpp 23 Nov 2004 23:05:10 -0000 1.39 --- wg_button.cpp 12 Dec 2004 09:08:18 -0000 1.40 *************** *** 78,110 **** CWindow::Draw(); ! CPoint FontCenterPoint = m_WindowRect.SizeRect().Center(); ! CRect SubRect(m_WindowRect.SizeRect()); ! SubRect.Grow(-1); ! CPainter Painter(m_pSDLSurface); ! Painter.DrawRect(m_WindowRect.SizeRect(), false, COLOR_BLACK); ! CRGBColor FontColor = DEFAULT_LINE_COLOR; ! switch (m_eButtonState) ! { ! case UP: ! Painter.DrawRect(SubRect, false, COLOR_LIGHTGRAY); ! Painter.DrawHLine(SubRect.Left(), SubRect.Right(), SubRect.Bottom(), COLOR_DARKGRAY); ! Painter.DrawVLine(SubRect.Top(), SubRect.Bottom(), SubRect.Right(), COLOR_DARKGRAY); ! break; ! case DOWN: ! Painter.DrawRect(SubRect, false, COLOR_LIGHTGRAY); ! Painter.DrawHLine(SubRect.Left(), SubRect.Right(), SubRect.Top(), COLOR_DARKGRAY); ! Painter.DrawVLine(SubRect.Top(), SubRect.Bottom(), SubRect.Left(), COLOR_DARKGRAY); ! FontCenterPoint = FontCenterPoint + CPoint(1, 1); ! break; ! case DISABLED: ! FontColor = DEFAULT_DISABLED_LINE_COLOR; ! break; ! default: ! break; ! } ! SubRect.Grow(-2); ! if (m_pRenderedString.get()) { ! m_pRenderedString->Draw(m_pSDLSurface, SubRect, FontCenterPoint, FontColor); } } --- 78,113 ---- CWindow::Draw(); ! if (m_pSDLSurface) { ! CPoint FontCenterPoint = m_WindowRect.SizeRect().Center(); ! CRect SubRect(m_WindowRect.SizeRect()); ! SubRect.Grow(-1); ! CPainter Painter(m_pSDLSurface); ! Painter.DrawRect(m_WindowRect.SizeRect(), false, COLOR_BLACK); ! CRGBColor FontColor = DEFAULT_LINE_COLOR; ! switch (m_eButtonState) ! { ! case UP: ! Painter.DrawRect(SubRect, false, COLOR_LIGHTGRAY); ! Painter.DrawHLine(SubRect.Left(), SubRect.Right(), SubRect.Bottom(), COLOR_DARKGRAY); ! Painter.DrawVLine(SubRect.Top(), SubRect.Bottom(), SubRect.Right(), COLOR_DARKGRAY); ! break; ! case DOWN: ! Painter.DrawRect(SubRect, false, COLOR_LIGHTGRAY); ! Painter.DrawHLine(SubRect.Left(), SubRect.Right(), SubRect.Top(), COLOR_DARKGRAY); ! Painter.DrawVLine(SubRect.Top(), SubRect.Bottom(), SubRect.Left(), COLOR_DARKGRAY); ! FontCenterPoint = FontCenterPoint + CPoint(1, 1); ! break; ! case DISABLED: ! FontColor = DEFAULT_DISABLED_LINE_COLOR; ! break; ! default: ! break; ! } ! SubRect.Grow(-2); ! if (m_pRenderedString.get()) ! { ! m_pRenderedString->Draw(m_pSDLSurface, SubRect, FontCenterPoint, FontColor); ! } } } *************** *** 235,272 **** CWindow::Draw(); ! CRect SubRect(m_WindowRect.SizeRect()); ! SubRect.Grow(-1); ! CPainter Painter(m_pSDLSurface); ! Painter.DrawRect(m_WindowRect.SizeRect(), false, COLOR_BLACK); ! switch (m_eButtonState) { ! case UP: ! Painter.DrawRect(SubRect, false, COLOR_LIGHTGRAY); ! Painter.DrawHLine(SubRect.Left(), SubRect.Right(), SubRect.Bottom(), COLOR_DARKGRAY); ! Painter.DrawVLine(SubRect.Top(), SubRect.Bottom(), SubRect.Right(), COLOR_DARKGRAY); ! break; ! case DOWN: ! Painter.DrawRect(SubRect, false, COLOR_LIGHTGRAY); ! Painter.DrawHLine(SubRect.Left(), SubRect.Right(), SubRect.Top(), COLOR_DARKGRAY); ! Painter.DrawVLine(SubRect.Top(), SubRect.Bottom(), SubRect.Left(), COLOR_DARKGRAY); ! SubRect = SubRect + CPoint(1, 1); ! break; ! case DISABLED: ! break; ! default: ! break; } - SubRect.Grow(-1); - SDL_Rect SourceRect; - SourceRect.x = stdex::safe_static_cast<short int>((m_phBitmap->Bitmap()->w - SubRect.Width()) / 2 < 0 ? 0 : (m_phBitmap->Bitmap()->w - SubRect.Width()) / 2); - SourceRect.y = stdex::safe_static_cast<short int>((m_phBitmap->Bitmap()->h - SubRect.Height()) / 2 < 0 ? 0 : (m_phBitmap->Bitmap()->w - SubRect.Height()) / 2); - SourceRect.w = stdex::safe_static_cast<short int>(std::min(SubRect.Width(), m_phBitmap->Bitmap()->w)); - SourceRect.h = stdex::safe_static_cast<short int>(std::min(SubRect.Height(), m_phBitmap->Bitmap()->h)); - SDL_Rect DestRect; - DestRect.x = stdex::safe_static_cast<short int>((SubRect.Width() - m_phBitmap->Bitmap()->w) / 2 < 0 ? SubRect.Left() : SubRect.Left() + (SubRect.Width() - m_phBitmap->Bitmap()->w) / 2); - DestRect.y = stdex::safe_static_cast<short int>((SubRect.Height() - m_phBitmap->Bitmap()->h) / 2 < 0 ? SubRect.Top() : SubRect.Top() + (SubRect.Height() - m_phBitmap->Bitmap()->h) / 2); - DestRect.w = stdex::safe_static_cast<short int>(std::min(SubRect.Width(), m_phBitmap->Bitmap()->w)); - DestRect.h = stdex::safe_static_cast<short int>(std::min(SubRect.Height(), m_phBitmap->Bitmap()->h)); - SDL_BlitSurface(m_phBitmap->Bitmap(), &SourceRect, m_pSDLSurface, &DestRect); } --- 238,278 ---- CWindow::Draw(); ! if (m_pSDLSurface) { ! CRect SubRect(m_WindowRect.SizeRect()); ! SubRect.Grow(-1); ! CPainter Painter(m_pSDLSurface); ! Painter.DrawRect(m_WindowRect.SizeRect(), false, COLOR_BLACK); ! switch (m_eButtonState) ! { ! case UP: ! Painter.DrawRect(SubRect, false, COLOR_LIGHTGRAY); ! Painter.DrawHLine(SubRect.Left(), SubRect.Right(), SubRect.Bottom(), COLOR_DARKGRAY); ! Painter.DrawVLine(SubRect.Top(), SubRect.Bottom(), SubRect.Right(), COLOR_DARKGRAY); ! break; ! case DOWN: ! Painter.DrawRect(SubRect, false, COLOR_LIGHTGRAY); ! Painter.DrawHLine(SubRect.Left(), SubRect.Right(), SubRect.Top(), COLOR_DARKGRAY); ! Painter.DrawVLine(SubRect.Top(), SubRect.Bottom(), SubRect.Left(), COLOR_DARKGRAY); ! SubRect = SubRect + CPoint(1, 1); ! break; ! case DISABLED: ! break; ! default: ! break; ! } ! SubRect.Grow(-1); ! SDL_Rect SourceRect; ! SourceRect.x = stdex::safe_static_cast<short int>((m_phBitmap->Bitmap()->w - SubRect.Width()) / 2 < 0 ? 0 : (m_phBitmap->Bitmap()->w - SubRect.Width()) / 2); ! SourceRect.y = stdex::safe_static_cast<short int>((m_phBitmap->Bitmap()->h - SubRect.Height()) / 2 < 0 ? 0 : (m_phBitmap->Bitmap()->w - SubRect.Height()) / 2); ! SourceRect.w = stdex::safe_static_cast<short int>(std::min(SubRect.Width(), m_phBitmap->Bitmap()->w)); ! SourceRect.h = stdex::safe_static_cast<short int>(std::min(SubRect.Height(), m_phBitmap->Bitmap()->h)); ! SDL_Rect DestRect; ! DestRect.x = stdex::safe_static_cast<short int>((SubRect.Width() - m_phBitmap->Bitmap()->w) / 2 < 0 ? SubRect.Left() : SubRect.Left() + (SubRect.Width() - m_phBitmap->Bitmap()->w) / 2); ! DestRect.y = stdex::safe_static_cast<short int>((SubRect.Height() - m_phBitmap->Bitmap()->h) / 2 < 0 ? SubRect.Top() : SubRect.Top() + (SubRect.Height() - m_phBitmap->Bitmap()->h) / 2); ! DestRect.w = stdex::safe_static_cast<short int>(std::min(SubRect.Width(), m_phBitmap->Bitmap()->w)); ! DestRect.h = stdex::safe_static_cast<short int>(std::min(SubRect.Height(), m_phBitmap->Bitmap()->h)); ! SDL_BlitSurface(m_phBitmap->Bitmap(), &SourceRect, m_pSDLSurface, &DestRect); } } Index: wg_label.cpp =================================================================== RCS file: /cvsroot/wgui/wgui/src/wg_label.cpp,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** wg_label.cpp 23 Nov 2004 23:05:16 -0000 1.21 --- wg_label.cpp 12 Dec 2004 09:08:19 -0000 1.22 *************** *** 61,65 **** CWindow::Draw(); ! if (m_pRenderedString.get()) { m_pRenderedString->Draw(m_pSDLSurface, m_WindowRect.SizeRect(), m_WindowRect.SizeRect().BottomLeft(), m_FontColor); --- 61,65 ---- CWindow::Draw(); ! if (m_pSDLSurface && m_pRenderedString.get()) { m_pRenderedString->Draw(m_pSDLSurface, m_WindowRect.SizeRect(), m_WindowRect.SizeRect().BottomLeft(), m_FontColor); Index: wg_window.cpp =================================================================== RCS file: /cvsroot/wgui/wgui/src/wg_window.cpp,v retrieving revision 1.53 retrieving revision 1.54 diff -C2 -d -r1.53 -r1.54 *** wg_window.cpp 3 Aug 2004 15:03:26 -0000 1.53 --- wg_window.cpp 12 Dec 2004 09:08:19 -0000 1.54 *************** *** 257,263 **** void CWindow::Draw(void) const { ! CPainter Painter(m_pSDLSurface); ! Painter.DrawRect(m_WindowRect.SizeRect(), true, m_BackgroundColor, m_BackgroundColor); ! CMessageServer::Instance().QueueMessage(new CMessage(CMessage::APP_PAINT, 0, this)); } --- 257,266 ---- void CWindow::Draw(void) const { ! if (m_pSDLSurface) ! { ! CPainter Painter(m_pSDLSurface); ! Painter.DrawRect(m_WindowRect.SizeRect(), true, m_BackgroundColor, m_BackgroundColor); ! CMessageServer::Instance().QueueMessage(new CMessage(CMessage::APP_PAINT, 0, this)); ! } } *************** *** 335,339 **** void CWindow::RegisterChildWindow(CWindow* pWindow) { ! m_ChildWindows.push_back(pWindow); } --- 338,351 ---- void CWindow::RegisterChildWindow(CWindow* pWindow) { ! if (!pWindow) ! { ! // anything that gets registered should be a valid CWindow ! CApplication::Instance()->GetApplicationLog().AddLogEntry( ! "CWindow::RegisterChildWindow : Attempting to register a non-existent child window.", APP_LOG_ERROR); ! } ! else ! { ! m_ChildWindows.push_back(pWindow); ! } } Index: wg_listbox.cpp =================================================================== RCS file: /cvsroot/wgui/wgui/src/wg_listbox.cpp,v retrieving revision 1.46 retrieving revision 1.47 diff -C2 -d -r1.46 -r1.47 *** wg_listbox.cpp 23 Jul 2004 14:46:00 -0000 1.46 --- wg_listbox.cpp 12 Dec 2004 09:08:19 -0000 1.47 *************** *** 131,157 **** CWindow::Draw(); ! CPainter Painter(m_pSDLSurface); ! Painter.DrawRect(m_WindowRect.SizeRect(), false, COLOR_BLACK); ! int iStartIndex = m_pVScrollbar->GetValue(); ! for (unsigned int i = iStartIndex; i < m_Items.size(); ++i) { ! CRect ItemRect(m_ClientRect.Left(), m_ClientRect.Top() + (i - iStartIndex) * m_iItemHeight, ! m_ClientRect.Right(), m_ClientRect.Top() + (i - iStartIndex + 1) * m_iItemHeight - 1); ! if (ItemRect.Overlaps(m_ClientRect)) { ! ItemRect.ClipTo(m_ClientRect); ! ItemRect.SetBottom(ItemRect.Bottom() - 1); ! if (m_SelectedItems.at(i)) ! { ! Painter.DrawRect(ItemRect, true, CApplication::Instance()->GetDefaultSelectionColor(), CApplication::Instance()->GetDefaultSelectionColor()); ! } ! if (stdex::safe_static_cast<int>(i) == m_iFocusedItem) { ! ItemRect.Grow(1); ! Painter.DrawRect(ItemRect, false, COLOR_BLACK); ItemRect.Grow(-1); } - ItemRect.Grow(-1); - m_RenderedStrings.at(i).Draw(m_pSDLSurface, ItemRect, ItemRect.TopLeft() + CPoint(0, 1), m_Items[i].ItemColor); } } --- 131,160 ---- CWindow::Draw(); ! if (m_pSDLSurface) { ! CPainter Painter(m_pSDLSurface); ! Painter.DrawRect(m_WindowRect.SizeRect(), false, COLOR_BLACK); ! int iStartIndex = m_pVScrollbar->GetValue(); ! for (unsigned int i = iStartIndex; i < m_Items.size(); ++i) { ! CRect ItemRect(m_ClientRect.Left(), m_ClientRect.Top() + (i - iStartIndex) * m_iItemHeight, ! m_ClientRect.Right(), m_ClientRect.Top() + (i - iStartIndex + 1) * m_iItemHeight - 1); ! if (ItemRect.Overlaps(m_ClientRect)) { ! ItemRect.ClipTo(m_ClientRect); ! ItemRect.SetBottom(ItemRect.Bottom() - 1); ! if (m_SelectedItems.at(i)) ! { ! Painter.DrawRect(ItemRect, true, CApplication::Instance()->GetDefaultSelectionColor(), CApplication::Instance()->GetDefaultSelectionColor()); ! } ! if (stdex::safe_static_cast<int>(i) == m_iFocusedItem) ! { ! ItemRect.Grow(1); ! Painter.DrawRect(ItemRect, false, COLOR_BLACK); ! ItemRect.Grow(-1); ! } ItemRect.Grow(-1); + m_RenderedStrings.at(i).Draw(m_pSDLSurface, ItemRect, ItemRect.TopLeft() + CPoint(0, 1), m_Items[i].ItemColor); } } } Index: wg_textbox.cpp =================================================================== RCS file: /cvsroot/wgui/wgui/src/wg_textbox.cpp,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** wg_textbox.cpp 23 Nov 2004 20:19:23 -0000 1.31 --- wg_textbox.cpp 12 Dec 2004 09:08:19 -0000 1.32 *************** *** 157,264 **** CWindow::Draw(); ! CPainter Painter(m_pSDLSurface); ! Painter.DrawRect(m_WindowRect.SizeRect(), false, COLOR_BLACK); ! CPoint FontCenterPoint = m_WindowRect.Center(); ! ! CRGBColor FontColor = m_bReadOnly ? DEFAULT_DISABLED_LINE_COLOR : DEFAULT_LINE_COLOR; ! if (CApplication::Instance()->GetKeyFocus() == dynamic_cast<const CWindow*>(this) && !m_bReadOnly) { ! // first normalize the selection ! std::string::size_type SelStartNorm = 0; ! std::string::size_type SelLenNorm = abs(m_SelLength); ! if (m_SelLength < 0) ! { ! SelStartNorm = m_SelStart + m_SelLength; ! } ! else ! { ! SelStartNorm = m_SelStart; ! } ! CPoint SelStartPoint(RowColFromIndex(SelStartNorm)); ! CPoint SelEndPoint(RowColFromIndex(SelStartNorm + SelLenNorm)); ! ! // now get the dimensions for each character ! std::vector<CPoint> vOffsets; ! std::vector<CPoint> vBoundingDimensions; ! std::vector<std::vector<CRect> > vCharRects; ! int iIndex = 0; ! for (std::vector<CRenderedString*>::const_iterator iter = m_vpRenderedString.begin(); iter != m_vpRenderedString.end(); ++iter, ++iIndex) ! { ! CPoint BoundingDimensions; ! CPoint Offset; ! std::vector<CRect> CharRects; ! (*iter)->GetMetrics(&BoundingDimensions, &Offset, &CharRects); ! vBoundingDimensions.push_back(BoundingDimensions); ! vOffsets.push_back(Offset); ! vCharRects.push_back(CharRects); ! } ! // move the cursor into view by scrolling if necessary ! int CursorPos = vCharRects.at(SelStartPoint.YPos()).at(SelStartPoint.XPos()).Left() + ! vOffsets.at(SelStartPoint.YPos()).XPos() + m_ClientRect.Left() - m_pHorizontalScrollBar->GetValue() * 10; ! if (m_bScrollToCursor) { ! if (CursorPos < m_ClientRect.Left()) ! { ! m_pHorizontalScrollBar->SetValue(m_pHorizontalScrollBar->GetValue() - (m_ClientRect.Left() - CursorPos) / 10 - 1); ! CursorPos = vCharRects.at(SelStartPoint.YPos()).at(SelStartPoint.XPos()).Left() + ! vOffsets.at(SelStartPoint.YPos()).XPos() + m_ClientRect.Left() - m_pHorizontalScrollBar->GetValue() * 10; ! } ! if (CursorPos > m_ClientRect.Right()) { ! m_pHorizontalScrollBar->SetValue(m_pHorizontalScrollBar->GetValue() + (CursorPos - m_ClientRect.Right()) / 10 + 1); ! CursorPos = vCharRects.at(SelStartPoint.YPos()).at(SelStartPoint.XPos()).Left() + ! vOffsets.at(SelStartPoint.YPos()).XPos() + m_ClientRect.Left() - m_pHorizontalScrollBar->GetValue() * 10; } ! if (SelStartPoint.YPos() < m_pVerticalScrollBar->GetValue()) { ! m_pVerticalScrollBar->SetValue(SelStartPoint.YPos()); } ! if (SelStartPoint.YPos() > stdex::safe_static_cast<int>(m_pVerticalScrollBar->GetValue() + m_ClientRect.Height() / m_iRowHeight)) { ! m_pVerticalScrollBar->SetValue(SelStartPoint.YPos() - m_ClientRect.Height() / m_iRowHeight); } - m_bScrollToCursor = false; - } ! // draw the selection ! if (m_SelLength != 0 && SelEndPoint.YPos() >= m_pVerticalScrollBar->GetValue()) ! { ! for (int CurLine = SelStartPoint.YPos(); CurLine <= SelEndPoint.YPos(); ++CurLine) { ! CPoint TopLeft = m_ClientRect.TopLeft() + CPoint(0, m_iRowHeight * (CurLine - m_pVerticalScrollBar->GetValue())); ! CRect SelRect(TopLeft, TopLeft + CPoint(vBoundingDimensions.at(CurLine).XPos(), m_iRowHeight - 2)); ! if (CurLine == SelStartPoint.YPos()) { ! SelRect.SetLeft(vCharRects.at(CurLine).at(SelStartPoint.XPos()).Left() + ! vOffsets.at(CurLine).XPos() + m_ClientRect.Left() - m_pHorizontalScrollBar->GetValue() * 10); } ! if (CurLine == SelEndPoint.YPos()) { ! SelRect.SetRight(vCharRects.at(CurLine).at(SelEndPoint.XPos() - 1).Right() + ! vOffsets.at(CurLine).XPos() + m_ClientRect.Left() - m_pHorizontalScrollBar->GetValue() * 10); } ! SelRect.ClipTo(m_ClientRect); ! Painter.DrawRect(SelRect, true, CApplication::Instance()->GetDefaultSelectionColor(), CApplication::Instance()->GetDefaultSelectionColor()); } - } ! // draw the cursor ! if (m_SelLength == 0 && SelStartPoint.YPos() >= m_pVerticalScrollBar->GetValue() && m_bDrawCursor) ! { ! if (CursorPos >= m_ClientRect.Left() && CursorPos <= m_ClientRect.Right()) { ! Painter.DrawVLine(m_ClientRect.Top() + m_iRowHeight * (SelStartPoint.YPos() - m_pVerticalScrollBar->GetValue()) - 1, ! m_ClientRect.Top() + m_iRowHeight * (SelStartPoint.YPos() - m_pVerticalScrollBar->GetValue() + 1) - 1, CursorPos, COLOR_BLACK); } } - } ! // finally, draw the text ! CPoint LineOrigin = m_ClientRect.TopLeft() - CPoint(m_pHorizontalScrollBar->GetValue() * 10, 0); ! for(std::vector<CRenderedString*>::const_iterator iter = m_vpRenderedString.begin() + m_pVerticalScrollBar->GetValue(); ! iter != m_vpRenderedString.end() && LineOrigin.YPos() < m_ClientRect.Bottom(); ++iter) { ! (*iter)->Draw(m_pSDLSurface, m_ClientRect, LineOrigin, FontColor); ! LineOrigin.SetY(LineOrigin.YPos() + m_iRowHeight); } } --- 157,267 ---- CWindow::Draw(); ! if (m_pSDLSurface) { ! CPainter Painter(m_pSDLSurface); ! Painter.DrawRect(m_WindowRect.SizeRect(), false, COLOR_BLACK); ! CPoint FontCenterPoint = m_WindowRect.Center(); ! CRGBColor FontColor = m_bReadOnly ? DEFAULT_DISABLED_LINE_COLOR : DEFAULT_LINE_COLOR; ! if (CApplication::Instance()->GetKeyFocus() == dynamic_cast<const CWindow*>(this) && !m_bReadOnly) { ! // first normalize the selection ! std::string::size_type SelStartNorm = 0; ! std::string::size_type SelLenNorm = abs(m_SelLength); ! if (m_SelLength < 0) { ! SelStartNorm = m_SelStart + m_SelLength; } ! else { ! SelStartNorm = m_SelStart; } ! CPoint SelStartPoint(RowColFromIndex(SelStartNorm)); ! CPoint SelEndPoint(RowColFromIndex(SelStartNorm + SelLenNorm)); ! ! // now get the dimensions for each character ! std::vector<CPoint> vOffsets; ! std::vector<CPoint> vBoundingDimensions; ! std::vector<std::vector<CRect> > vCharRects; ! int iIndex = 0; ! for (std::vector<CRenderedString*>::const_iterator iter = m_vpRenderedString.begin(); iter != m_vpRenderedString.end(); ++iter, ++iIndex) { ! CPoint BoundingDimensions; ! CPoint Offset; ! std::vector<CRect> CharRects; ! (*iter)->GetMetrics(&BoundingDimensions, &Offset, &CharRects); ! vBoundingDimensions.push_back(BoundingDimensions); ! vOffsets.push_back(Offset); ! vCharRects.push_back(CharRects); } ! // move the cursor into view by scrolling if necessary ! int CursorPos = vCharRects.at(SelStartPoint.YPos()).at(SelStartPoint.XPos()).Left() + ! vOffsets.at(SelStartPoint.YPos()).XPos() + m_ClientRect.Left() - m_pHorizontalScrollBar->GetValue() * 10; ! if (m_bScrollToCursor) { ! if (CursorPos < m_ClientRect.Left()) { ! m_pHorizontalScrollBar->SetValue(m_pHorizontalScrollBar->GetValue() - (m_ClientRect.Left() - CursorPos) / 10 - 1); ! CursorPos = vCharRects.at(SelStartPoint.YPos()).at(SelStartPoint.XPos()).Left() + ! vOffsets.at(SelStartPoint.YPos()).XPos() + m_ClientRect.Left() - m_pHorizontalScrollBar->GetValue() * 10; } ! if (CursorPos > m_ClientRect.Right()) { ! m_pHorizontalScrollBar->SetValue(m_pHorizontalScrollBar->GetValue() + (CursorPos - m_ClientRect.Right()) / 10 + 1); ! CursorPos = vCharRects.at(SelStartPoint.YPos()).at(SelStartPoint.XPos()).Left() + ! vOffsets.at(SelStartPoint.YPos()).XPos() + m_ClientRect.Left() - m_pHorizontalScrollBar->GetValue() * 10; } ! if (SelStartPoint.YPos() < m_pVerticalScrollBar->GetValue()) ! { ! m_pVerticalScrollBar->SetValue(SelStartPoint.YPos()); ! } ! if (SelStartPoint.YPos() > stdex::safe_static_cast<int>(m_pVerticalScrollBar->GetValue() + m_ClientRect.Height() / m_iRowHeight)) ! { ! m_pVerticalScrollBar->SetValue(SelStartPoint.YPos() - m_ClientRect.Height() / m_iRowHeight); ! } ! m_bScrollToCursor = false; } ! // draw the selection ! if (m_SelLength != 0 && SelEndPoint.YPos() >= m_pVerticalScrollBar->GetValue()) { ! for (int CurLine = SelStartPoint.YPos(); CurLine <= SelEndPoint.YPos(); ++CurLine) ! { ! CPoint TopLeft = m_ClientRect.TopLeft() + CPoint(0, m_iRowHeight * (CurLine - m_pVerticalScrollBar->GetValue())); ! CRect SelRect(TopLeft, TopLeft + CPoint(vBoundingDimensions.at(CurLine).XPos(), m_iRowHeight - 2)); ! if (CurLine == SelStartPoint.YPos()) ! { ! SelRect.SetLeft(vCharRects.at(CurLine).at(SelStartPoint.XPos()).Left() + ! vOffsets.at(CurLine).XPos() + m_ClientRect.Left() - m_pHorizontalScrollBar->GetValue() * 10); ! } ! if (CurLine == SelEndPoint.YPos()) ! { ! SelRect.SetRight(vCharRects.at(CurLine).at(SelEndPoint.XPos() - 1).Right() + ! vOffsets.at(CurLine).XPos() + m_ClientRect.Left() - m_pHorizontalScrollBar->GetValue() * 10); ! } ! SelRect.ClipTo(m_ClientRect); ! Painter.DrawRect(SelRect, true, CApplication::Instance()->GetDefaultSelectionColor(), CApplication::Instance()->GetDefaultSelectionColor()); ! } ! } ! ! // draw the cursor ! if (m_SelLength == 0 && SelStartPoint.YPos() >= m_pVerticalScrollBar->GetValue() && m_bDrawCursor) ! { ! if (CursorPos >= m_ClientRect.Left() && CursorPos <= m_ClientRect.Right()) ! { ! Painter.DrawVLine(m_ClientRect.Top() + m_iRowHeight * (SelStartPoint.YPos() - m_pVerticalScrollBar->GetValue()) - 1, ! m_ClientRect.Top() + m_iRowHeight * (SelStartPoint.YPos() - m_pVerticalScrollBar->GetValue() + 1) - 1, CursorPos, COLOR_BLACK); ! } } } ! // finally, draw the text ! CPoint LineOrigin = m_ClientRect.TopLeft() - CPoint(m_pHorizontalScrollBar->GetValue() * 10, 0); ! for(std::vector<CRenderedString*>::const_iterator iter = m_vpRenderedString.begin() + m_pVerticalScrollBar->GetValue(); ! iter != m_vpRenderedString.end() && LineOrigin.YPos() < m_ClientRect.Bottom(); ++iter) { ! (*iter)->Draw(m_pSDLSurface, m_ClientRect, LineOrigin, FontColor); ! LineOrigin.SetY(LineOrigin.YPos() + m_iRowHeight); ! } } } Index: wg_frame.cpp =================================================================== RCS file: /cvsroot/wgui/wgui/src/wg_frame.cpp,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** wg_frame.cpp 23 Nov 2004 23:05:16 -0000 1.25 --- wg_frame.cpp 12 Dec 2004 09:08:19 -0000 1.26 *************** *** 74,93 **** CWindow::Draw(); ! CPainter Painter(m_pSDLSurface); ! CRect SubRect(m_WindowRect.SizeRect()); ! SubRect.Grow(-1); ! Painter.DrawRect(SubRect, false, COLOR_LIGHTGRAY); ! Painter.DrawHLine(0, SubRect.Width(), SubRect.Height(), COLOR_DARKGRAY); ! Painter.DrawVLine(0, SubRect.Height(), SubRect.Width(), COLOR_DARKGRAY); ! SubRect.Grow(-1); ! Painter.DrawRect(SubRect, false, COLOR_BLACK); ! Painter.DrawRect(m_TitleBarRect, true, m_TitleBarColor, m_TitleBarColor); ! ! CRect TextClipRect(m_TitleBarRect); ! TextClipRect.SetRight(TextClipRect.Right() - 16); ! TextClipRect.Grow(-1); ! if (m_pRenderedString.get()) { ! m_pRenderedString->Draw(m_pSDLSurface, TextClipRect, m_TitleBarRect.TopLeft() + CPoint(6, m_iTitleBarHeight / 2), m_TitleBarTextColor); } } --- 74,96 ---- CWindow::Draw(); ! if (m_pSDLSurface) { ! CPainter Painter(m_pSDLSurface); ! CRect SubRect(m_WindowRect.SizeRect()); ! SubRect.Grow(-1); ! Painter.DrawRect(SubRect, false, COLOR_LIGHTGRAY); ! Painter.DrawHLine(0, SubRect.Width(), SubRect.Height(), COLOR_DARKGRAY); ! Painter.DrawVLine(0, SubRect.Height(), SubRect.Width(), COLOR_DARKGRAY); ! SubRect.Grow(-1); ! Painter.DrawRect(SubRect, false, COLOR_BLACK); ! Painter.DrawRect(m_TitleBarRect, true, m_TitleBarColor, m_TitleBarColor); ! ! CRect TextClipRect(m_TitleBarRect); ! TextClipRect.SetRight(TextClipRect.Right() - 16); ! TextClipRect.Grow(-1); ! if (m_pRenderedString.get()) ! { ! m_pRenderedString->Draw(m_pSDLSurface, TextClipRect, m_TitleBarRect.TopLeft() + CPoint(6, m_iTitleBarHeight / 2), m_TitleBarTextColor); ! } } } |
|
From: Rob W. <gre...@us...> - 2004-12-12 09:08:31
|
Update of /cvsroot/wgui/wgui/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18285/tests Modified Files: TestFrame2.cpp TestView1.cpp Log Message: Added some safety checks. Index: TestView1.cpp =================================================================== RCS file: /cvsroot/wgui/wgui/tests/TestView1.cpp,v retrieving revision 1.76 retrieving revision 1.77 diff -C2 -d -r1.76 -r1.77 *** TestView1.cpp 3 Aug 2004 20:11:01 -0000 1.76 --- TestView1.cpp 12 Dec 2004 09:08:19 -0000 1.77 *************** *** 45,55 **** CWindow::Draw(); ! wGui::CPainter Painter(m_pSDLSurface); ! Painter.DrawRect(m_WindowRect.SizeRect(), false, wGui::COLOR_WHITE); ! Painter.DrawRect(m_ClientRect, false, wGui::COLOR_RED); ! Painter.DrawLine(wGui::CPoint(10, 50), wGui::CPoint(60, 50)); ! Painter.DrawLine(wGui::CPoint(20, 10), wGui::CPoint(60, 30), wGui::COLOR_GREEN); ! Painter.DrawLine(wGui::CPoint(60, 10), wGui::CPoint(70, 80), wGui::COLOR_RED); ! Painter.DrawLine(wGui::CPoint(20, 10), wGui::CPoint(20, 80), wGui::COLOR_BLUE); } --- 45,58 ---- CWindow::Draw(); ! if (m_pSDLSurface) ! { ! wGui::CPainter Painter(m_pSDLSurface); ! Painter.DrawRect(m_WindowRect.SizeRect(), false, wGui::COLOR_WHITE); ! Painter.DrawRect(m_ClientRect, false, wGui::COLOR_RED); ! Painter.DrawLine(wGui::CPoint(10, 50), wGui::CPoint(60, 50)); ! Painter.DrawLine(wGui::CPoint(20, 10), wGui::CPoint(60, 30), wGui::COLOR_GREEN); ! Painter.DrawLine(wGui::CPoint(60, 10), wGui::CPoint(70, 80), wGui::COLOR_RED); ! Painter.DrawLine(wGui::CPoint(20, 10), wGui::CPoint(20, 80), wGui::COLOR_BLUE); ! } } Index: TestFrame2.cpp =================================================================== RCS file: /cvsroot/wgui/wgui/tests/TestFrame2.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** TestFrame2.cpp 23 Nov 2004 23:05:17 -0000 1.8 --- TestFrame2.cpp 12 Dec 2004 09:08:19 -0000 1.9 *************** *** 51,57 **** CWindow::Draw(); ! wGui::CPainter Painter(m_pSDLSurface); ! Painter.DrawRect(m_WindowRect, false, wGui::COLOR_WHITE); ! Painter.DrawRect(m_ClientRect, false, wGui::COLOR_RED); } --- 51,60 ---- CWindow::Draw(); ! if (m_pSDLSurface) ! { ! wGui::CPainter Painter(m_pSDLSurface); ! Painter.DrawRect(m_WindowRect, false, wGui::COLOR_WHITE); ! Painter.DrawRect(m_ClientRect, false, wGui::COLOR_RED); ! } } |
|
From: Rob W. <gre...@us...> - 2004-12-07 21:18:06
|
Update of /cvsroot/wgui/wgui In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10897 Modified Files: BUGS CHANGES README Log Message: Documentation Updates. Index: README =================================================================== RCS file: /cvsroot/wgui/wgui/README,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** README 7 Jun 2004 18:54:15 -0000 1.19 --- README 7 Dec 2004 21:17:56 -0000 1.20 *************** *** 1,12 **** ! 0.3.3 ! This release only contains a few minor changes, the most notable of which is the addition of the CRangeControl class, ! which is now the base class for the CProgressBar and CScrollBar controls. - This is to be the last 0.3.x release. The next release will hopefully be the 0.4.0 release which will have some fairly significant - changes to the drawing code. The intention of these changes is to fix several bugs (like the Z-Order bug), improve performance, - and enable us to add some new cool features. Due to problems with VC6, use of the VC.NET and .NET 2003 compilers is suggested for building on Windows. We've now included the Bitstream Vera font family as the default font for wGui. --- 1,13 ---- ! 0.4.0 ! This version has been a long time in coming, but it's worth it. Core to the version bump were a number of fundamental ! changes to the drawing code. The big difference is that each CWindow now has it's own SDL surface to draw to, which ! is then copied to the window surface when the screen updates. This fixes a number of Z-Order problems we had before ! and simplifies the drawing code itself. As such the API around the drawnig code has changed a bit, especially in relation ! to the coordinate systems used to draw. Due to problems with VC6, use of the VC.NET and .NET 2003 compilers is suggested for building on Windows. + (VC6 will work, but it gives *a lot* of useless warnings) We've now included the Bitstream Vera font family as the default font for wGui. Index: CHANGES =================================================================== RCS file: /cvsroot/wgui/wgui/CHANGES,v retrieving revision 1.152 retrieving revision 1.153 diff -C2 -d -r1.152 -r1.153 *** CHANGES 1 Sep 2004 18:57:30 -0000 1.152 --- CHANGES 7 Dec 2004 21:17:56 -0000 1.153 *************** *** 22,25 **** --- 22,26 ---- + Bugfix CTextBox: The mouse cursor is no longer changed to an IBeam when over an text box if it's also over a floating window + Bugfix CToolTip: Tooltips will not appear if the mouse is being held over a floating window + + TestApp2 no longer uses fullscreen mode. This will likely change back in the future as the CFrame class develops. Index: BUGS =================================================================== RCS file: /cvsroot/wgui/wgui/BUGS,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** BUGS 7 Jun 2004 18:54:05 -0000 1.14 --- BUGS 7 Dec 2004 21:17:55 -0000 1.15 *************** *** 1,6 **** ! Known bugs for 0.3.3 ! - Bug #825743 - Popup menu Z-order can run into problems when popups overlap. This has been partially fixed, but may still flicker. ! - Floating windows may flicker in debug builds and on slower machines - The wGui library is currently built to the src directory instead of the lib directory when using GNU Make --- 1,5 ---- ! Known bugs for 0.4.0 ! - The CFrame class is far from complete. Currently the title bar does not draw correctly, and the frame doesn't clip it's child controls. - The wGui library is currently built to the src directory instead of the lib directory when using GNU Make |
|
From: Rob W. <gre...@us...> - 2004-11-23 23:06:35
|
Update of /cvsroot/wgui/wgui/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23873/src Modified Files: wg_button.cpp wg_editbox.cpp wg_frame.cpp wg_groupbox.cpp wg_label.cpp wg_painter.cpp wg_tooltip.cpp Log Message: CFrame fixes. Index: wg_button.cpp =================================================================== RCS file: /cvsroot/wgui/wgui/src/wg_button.cpp,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** wg_button.cpp 16 Jul 2004 16:41:36 -0000 1.38 --- wg_button.cpp 23 Nov 2004 23:05:10 -0000 1.39 *************** *** 104,108 **** } SubRect.Grow(-2); ! m_pRenderedString->Draw(m_pSDLSurface, SubRect, FontCenterPoint, FontColor); } --- 104,111 ---- } SubRect.Grow(-2); ! if (m_pRenderedString.get()) ! { ! m_pRenderedString->Draw(m_pSDLSurface, SubRect, FontCenterPoint, FontColor); ! } } Index: wg_painter.cpp =================================================================== RCS file: /cvsroot/wgui/wgui/src/wg_painter.cpp,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** wg_painter.cpp 2 Apr 2004 17:26:16 -0000 1.21 --- wg_painter.cpp 23 Nov 2004 23:05:16 -0000 1.22 *************** *** 100,106 **** void CPainter::DrawRect(const CRect& Rect, bool bFilled, const CRGBColor& BorderColor, const CRGBColor& FillColor) { ! CRect RealRect((m_pWindow != 0) ? Rect + m_pWindow->GetClientRect().TopLeft() : Rect); if (m_pWindow) { RealRect.ClipTo(m_pWindow->GetClientRect()); } --- 100,107 ---- void CPainter::DrawRect(const CRect& Rect, bool bFilled, const CRGBColor& BorderColor, const CRGBColor& FillColor) { ! CRect RealRect(Rect); if (m_pWindow) { + RealRect = Rect + m_pWindow->GetClientRect().TopLeft(); RealRect.ClipTo(m_pWindow->GetClientRect()); } Index: wg_editbox.cpp =================================================================== RCS file: /cvsroot/wgui/wgui/src/wg_editbox.cpp,v retrieving revision 1.94 retrieving revision 1.95 diff -C2 -d -r1.94 -r1.95 *** wg_editbox.cpp 1 Sep 2004 18:57:31 -0000 1.94 --- wg_editbox.cpp 23 Nov 2004 23:05:11 -0000 1.95 *************** *** 276,281 **** } ! m_pRenderedString->Draw(m_pSDLSurface, SubRect, ! CPoint(SubRect.Left() + m_ScrollOffset, SubRect.Bottom() - m_pRenderedString->GetMaxFontHeight() / 4), FontColor); } --- 276,284 ---- } ! if (m_pRenderedString.get()) ! { ! m_pRenderedString->Draw(m_pSDLSurface, SubRect, ! CPoint(SubRect.Left() + m_ScrollOffset, SubRect.Bottom() - m_pRenderedString->GetMaxFontHeight() / 4), FontColor); ! } } Index: wg_label.cpp =================================================================== RCS file: /cvsroot/wgui/wgui/src/wg_label.cpp,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** wg_label.cpp 16 Jul 2004 16:41:36 -0000 1.20 --- wg_label.cpp 23 Nov 2004 23:05:16 -0000 1.21 *************** *** 61,65 **** CWindow::Draw(); ! m_pRenderedString->Draw(m_pSDLSurface, m_WindowRect.SizeRect(), m_WindowRect.SizeRect().BottomLeft(), m_FontColor); } --- 61,68 ---- CWindow::Draw(); ! if (m_pRenderedString.get()) ! { ! m_pRenderedString->Draw(m_pSDLSurface, m_WindowRect.SizeRect(), m_WindowRect.SizeRect().BottomLeft(), m_FontColor); ! } } Index: wg_tooltip.cpp =================================================================== RCS file: /cvsroot/wgui/wgui/src/wg_tooltip.cpp,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** wg_tooltip.cpp 19 Jul 2004 21:49:58 -0000 1.26 --- wg_tooltip.cpp 23 Nov 2004 23:05:17 -0000 1.27 *************** *** 88,92 **** CRect SubRect(m_WindowRect.SizeRect()); SubRect.Grow(-2); ! m_pRenderedString->Draw(m_pSDLSurface, SubRect, SubRect.TopLeft(), m_FontColor); } --- 88,95 ---- CRect SubRect(m_WindowRect.SizeRect()); SubRect.Grow(-2); ! if (m_pRenderedString.get()) ! { ! m_pRenderedString->Draw(m_pSDLSurface, SubRect, SubRect.TopLeft(), m_FontColor); ! } } Index: wg_frame.cpp =================================================================== RCS file: /cvsroot/wgui/wgui/src/wg_frame.cpp,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** wg_frame.cpp 30 Jun 2004 22:31:01 -0000 1.24 --- wg_frame.cpp 23 Nov 2004 23:05:16 -0000 1.25 *************** *** 40,49 **** m_pSavedSurface(0) { - m_sWindowText = sTitle; - m_pFrameCloseButton = new CPictureButton(CRect(0, 0, 12, 12), - this, CwgBitmapResourceHandle(WGRES_X_BITMAP)); - - SetWindowRect(WindowRect); // must be done after the buttons are created - if (pFontEngine) { --- 40,43 ---- *************** *** 54,60 **** --- 48,61 ---- m_pFontEngine = CApplication::Instance()->GetDefaultFontEngine(); } + + m_sWindowText = sTitle; + m_pFrameCloseButton = new CPictureButton(CRect(0, 0, 12, 12), + this, CwgBitmapResourceHandle(WGRES_X_BITMAP)); + std::auto_ptr<CRenderedString> pRenderedString(new CRenderedString(m_pFontEngine, m_sWindowText, CRenderedString::VALIGN_CENTER)); m_pRenderedString = pRenderedString; + SetWindowRect(WindowRect); // must be done after the buttons are created, and after the CRenderedString is created + CMessageServer::Instance().RegisterMessageClient(this, CMessage::MOUSE_BUTTONUP); CMessageServer::Instance().RegisterMessageClient(this, CMessage::MOUSE_MOVE); *************** *** 74,82 **** CPainter Painter(m_pSDLSurface); - Painter.DrawRect(m_WindowRect.SizeRect(), false, COLOR_LIGHTGRAY); - Painter.DrawHLine(0, m_WindowRect.Width(), m_WindowRect.Height(), COLOR_DARKGRAY); - Painter.DrawVLine(0, m_WindowRect.Height(), m_WindowRect.Width(), COLOR_DARKGRAY); CRect SubRect(m_WindowRect.SizeRect()); SubRect.Grow(-1); Painter.DrawRect(SubRect, false, COLOR_BLACK); Painter.DrawRect(m_TitleBarRect, true, m_TitleBarColor, m_TitleBarColor); --- 75,84 ---- CPainter Painter(m_pSDLSurface); CRect SubRect(m_WindowRect.SizeRect()); SubRect.Grow(-1); + Painter.DrawRect(SubRect, false, COLOR_LIGHTGRAY); + Painter.DrawHLine(0, SubRect.Width(), SubRect.Height(), COLOR_DARKGRAY); + Painter.DrawVLine(0, SubRect.Height(), SubRect.Width(), COLOR_DARKGRAY); + SubRect.Grow(-1); Painter.DrawRect(SubRect, false, COLOR_BLACK); Painter.DrawRect(m_TitleBarRect, true, m_TitleBarColor, m_TitleBarColor); *************** *** 85,89 **** TextClipRect.SetRight(TextClipRect.Right() - 16); TextClipRect.Grow(-1); ! m_pRenderedString->Draw(m_pSDLSurface, TextClipRect, m_TitleBarRect.TopLeft() + CPoint(6, m_iTitleBarHeight / 2), m_TitleBarTextColor); } --- 87,94 ---- TextClipRect.SetRight(TextClipRect.Right() - 16); TextClipRect.Grow(-1); ! if (m_pRenderedString.get()) ! { ! m_pRenderedString->Draw(m_pSDLSurface, TextClipRect, m_TitleBarRect.TopLeft() + CPoint(6, m_iTitleBarHeight / 2), m_TitleBarTextColor); ! } } *************** *** 117,130 **** { CWindow::SetWindowRect(WindowRect); ! m_TitleBarRect = CRect(2, 2, WindowRect.Width() - 3, m_iTitleBarHeight) + WindowRect.TopLeft(); ! m_pFrameCloseButton->SetWindowRect(CRect(WindowRect.Width() - 16, m_iTitleBarHeight / 2 - 5, WindowRect.Width() - 4, m_iTitleBarHeight / 2 + 7) + WindowRect.TopLeft()); ! m_ClientRect = CRect(2, m_iTitleBarHeight + 2, WindowRect.Height() - m_iTitleBarHeight - 1, WindowRect.Width() - 1); ! } ! ! ! void CFrame::MoveWindow(const CPoint& MoveDistance) ! { ! CWindow::MoveWindow(MoveDistance); ! m_TitleBarRect = m_TitleBarRect + MoveDistance; } --- 122,128 ---- { CWindow::SetWindowRect(WindowRect); ! m_TitleBarRect = CRect(2, 0, WindowRect.Width() - 3, m_iTitleBarHeight); ! m_pFrameCloseButton->SetWindowRect(CRect(WindowRect.Width() - 20, (-m_iTitleBarHeight / 2) - 5, WindowRect.Width() - 8, (-m_iTitleBarHeight / 2) + 7)); ! m_ClientRect = CRect(2, m_iTitleBarHeight + 2, WindowRect.Width() - 1, WindowRect.Height() - 1); } Index: wg_groupbox.cpp =================================================================== RCS file: /cvsroot/wgui/wgui/src/wg_groupbox.cpp,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** wg_groupbox.cpp 16 Jul 2004 16:41:36 -0000 1.18 --- wg_groupbox.cpp 23 Nov 2004 23:05:16 -0000 1.19 *************** *** 71,75 **** Painter.DrawRect(CRect(CPoint(6, 0), CPoint(14, 0) + Dims), true, m_BackgroundColor, m_BackgroundColor); ! m_pRenderedString->Draw(m_pSDLSurface, m_WindowRect.SizeRect(), CPoint(10, 0), m_FontColor); } --- 71,79 ---- Painter.DrawRect(CRect(CPoint(6, 0), CPoint(14, 0) + Dims), true, m_BackgroundColor, m_BackgroundColor); ! ! if (m_pRenderedString.get()) ! { ! m_pRenderedString->Draw(m_pSDLSurface, m_WindowRect.SizeRect(), CPoint(10, 0), m_FontColor); ! } } |
|
From: Rob W. <gre...@us...> - 2004-11-23 23:06:16
|
Update of /cvsroot/wgui/wgui/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23873/tests Modified Files: TestFrame2.cpp TestView2.cpp Log Message: CFrame fixes. Index: TestFrame2.cpp =================================================================== RCS file: /cvsroot/wgui/wgui/tests/TestFrame2.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** TestFrame2.cpp 25 Jun 2004 19:37:51 -0000 1.7 --- TestFrame2.cpp 23 Nov 2004 23:05:17 -0000 1.8 *************** *** 36,40 **** wGui::CFrame(wGui::CRect(0, 0, 140, 80) + Location, pParent, pFontEngine, "Simple Frame", false) { ! m_pButton = new wGui::CButton(ClientToView(wGui::CRect(20, 20, 150, 40)), this, "Test Button"); } --- 36,40 ---- wGui::CFrame(wGui::CRect(0, 0, 140, 80) + Location, pParent, pFontEngine, "Simple Frame", false) { ! m_pButton = new wGui::CButton(wGui::CRect(20, 20, 150, 40), this, "Test Button"); } Index: TestView2.cpp =================================================================== RCS file: /cvsroot/wgui/wgui/tests/TestView2.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** TestView2.cpp 25 Jun 2004 19:37:51 -0000 1.9 --- TestView2.cpp 23 Nov 2004 23:05:28 -0000 1.10 *************** *** 27,31 **** CTestView::CTestView(void) : ! wGui::CView(wGui::CRect(0, 0, 800, 600), "Test App 2", false, true) { SetWindowText(std::string("Test App 2 - wGui version ") + wGui::CwgStringResourceHandle(wGui::WGRES_VERSION_STRING).String()); --- 27,31 ---- CTestView::CTestView(void) : ! wGui::CView(wGui::CRect(0, 0, 800, 600), "Test App 2", true, false) { SetWindowText(std::string("Test App 2 - wGui version ") + wGui::CwgStringResourceHandle(wGui::WGRES_VERSION_STRING).String()); |
|
From: Rob W. <gre...@us...> - 2004-11-23 23:06:11
|
Update of /cvsroot/wgui/wgui/includes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23873/includes Modified Files: wg_frame.h Log Message: CFrame fixes. Index: wg_frame.h =================================================================== RCS file: /cvsroot/wgui/wgui/includes/wg_frame.h,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** wg_frame.h 3 Jun 2004 19:10:52 -0000 1.16 --- wg_frame.h 23 Nov 2004 23:05:08 -0000 1.17 *************** *** 88,95 **** virtual void SetWindowRect(const CRect& WindowRect); - //! Move the window and any child windows - //! \param MoveDistance The relative distance to move the window - virtual void MoveWindow(const CPoint& MoveDistance); - //! Set the title bar text of the frame //! \param sText The text to assign to the view --- 88,91 ---- |
|
From: Rob W. <gre...@us...> - 2004-11-23 20:20:38
|
Update of /cvsroot/wgui/wgui/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16003/src Modified Files: wg_menu.cpp Log Message: Code cleanup. Index: wg_menu.cpp =================================================================== RCS file: /cvsroot/wgui/wgui/src/wg_menu.cpp,v retrieving revision 1.53 retrieving revision 1.54 diff -C2 -d -r1.53 -r1.54 *** wg_menu.cpp 16 Jul 2004 18:52:51 -0000 1.53 --- wg_menu.cpp 23 Nov 2004 20:20:26 -0000 1.54 *************** *** 69,72 **** --- 69,73 ---- { delete m_pPopupTimer; + m_pPopupTimer = 0; } |
|
From: Rob W. <gre...@us...> - 2004-11-23 20:19:34
|
Update of /cvsroot/wgui/wgui/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15662/src Modified Files: wg_textbox.cpp Log Message: Code cleanup. Index: wg_textbox.cpp =================================================================== RCS file: /cvsroot/wgui/wgui/src/wg_textbox.cpp,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** wg_textbox.cpp 3 Aug 2004 20:11:01 -0000 1.30 --- wg_textbox.cpp 23 Nov 2004 20:19:23 -0000 1.31 *************** *** 67,73 **** m_ClientRect.Grow(-3); m_pVerticalScrollBar = new CScrollBar( ! CRect(m_WindowRect.Width() - 12, 1, m_WindowRect.Width(), m_WindowRect.Height() - 12) - m_ClientRect.TopLeft(), this, CScrollBar::VERTICAL), m_pHorizontalScrollBar = new CScrollBar( ! CRect(1, m_WindowRect.Height() - 12, m_WindowRect.Width() - 12, m_WindowRect.Height()) - m_ClientRect.TopLeft(), this, CScrollBar::HORIZONTAL), m_ScrollBarVisibilityMap[CScrollBar::VERTICAL] = SCROLLBAR_VIS_AUTO; m_ScrollBarVisibilityMap[CScrollBar::HORIZONTAL] = SCROLLBAR_VIS_AUTO; --- 67,73 ---- m_ClientRect.Grow(-3); m_pVerticalScrollBar = new CScrollBar( ! CRect(m_WindowRect.Width() - 12, 1, m_WindowRect.Width(), m_WindowRect.Height() - 12) - m_ClientRect.TopLeft(), this, CScrollBar::VERTICAL); m_pHorizontalScrollBar = new CScrollBar( ! CRect(1, m_WindowRect.Height() - 12, m_WindowRect.Width() - 12, m_WindowRect.Height()) - m_ClientRect.TopLeft(), this, CScrollBar::HORIZONTAL); m_ScrollBarVisibilityMap[CScrollBar::VERTICAL] = SCROLLBAR_VIS_AUTO; m_ScrollBarVisibilityMap[CScrollBar::HORIZONTAL] = SCROLLBAR_VIS_AUTO; |
|
From: Rob W. <gre...@us...> - 2004-09-01 19:22:12
|
Update of /cvsroot/wgui/wgui/includes/unit_tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19759/includes/unit_tests Modified Files: wg_window_unittests.h Log Message: Fixed a bug in the unit tests. Index: wg_window_unittests.h =================================================================== RCS file: /cvsroot/wgui/wgui/includes/unit_tests/wg_window_unittests.h,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** wg_window_unittests.h 16 Jul 2004 16:41:35 -0000 1.10 --- wg_window_unittests.h 1 Sep 2004 19:22:02 -0000 1.11 *************** *** 51,63 **** wGui::CWindow* pWindow1 = new wGui::CWindow(wGui::CRect(), 0); ! ensure("CWindow constructor", pWindow1->GetWindowRect() == wGui::CRect()); ! ensure("CWindow constructor", pWindow1->GetAncestor(wGui::CWindow::PARENT) == 0); ! ensure("CWindow constructor", pWindow1->GetBackgroundColor() == wGui::DEFAULT_BACKGROUND_COLOR); ! ensure("CWindow constructor", pWindow1->IsVisible()); wGui::CWindow* pWindow2 = new wGui::CWindow(wGui::CRect(2, 4, 8, 16), pWindow1); ! ensure("CWindow constructor", pWindow2->GetWindowRect() == wGui::CRect(2, 4, 8, 16)); ! ensure("CWindow constructor", pWindow2->GetAncestor(wGui::CWindow::PARENT) == pWindow1); ! ensure("CWindow constructor", pWindow2->GetClientRect() == wGui::CRect(2, 4, 8, 16)); // pWindow2 is a child of pWindow1, so we just need to delete pWindow1 delete pWindow1; --- 51,63 ---- wGui::CWindow* pWindow1 = new wGui::CWindow(wGui::CRect(), 0); ! ensure("CWindow constructor - WindowRect", pWindow1->GetWindowRect() == wGui::CRect()); ! ensure("CWindow constructor - Parent", pWindow1->GetAncestor(wGui::CWindow::PARENT) == 0); ! ensure("CWindow constructor - BGColor", pWindow1->GetBackgroundColor() == wGui::DEFAULT_BACKGROUND_COLOR); ! ensure("CWindow constructor - Visible", pWindow1->IsVisible()); wGui::CWindow* pWindow2 = new wGui::CWindow(wGui::CRect(2, 4, 8, 16), pWindow1); ! ensure("CWindow constructor - WindowRect (2nd)", pWindow2->GetWindowRect() == wGui::CRect(2, 4, 8, 16)); ! ensure("CWindow constructor - Parent (2nd)", pWindow2->GetAncestor(wGui::CWindow::PARENT) == pWindow1); ! ensure("CWindow constructor - ClientRect (2nd)", pWindow2->GetClientRect() == wGui::CRect(0, 0, 6, 12)); // pWindow2 is a child of pWindow1, so we just need to delete pWindow1 delete pWindow1; *************** *** 72,79 **** pWindow1->SetWindowRect(wGui::CRect(3, 4, 5, 6)); ensure("CWindow SetWindowRect - WindowRect", pWindow1->GetWindowRect() == wGui::CRect(3, 4, 5, 6)); ! ensure("CWindow SetWindowRect - ClientRect", pWindow1->GetClientRect() == wGui::CRect(3, 4, 3, 4)); pWindow1->MoveWindow(wGui::CPoint(-1, 1)); ensure("CWindow MoveWindow - WindowRect", pWindow1->GetWindowRect() == wGui::CRect(2, 5, 4, 7)); ! ensure("CWindow MoveWindow - ClientRect", pWindow1->GetClientRect() == wGui::CRect(2, 5, 2, 5)); pWindow1->SetBackgroundColor(wGui::COLOR_YELLOW); ensure("CWindow SetBackgroundColor", pWindow1->GetBackgroundColor() == wGui::COLOR_YELLOW); --- 72,80 ---- pWindow1->SetWindowRect(wGui::CRect(3, 4, 5, 6)); ensure("CWindow SetWindowRect - WindowRect", pWindow1->GetWindowRect() == wGui::CRect(3, 4, 5, 6)); ! // because we scale the size of the Client rect with the Window rect, but we start with zeros, it doesn't really scale in this case ! ensure("CWindow SetWindowRect - ClientRect", pWindow1->GetClientRect() == wGui::CRect()); pWindow1->MoveWindow(wGui::CPoint(-1, 1)); ensure("CWindow MoveWindow - WindowRect", pWindow1->GetWindowRect() == wGui::CRect(2, 5, 4, 7)); ! ensure("CWindow MoveWindow - ClientRect", pWindow1->GetClientRect() == wGui::CRect()); pWindow1->SetBackgroundColor(wGui::COLOR_YELLOW); ensure("CWindow SetBackgroundColor", pWindow1->GetBackgroundColor() == wGui::COLOR_YELLOW); |
|
From: Rob W. <gre...@us...> - 2004-09-01 18:57:41
|
Update of /cvsroot/wgui/wgui/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14753/src Modified Files: wg_editbox.cpp Log Message: Fixed a small bug in the drag selection for edit boxes. Index: wg_editbox.cpp =================================================================== RCS file: /cvsroot/wgui/wgui/src/wg_editbox.cpp,v retrieving revision 1.93 retrieving revision 1.94 diff -C2 -d -r1.93 -r1.94 *** wg_editbox.cpp 22 Jul 2004 21:17:25 -0000 1.93 --- wg_editbox.cpp 1 Sep 2004 18:57:31 -0000 1.94 *************** *** 137,140 **** --- 137,172 ---- + std::string::size_type CEditBox::GetIndexFromPoint(const CPoint& Point) const // virtual + { + CPoint Offset; + std::vector<CRect> CharRects; + m_pRenderedString->GetMetrics(0, &Offset, &CharRects); + CRect SubRect(m_WindowRect.SizeRect()); + SubRect.Grow(-3); + std::string::size_type index = 0; + CPoint BoundedPoint = Point; + if (BoundedPoint.XPos() < SubRect.Left()) { + BoundedPoint.SetX(SubRect.Left()); + } + if (BoundedPoint.XPos() > SubRect.Right()) { + BoundedPoint.SetX(SubRect.Right()); + } + if (!CharRects.empty()) + { + int xDelta = abs(BoundedPoint.XPos() - (CharRects.front().Left() + Offset.XPos() + SubRect.Left())); + for (unsigned int i = 0; i < m_pRenderedString->GetLength(); ++i) + { + if (abs(BoundedPoint.XPos() - (CharRects.at(i).Right() + Offset.XPos() + SubRect.Left() + m_ScrollOffset)) < xDelta) + { + xDelta = abs(BoundedPoint.XPos() - (CharRects.at(i).Right() + Offset.XPos() + SubRect.Left() + m_ScrollOffset)); + index = i + 1; + } + } + } + + return index; + } + + void CEditBox::Draw(void) const { *************** *** 289,312 **** if (!fSkipCursorPositioning) { ! CPoint Offset; ! std::vector<CRect> CharRects; ! m_pRenderedString->GetMetrics(0, &Offset, &CharRects); ! CRect SubRect(m_WindowRect.SizeRect()); ! SubRect.Grow(-3); ! ! m_SelStart = 0; ! if (!CharRects.empty()) ! { ! int xDelta = abs(WindowPoint.XPos() - (CharRects.front().Left() + Offset.XPos() + SubRect.Left())); ! for (unsigned int i = 0; i < m_pRenderedString->GetLength(); ++i) ! { ! if (abs(WindowPoint.XPos() - (CharRects.at(i).Right() + Offset.XPos() + SubRect.Left() + m_ScrollOffset)) < xDelta) ! { ! xDelta = abs(WindowPoint.XPos() - (CharRects.at(i).Right() + Offset.XPos() + SubRect.Left() + m_ScrollOffset)); ! m_SelStart = i + 1; ! } ! } ! } ! m_DragStart = m_SelStart; m_SelLength = 0; --- 321,325 ---- if (!fSkipCursorPositioning) { ! m_SelStart = GetIndexFromPoint(WindowPoint); m_DragStart = m_SelStart; m_SelLength = 0; *************** *** 370,390 **** if (m_bMouseDown) { ! CPoint Offset; ! std::vector<CRect> CharRects; ! m_pRenderedString->GetMetrics(0, &Offset, &CharRects); ! ! std::string::size_type CursorPos = 0; ! if (!CharRects.empty()) ! { ! int xDelta = abs(WindowPoint.XPos() - (CharRects.front().Left() + Offset.XPos() + SubRect.Left() + m_ScrollOffset)); ! for (unsigned int i = 0; i < m_pRenderedString->GetLength(); ++i) ! { ! if (abs(WindowPoint.XPos() - (CharRects.at(i).Right() + Offset.XPos() + SubRect.Left() + m_ScrollOffset)) < xDelta) ! { ! xDelta = abs(WindowPoint.XPos() - (CharRects.at(i).Right() + Offset.XPos() + SubRect.Left() + m_ScrollOffset)); ! CursorPos = i + 1; ! } ! } ! } if (CursorPos < m_DragStart) --- 383,387 ---- if (m_bMouseDown) { ! std::string::size_type CursorPos = GetIndexFromPoint(WindowPoint); if (CursorPos < m_DragStart) |