[Wgui-cvs] wgui/src wg_dropdown.cpp,1.22,1.23 wg_groupbox.cpp,1.16,1.17 wg_scrollbar.cpp,1.37,1.38 w
Status: Beta
Brought to you by:
greenwire
|
From: Rob W. <gre...@us...> - 2004-07-01 17:00:59
|
Update of /cvsroot/wgui/wgui/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2601/src Modified Files: wg_dropdown.cpp wg_groupbox.cpp wg_scrollbar.cpp wg_window.cpp Log Message: Draw architecture changes. Index: wg_dropdown.cpp =================================================================== RCS file: /cvsroot/wgui/wgui/src/wg_dropdown.cpp,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** wg_dropdown.cpp 30 Jun 2004 22:31:01 -0000 1.22 --- wg_dropdown.cpp 1 Jul 2004 17:00:34 -0000 1.23 *************** *** 47,51 **** // We create the listbox with the root window (probably a CView object) as it's parent, so that it gets the OnMouseButtonDown/Up properly m_pListBox = new CListBox( ! ClientToView(CRect(m_WindowRect.BottomLeft(), CPoint(m_WindowRect.Right(), m_WindowRect.Bottom() + iItemHeight * 5 + 1))), GetAncestor(ROOT), true, iItemHeight, pFontEngine); m_pListBox->SetVisible(false); --- 47,51 ---- // We create the listbox with the root window (probably a CView object) as it's parent, so that it gets the OnMouseButtonDown/Up properly m_pListBox = new CListBox( ! ClientToView(CRect(0, m_WindowRect.Height(), m_WindowRect.Width(), m_WindowRect.Height() + iItemHeight * 5 + 1)), GetAncestor(ROOT), true, iItemHeight, pFontEngine); m_pListBox->SetVisible(false); *************** *** 69,72 **** --- 69,82 ---- + void CDropDown::SetWindowRect(const CRect& WindowRect) + { + CWindow::SetWindowRect(WindowRect); + m_pListBox->SetWindowRect(ClientToView( + CRect(0, m_WindowRect.Height(), m_WindowRect.Width(), m_WindowRect.Height() + m_pListBox->GetItemHeight() * 5 + 1))); + m_pDropButton->SetWindowRect(CRect(m_WindowRect.Width() - m_WindowRect.Height() + 1, 0, m_WindowRect.Width(), m_WindowRect.Height())); + m_pEditBox->SetWindowRect(CRect(0, 0, m_WindowRect.Width() - m_WindowRect.Height(), m_WindowRect.Height())); + } + + void CDropDown::SetWindowText(std::string sWindowText) { *************** *** 74,77 **** --- 84,88 ---- } + std::string CDropDown::GetWindowText() { *************** *** 79,82 **** --- 90,101 ---- } + + void CDropDown::MoveWindow(const CPoint& MoveDistance) + { + CWindow::MoveWindow(MoveDistance); + m_pListBox->MoveWindow(MoveDistance); + } + + bool CDropDown::HandleMessage(CMessage* pMessage) { Index: wg_window.cpp =================================================================== RCS file: /cvsroot/wgui/wgui/src/wg_window.cpp,v retrieving revision 1.45 retrieving revision 1.46 diff -C2 -d -r1.45 -r1.46 *** wg_window.cpp 30 Jun 2004 22:31:02 -0000 1.45 --- wg_window.cpp 1 Jul 2004 17:00:35 -0000 1.46 *************** *** 75,83 **** void CWindow::SetWindowRect(const CRect& WindowRect) { m_WindowRect = WindowRect; if (m_pSDLSurface) SDL_FreeSurface(m_pSDLSurface); ! m_pSDLSurface = SDL_CreateRGBSurface(SDL_SWSURFACE, m_WindowRect.Width(), m_WindowRect.Height(), 32, 0x000000FF, 0x0000FF00, 0x00FF0000, /*0xFF000000*/ 0); ! Draw(); // we need to redraw here because we've got a new empty buffer } --- 75,88 ---- void CWindow::SetWindowRect(const CRect& WindowRect) { + double dHorizontalScale = m_WindowRect.Width() != 0 ? static_cast<double>(WindowRect.Width()) / m_WindowRect.Width() : 0; + double dVerticalScale = m_WindowRect.Height() != 0 ? static_cast<double>(WindowRect.Height()) / m_WindowRect.Height() : 0; m_WindowRect = WindowRect; if (m_pSDLSurface) SDL_FreeSurface(m_pSDLSurface); ! m_pSDLSurface = SDL_CreateRGBSurface(SDL_SWSURFACE, m_WindowRect.Width(), m_WindowRect.Height(), ! 32, 0x000000FF, 0x0000FF00, 0x00FF0000, /*0xFF000000*/ 0); ! m_ClientRect = CRect(stdex::safe_static_cast<int>(m_ClientRect.Left() * dHorizontalScale), stdex::safe_static_cast<int>(m_ClientRect.Top() * dVerticalScale), ! stdex::safe_static_cast<int>(m_ClientRect.Right() * dHorizontalScale), stdex::safe_static_cast<int>(m_ClientRect.Bottom() * dVerticalScale)); ! Draw(); // we need to redraw here because we've got a new buffer } *************** *** 86,93 **** { m_WindowRect = m_WindowRect + MoveDistance; - for (std::list<CWindow*>::iterator iter = m_ChildWindows.begin(); iter != m_ChildWindows.end(); ++iter) - { - (*iter)->MoveWindow(MoveDistance); - } CMessageServer::Instance().QueueMessage(new CMessage(CMessage::APP_PAINT, 0, this)); } --- 91,94 ---- Index: wg_scrollbar.cpp =================================================================== RCS file: /cvsroot/wgui/wgui/src/wg_scrollbar.cpp,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** wg_scrollbar.cpp 30 Jun 2004 22:31:01 -0000 1.37 --- wg_scrollbar.cpp 1 Jul 2004 17:00:35 -0000 1.38 *************** *** 147,151 **** if (! CWindow::OnMouseButtonDown(Point, Button) && m_bVisible && ! m_WindowRect.SizeRect().HitTest(ViewToClient(Point)) == CRect::RELPOS_INSIDE) { if (Button == CMouseMessage::WHEELUP) --- 147,151 ---- if (! CWindow::OnMouseButtonDown(Point, Button) && m_bVisible && ! m_ClientRect.SizeRect().HitTest(ViewToClient(Point)) == CRect::RELPOS_INSIDE) { if (Button == CMouseMessage::WHEELUP) *************** *** 161,165 **** else if (Button == CMouseMessage::LEFT) { ! switch (m_ThumbRect.HitTest(Point)) { case CRect::RELPOS_INSIDE: --- 161,165 ---- else if (Button == CMouseMessage::LEFT) { ! switch (m_ThumbRect.HitTest(ViewToClient(Point))) { case CRect::RELPOS_INSIDE: Index: wg_groupbox.cpp =================================================================== RCS file: /cvsroot/wgui/wgui/src/wg_groupbox.cpp,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** wg_groupbox.cpp 30 Jun 2004 22:31:01 -0000 1.16 --- wg_groupbox.cpp 1 Jul 2004 17:00:35 -0000 1.17 *************** *** 65,69 **** CPainter Painter(m_pSDLSurface); ! Painter.DrawRect(CRect(0, 5, m_WindowRect.Width(), m_WindowRect.Height()), false, DEFAULT_LINE_COLOR); CPoint Dims, Offset; --- 65,69 ---- CPainter Painter(m_pSDLSurface); ! Painter.DrawRect(CRect(0, 5, m_WindowRect.Width() - 1, m_WindowRect.Height() - 5), false, DEFAULT_LINE_COLOR); CPoint Dims, Offset; |