[Wgui-cvs] wgui/src wg_messagebox.cpp,1.4,1.5
Status: Beta
Brought to you by:
greenwire
|
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) |