[Wgui-cvs] wgui/src wg_button.cpp,1.31,1.32 wg_checkbox.cpp,1.18,1.19 wg_dropdown.cpp,1.19,1.20 wg_e
Status: Beta
Brought to you by:
greenwire
|
From: Rob W. <gre...@us...> - 2004-06-25 13:34:29
|
Update of /cvsroot/wgui/wgui/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21468/src Modified Files: wg_button.cpp wg_checkbox.cpp wg_dropdown.cpp wg_editbox.cpp wg_groupbox.cpp wg_label.cpp wg_listbox.cpp wg_menu.cpp wg_scrollbar.cpp wg_textbox.cpp wg_tooltip.cpp wg_view.cpp wg_window.cpp Log Message: Draw architecture changes. Index: wg_view.cpp =================================================================== RCS file: /cvsroot/wgui/wgui/src/wg_view.cpp,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** wg_view.cpp 23 Apr 2004 19:38:47 -0000 1.34 --- wg_view.cpp 25 Jun 2004 13:34:15 -0000 1.35 *************** *** 98,102 **** void CView::SetWindowRect(const CRect& WindowRect ) { ! m_WindowRect = WindowRect; m_ClientRect = CRect(0, 0, m_WindowRect.Width(), m_WindowRect.Height()); --- 98,102 ---- void CView::SetWindowRect(const CRect& WindowRect ) { ! CWindow::SetWindowRect(WindowRect); m_ClientRect = CRect(0, 0, m_WindowRect.Width(), m_WindowRect.Height()); *************** *** 112,120 **** } ! m_pSDLSurface = SDL_SetVideoMode(m_WindowRect.Width(), m_WindowRect.Height(), DEFAULT_BPP, iFlags); ! if (m_pSDLSurface == NULL) throw( Wg_Ex_SDL(std::string("Could not set video mode : ") + SDL_GetError()) ); - - CMessageServer::Instance().QueueMessage(new CMessage(CMessage::APP_PAINT, this, this)); } --- 112,118 ---- } ! m_pScreenSurface = SDL_SetVideoMode(m_WindowRect.Width(), m_WindowRect.Height(), DEFAULT_BPP, iFlags); ! if (m_pScreenSurface == NULL) throw( Wg_Ex_SDL(std::string("Could not set video mode : ") + SDL_GetError()) ); } *************** *** 141,147 **** if (pMessage->Destination() == this || pMessage->Destination() == 0) { ! StartDrawProc(); ! // if this is a broadcasted message, don't mark it as handled ! bHandled = (pMessage->Destination() == this); } break; --- 139,145 ---- if (pMessage->Destination() == this || pMessage->Destination() == 0) { ! PaintToSurface(*m_pScreenSurface, CPoint(0, 0)); ! SDL_UpdateRect(m_pScreenSurface, 0, 0, 0, 0); ! bHandled = true; } break; *************** *** 151,154 **** --- 149,153 ---- if (pResizeMessage && pResizeMessage->Source() == CApplication::Instance()) { + CWindow::SetWindowRect(CRect(m_WindowRect.TopLeft(), m_WindowRect.TopLeft() + pResizeMessage->Value())); Uint32 iFlags = SDL_SWSURFACE | SDL_ANYFORMAT; if(m_bResizable) *************** *** 157,171 **** } - m_WindowRect.SetBottom(m_WindowRect.Top() + pResizeMessage->Value().YPos()); - m_WindowRect.SetRight(m_WindowRect.Left() + pResizeMessage->Value().XPos()); m_ClientRect = CRect(m_ClientRect.Left(), m_ClientRect.Top(), m_WindowRect.Width(), m_WindowRect.Height()); m_ClientRect.ClipTo(m_WindowRect); ! m_pSDLSurface = SDL_SetVideoMode(m_WindowRect.Width(), m_WindowRect.Height(), DEFAULT_BPP, iFlags); ! if (m_pSDLSurface == NULL) throw( Wg_Ex_SDL(std::string("Could not set video mode : ") + SDL_GetError()) ); ! StartDrawProc(); } break; --- 156,168 ---- } m_ClientRect = CRect(m_ClientRect.Left(), m_ClientRect.Top(), m_WindowRect.Width(), m_WindowRect.Height()); m_ClientRect.ClipTo(m_WindowRect); ! m_pScreenSurface = SDL_SetVideoMode(m_WindowRect.Width(), m_WindowRect.Height(), DEFAULT_BPP, iFlags); ! if (m_pScreenSurface == NULL) throw( Wg_Ex_SDL(std::string("Could not set video mode : ") + SDL_GetError()) ); ! bHandled = true; } break; Index: wg_editbox.cpp =================================================================== RCS file: /cvsroot/wgui/wgui/src/wg_editbox.cpp,v retrieving revision 1.84 retrieving revision 1.85 diff -C2 -d -r1.84 -r1.85 *** wg_editbox.cpp 14 Apr 2004 16:21:21 -0000 1.84 --- wg_editbox.cpp 25 Jun 2004 13:34:15 -0000 1.85 *************** *** 74,80 **** CEditBox::~CEditBox(void) // virtual ! { delete m_pCursorTimer; ! delete m_pDblClickTimer; } --- 74,80 ---- CEditBox::~CEditBox(void) // virtual ! { delete m_pCursorTimer; ! delete m_pDblClickTimer; } *************** *** 84,88 **** m_BGColor = bReadOnly ? COLOR_LIGHTGRAY : COLOR_WHITE; m_bReadOnly = bReadOnly; ! StartDrawProc(); } --- 84,88 ---- m_BGColor = bReadOnly ? COLOR_LIGHTGRAY : COLOR_WHITE; m_bReadOnly = bReadOnly; ! Draw(); } *************** *** 140,147 **** CPainter Painter(m_pSDLSurface); ! CRect SubRect(m_WindowRect); SubRect.Grow(-3); ! Painter.DrawRect(m_WindowRect, false, COLOR_BLACK); ! CPoint FontCenterPoint = m_WindowRect.Center(); if (m_bUseMask) --- 140,147 ---- 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) *************** *** 237,241 **** } ! m_pRenderedString->Draw(m_pSDLSurface, SubRect, CPoint(SubRect.Left() + m_ScrollOffset, SubRect.Bottom() - m_pRenderedString->GetMaxFontHeight() / 4), FontColor); } --- 237,241 ---- } ! m_pRenderedString->Draw(m_pSDLSurface, SubRect, CPoint(SubRect.Left() + m_ScrollOffset, SubRect.Bottom() - m_pRenderedString->GetMaxFontHeight() / 4), FontColor); } *************** *** 256,260 **** { bool bResult = false; ! if (! CWindow::OnMouseButtonDown(Point, Button) && m_bVisible && (m_WindowRect.HitTest(Point) == CRect::RELPOS_INSIDE) && (Button == CMouseMessage::LEFT) && !m_bReadOnly) --- 256,260 ---- { bool bResult = false; ! if (! CWindow::OnMouseButtonDown(Point, Button) && m_bVisible && (m_WindowRect.HitTest(Point) == CRect::RELPOS_INSIDE) && (Button == CMouseMessage::LEFT) && !m_bReadOnly) *************** *** 286,290 **** CRect SubRect(m_WindowRect); SubRect.Grow(-3); ! int xDelta = abs(Point.XPos() - (CharRects[0].Left() + Offset.XPos() + SubRect.Left())); m_SelStart = 0; --- 286,290 ---- CRect SubRect(m_WindowRect); SubRect.Grow(-3); ! int xDelta = abs(Point.XPos() - (CharRects[0].Left() + Offset.XPos() + SubRect.Left())); m_SelStart = 0; *************** *** 297,305 **** } } ! m_DragStart = m_SelStart; m_SelLength = 0; m_bMouseDown = true; ! StartDrawProc(); bResult = true; } --- 297,305 ---- } } ! m_DragStart = m_SelStart; m_SelLength = 0; m_bMouseDown = true; ! Draw(); bResult = true; } *************** *** 325,329 **** m_SelStart = 0; m_SelLength = stdex::safe_static_cast<int>(m_sWindowText.length()); ! StartDrawProc(); bHandled = true; } --- 325,329 ---- m_SelStart = 0; m_SelLength = stdex::safe_static_cast<int>(m_sWindowText.length()); ! Draw(); bHandled = true; } *************** *** 382,386 **** } bHandled = true; ! StartDrawProc(); } } --- 382,386 ---- } bHandled = true; ! Draw(); } } *************** *** 394,398 **** { m_bDrawCursor = !m_bDrawCursor; ! StartDrawProc(); } bHandled = true; --- 394,398 ---- { m_bDrawCursor = !m_bDrawCursor; ! Draw(); } bHandled = true; *************** *** 404,408 **** m_pCursorTimer->StartTimer(750, true); m_bDrawCursor = true; ! StartDrawProc(); bHandled = true; } --- 404,408 ---- m_pCursorTimer->StartTimer(750, true); m_bDrawCursor = true; ! Draw(); bHandled = true; } *************** *** 412,416 **** { m_pCursorTimer->StopTimer(); ! StartDrawProc(); bHandled = true; } --- 412,416 ---- { m_pCursorTimer->StopTimer(); ! Draw(); bHandled = true; } *************** *** 617,621 **** m_pRenderedString = pRenderedString; m_bDrawCursor = true; ! StartDrawProc(); } break; --- 617,621 ---- m_pRenderedString = pRenderedString; m_bDrawCursor = true; ! Draw(); } break; Index: wg_checkbox.cpp =================================================================== RCS file: /cvsroot/wgui/wgui/src/wg_checkbox.cpp,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** wg_checkbox.cpp 2 Apr 2004 17:26:16 -0000 1.18 --- wg_checkbox.cpp 25 Jun 2004 13:34:15 -0000 1.19 *************** *** 53,57 **** { m_eCheckBoxState = eState; ! StartDrawProc(); } } --- 53,57 ---- { m_eCheckBoxState = eState; ! Draw(); } } *************** *** 62,69 **** CWindow::Draw(); ! CRect SubRect(m_WindowRect); SubRect.Grow(-1); CPainter Painter(m_pSDLSurface); ! Painter.DrawRect(m_WindowRect, false, COLOR_BLACK); if (m_eCheckBoxState != DISABLED) { --- 62,69 ---- 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) { Index: wg_tooltip.cpp =================================================================== RCS file: /cvsroot/wgui/wgui/src/wg_tooltip.cpp,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** wg_tooltip.cpp 2 Apr 2004 17:26:16 -0000 1.18 --- wg_tooltip.cpp 25 Jun 2004 13:34:15 -0000 1.19 *************** *** 68,72 **** SetWindowRect(m_BoundingRect + DrawPoint); SetVisible(true); ! StartDrawProc(); } --- 68,72 ---- SetWindowRect(m_BoundingRect + DrawPoint); SetVisible(true); ! Draw(); } Index: wg_groupbox.cpp =================================================================== RCS file: /cvsroot/wgui/wgui/src/wg_groupbox.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** wg_groupbox.cpp 2 Apr 2004 17:26:16 -0000 1.13 --- wg_groupbox.cpp 25 Jun 2004 13:34:15 -0000 1.14 *************** *** 64,74 **** CPainter Painter(m_pSDLSurface); ! Painter.DrawRect(CRect(m_WindowRect.Left(), m_WindowRect.Top() + 5, m_WindowRect.Right(), m_WindowRect.Bottom()), false, DEFAULT_LINE_COLOR); CPoint Dims, Offset; m_pRenderedString->GetMetrics(&Dims, &Offset, 0); ! Painter.DrawRect(CRect(m_WindowRect.TopLeft() + CPoint(6, 0), m_WindowRect.TopLeft() + CPoint(14, 0) + Dims), true, m_BGColor, m_BGColor); ! m_pRenderedString->Draw(m_pSDLSurface, m_WindowRect, m_WindowRect.TopLeft() + CPoint(10, 0), m_FontColor); } --- 64,74 ---- CPainter Painter(m_pSDLSurface); ! Painter.DrawRect(CRect(0, 5, m_WindowRect.Width(), m_WindowRect.Height()), 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_BGColor, m_BGColor); ! m_pRenderedString->Draw(m_pSDLSurface, m_WindowRect.SizeRect(), CPoint(10, 0), m_FontColor); } Index: wg_label.cpp =================================================================== RCS file: /cvsroot/wgui/wgui/src/wg_label.cpp,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** wg_label.cpp 2 Apr 2004 17:26:16 -0000 1.17 --- wg_label.cpp 25 Jun 2004 13:34:15 -0000 1.18 *************** *** 60,64 **** CWindow::Draw(); ! m_pRenderedString->Draw(m_pSDLSurface, m_WindowRect, m_WindowRect.BottomLeft(), m_FontColor); } --- 60,64 ---- CWindow::Draw(); ! m_pRenderedString->Draw(m_pSDLSurface, m_WindowRect.SizeRect(), m_WindowRect.SizeRect().BottomLeft(), m_FontColor); } Index: wg_scrollbar.cpp =================================================================== RCS file: /cvsroot/wgui/wgui/src/wg_scrollbar.cpp,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** wg_scrollbar.cpp 27 Apr 2004 18:13:51 -0000 1.32 --- wg_scrollbar.cpp 25 Jun 2004 13:34:15 -0000 1.33 *************** *** 68,72 **** break; } ! m_ThumbRect = GetClientRect(); RepositionThumb(); CMessageServer::Instance().RegisterMessageClient(this, CMessage::MOUSE_BUTTONUP); --- 68,72 ---- break; } ! m_ThumbRect = m_ClientRect; RepositionThumb(); CMessageServer::Instance().RegisterMessageClient(this, CMessage::MOUSE_BUTTONUP); *************** *** 88,92 **** if (bRedraw) { ! StartDrawProc(); } } --- 88,92 ---- if (bRedraw) { ! Draw(); } } *************** *** 224,233 **** { case VERTICAL: ! m_Value = ConstrainValue((pMouseMessage->Point.YPos() - GetClientRect().Top()) * ! (m_MaxLimit - m_MinLimit) / GetClientRect().Height() + m_MinLimit); break; case HORIZONTAL: ! m_Value = ConstrainValue((pMouseMessage->Point.XPos() - GetClientRect().Left()) * ! (m_MaxLimit - m_MinLimit) / GetClientRect().Width() + m_MinLimit); break; default: --- 224,233 ---- { case VERTICAL: ! m_Value = ConstrainValue((pMouseMessage->Point.YPos() - m_ClientRect.Top()) * ! (m_MaxLimit - m_MinLimit) / m_ClientRect.Height() + m_MinLimit); break; case HORIZONTAL: ! m_Value = ConstrainValue((pMouseMessage->Point.XPos() - m_ClientRect.Left()) * ! (m_MaxLimit - m_MinLimit) / m_ClientRect.Width() + m_MinLimit); break; default: *************** *** 239,243 **** CMessageServer::Instance().QueueMessage(new TIntMessage(CMessage::CTRL_VALUECHANGING, m_pParentWindow, this, m_Value)); RepositionThumb(); ! StartDrawProc(); } } --- 239,243 ---- CMessageServer::Instance().QueueMessage(new TIntMessage(CMessage::CTRL_VALUECHANGING, m_pParentWindow, this, m_Value)); RepositionThumb(); ! Draw(); } } *************** *** 279,288 **** case VERTICAL: { ! int iThumbHeight = GetClientRect().Height() / (m_MaxLimit - m_MinLimit + 1); if (iThumbHeight < 10) { iThumbHeight = 10; } ! m_ThumbRect.SetTop(GetClientRect().Top() + (GetClientRect().Height() - iThumbHeight) * (m_Value - m_MinLimit) / (m_MaxLimit - m_MinLimit) - 1); m_ThumbRect.SetBottom(m_ThumbRect.Top() + iThumbHeight); break; --- 279,288 ---- case VERTICAL: { ! int iThumbHeight = m_ClientRect.Height() / (m_MaxLimit - m_MinLimit + 1); if (iThumbHeight < 10) { iThumbHeight = 10; } ! m_ThumbRect.SetTop(m_ClientRect.Top() + (m_ClientRect.Height() - iThumbHeight) * (m_Value - m_MinLimit) / (m_MaxLimit - m_MinLimit) - 1); m_ThumbRect.SetBottom(m_ThumbRect.Top() + iThumbHeight); break; *************** *** 290,299 **** case HORIZONTAL: { ! int iThumbWidth = GetClientRect().Width() / (m_MaxLimit - m_MinLimit + 1); if (iThumbWidth < 10) { iThumbWidth = 10; } ! m_ThumbRect.SetLeft(GetClientRect().Left() + (GetClientRect().Width() - iThumbWidth) * (m_Value - m_MinLimit) / (m_MaxLimit - m_MinLimit) - 1); m_ThumbRect.SetRight(m_ThumbRect.Left() + iThumbWidth); break; --- 290,299 ---- case HORIZONTAL: { ! int iThumbWidth = m_ClientRect.Width() / (m_MaxLimit - m_MinLimit + 1); if (iThumbWidth < 10) { iThumbWidth = 10; } ! m_ThumbRect.SetLeft(m_ClientRect.Left() + (m_ClientRect.Width() - iThumbWidth) * (m_Value - m_MinLimit) / (m_MaxLimit - m_MinLimit) - 1); m_ThumbRect.SetRight(m_ThumbRect.Left() + iThumbWidth); break; Index: wg_menu.cpp =================================================================== RCS file: /cvsroot/wgui/wgui/src/wg_menu.cpp,v retrieving revision 1.45 retrieving revision 1.46 diff -C2 -d -r1.45 -r1.46 *** wg_menu.cpp 13 Apr 2004 15:28:56 -0000 1.45 --- wg_menu.cpp 25 Jun 2004 13:34:15 -0000 1.46 *************** *** 84,88 **** m_MenuItems.erase(m_MenuItems.begin() + iPosition); m_bCachedRectsValid = false; ! StartDrawProc(); } --- 84,88 ---- m_MenuItems.erase(m_MenuItems.begin() + iPosition); m_bCachedRectsValid = false; ! Draw(); } *************** *** 153,157 **** if (pOldHighlight != m_pHighlightedItem) { ! StartDrawProc(); } } --- 153,157 ---- if (pOldHighlight != m_pHighlightedItem) { ! Draw(); } } *************** *** 160,164 **** m_pPopupTimer->StopTimer(); m_pHighlightedItem = 0; ! StartDrawProc(); } break; --- 160,164 ---- m_pPopupTimer->StopTimer(); m_pHighlightedItem = 0; ! Draw(); } break; *************** *** 433,437 **** pView->SetFloatingWindow(this); } ! StartDrawProc(); } --- 433,437 ---- pView->SetFloatingWindow(this); } ! Draw(); } Index: wg_button.cpp =================================================================== RCS file: /cvsroot/wgui/wgui/src/wg_button.cpp,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** wg_button.cpp 2 Apr 2004 17:26:16 -0000 1.31 --- wg_button.cpp 25 Jun 2004 13:34:15 -0000 1.32 *************** *** 53,56 **** --- 53,57 ---- m_BGColor = CApplication::Instance()->GetDefaultFGColor(); CMessageServer::Instance().RegisterMessageClient(this, CMessage::MOUSE_BUTTONUP); + Draw(); } *************** *** 67,71 **** { m_eButtonState = eState; ! StartDrawProc(); } } --- 68,72 ---- { m_eButtonState = eState; ! Draw(); } } *************** *** 76,84 **** CWindow::Draw(); ! CPoint FontCenterPoint = m_WindowRect.Center(); ! CRect SubRect(m_WindowRect); SubRect.Grow(-1); CPainter Painter(m_pSDLSurface); ! Painter.DrawRect(m_WindowRect, false, COLOR_BLACK); CRGBColor FontColor = DEFAULT_LINE_COLOR; switch (m_eButtonState) --- 77,85 ---- 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) *************** *** 220,224 **** std::auto_ptr<CBitmapResourceHandle> phBitmap(new CBitmapResourceHandle(hBitmap)); m_phBitmap = phBitmap; ! StartDrawProc(); } --- 221,225 ---- std::auto_ptr<CBitmapResourceHandle> phBitmap(new CBitmapResourceHandle(hBitmap)); m_phBitmap = phBitmap; ! Draw(); } Index: wg_dropdown.cpp =================================================================== RCS file: /cvsroot/wgui/wgui/src/wg_dropdown.cpp,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** wg_dropdown.cpp 13 Apr 2004 15:28:56 -0000 1.19 --- wg_dropdown.cpp 25 Jun 2004 13:34:15 -0000 1.20 *************** *** 165,169 **** m_pListBox->SetNewParent(m_pListBox->GetAncestor(PARENT)); m_pListBox->SetVisible(true); - m_pListBox->StartDrawProc(); } } --- 165,168 ---- *************** *** 180,184 **** pView->SetFloatingWindow(0); } - CMessageServer::Instance().QueueMessage(new CMessage(CMessage::APP_PAINT, 0, this)); } } --- 179,182 ---- Index: wg_window.cpp =================================================================== RCS file: /cvsroot/wgui/wgui/src/wg_window.cpp,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** wg_window.cpp 13 Apr 2004 15:28:56 -0000 1.41 --- wg_window.cpp 25 Jun 2004 13:34:15 -0000 1.42 *************** *** 40,52 **** CWindow::CWindow(const CRect& WindowRect, CWindow* pParent) : m_sWindowText(""), - m_WindowRect(WindowRect), m_BGColor(DEFAULT_BG_COLOR), m_ClientRect(0, 0, WindowRect.Width() - 1, WindowRect.Height() - 1), m_pParentWindow(0), m_pSDLSurface(0), ! m_bVisible(true) ! { ! ! if (!CApplication::Instance()) { --- 40,50 ---- CWindow::CWindow(const CRect& WindowRect, CWindow* pParent) : m_sWindowText(""), m_BGColor(DEFAULT_BG_COLOR), m_ClientRect(0, 0, WindowRect.Width() - 1, WindowRect.Height() - 1), m_pParentWindow(0), m_pSDLSurface(0), ! m_bVisible(true), ! m_bDrawCompleted(false) ! { if (!CApplication::Instance()) { *************** *** 54,60 **** } m_BGColor = CApplication::Instance()->GetDefaultBGColor(); SetNewParent(pParent); - CMessageServer::Instance().RegisterMessageClient(this, CMessage::APP_PAINT); } --- 52,58 ---- } + SetWindowRect(WindowRect); m_BGColor = CApplication::Instance()->GetDefaultBGColor(); SetNewParent(pParent); } *************** *** 65,68 **** --- 63,68 ---- CMessageServer::Instance().DeregisterMessageClient(this); + if (m_pSDLSurface) + SDL_FreeSurface(m_pSDLSurface); while (m_ChildWindows.size() > 0) { *************** *** 77,81 **** { m_WindowRect = WindowRect; ! CMessageServer::Instance().QueueMessage(new CMessage(CMessage::APP_PAINT, GetAncestor(PARENT), this)); } --- 77,84 ---- { 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); ! Draw(); // we need to redraw here because we've got a new empty buffer } *************** *** 88,92 **** (*iter)->MoveWindow(MoveDistance); } ! CMessageServer::Instance().QueueMessage(new CMessage(CMessage::APP_PAINT, GetAncestor(PARENT), this)); } --- 91,95 ---- (*iter)->MoveWindow(MoveDistance); } ! CMessageServer::Instance().QueueMessage(new CMessage(CMessage::APP_PAINT, 0, this)); } *************** *** 129,134 **** ! CView* CWindow::GetView(void) const // virtual ! { return dynamic_cast<CView*>(GetAncestor(ROOT)); } --- 132,137 ---- ! CView* CWindow::GetView(void) const // virtual ! { return dynamic_cast<CView*>(GetAncestor(ROOT)); } *************** *** 171,182 **** { m_sWindowText = sText; ! StartDrawProc(); ! } ! ! ! void CWindow::DrawBG(void) const ! { ! CPainter Painter(m_pSDLSurface); ! Painter.DrawRect(m_WindowRect, true, m_BGColor, m_BGColor); } --- 174,178 ---- { m_sWindowText = sText; ! Draw(); } *************** *** 184,218 **** void CWindow::Draw(void) const { ! } ! void CWindow::DrawChildren(void) const { ! for (std::list<CWindow*>::const_iterator iter = m_ChildWindows.begin(); iter != m_ChildWindows.end(); ++iter) { ! (*iter)->DrawProc(); } - } - - - void CWindow::DrawPostChild(void) const - { - - } - - - void CWindow::DrawProc(void) const - { if (m_bVisible) { ! DrawBG(); ! Draw(); ! DrawChildren(); ! DrawPostChild(); ! CView* pView = GetView(); ! if (pView && pView->GetFloatingWindow() && m_WindowRect.Overlaps(pView->GetFloatingWindow()->GetWindowRect())) { ! CMessageServer::Instance().QueueMessage(new CMessage(CMessage::APP_PAINT, pView->GetFloatingWindow(), this)); } } --- 180,205 ---- void CWindow::Draw(void) const { ! CPainter Painter(m_pSDLSurface); ! Painter.DrawRect(m_WindowRect.SizeRect(), true, m_BGColor, m_BGColor); ! CMessageServer::Instance().QueueMessage(new CMessage(CMessage::APP_PAINT, 0, this)); ! m_bDrawCompleted = true; } ! void CWindow::PaintToSurface(SDL_Surface& Surface, const CPoint& Offset) const { ! if (!m_bDrawCompleted) { ! Draw(); } if (m_bVisible) { ! SDL_Rect SourceRect = CRect(m_WindowRect.SizeRect()).SDLRect(); ! SDL_Rect DestRect = CRect(m_WindowRect + Offset).SDLRect(); ! SDL_BlitSurface(m_pSDLSurface, &SourceRect, &Surface, &DestRect); ! CPoint NewOffset = m_ClientRect.TopLeft() + m_WindowRect.TopLeft() + Offset; ! for (std::list<CWindow*>::const_iterator iter = m_ChildWindows.begin(); iter != m_ChildWindows.end(); ++iter) { ! (*iter)->PaintToSurface(Surface, NewOffset); } } *************** *** 220,233 **** - void CWindow::StartDrawProc(void) const - { - if (m_bVisible) - { - DrawProc(); - SDL_UpdateRect(m_pSDLSurface, m_WindowRect.Left(), m_WindowRect.Top(), m_WindowRect.Width(), m_WindowRect.Height()); - } - } - - void CWindow::SetNewParent(CWindow* pNewParent) { --- 207,210 ---- *************** *** 239,243 **** { pNewParent->RegisterChildWindow(this); - m_pSDLSurface = pNewParent->GetAncestor(ROOT)->m_pSDLSurface; } m_pParentWindow = pNewParent; --- 216,219 ---- *************** *** 297,320 **** ! bool CWindow::HandleMessage(CMessage* pMessage) { bool bHandled = false; - if (pMessage) - { - switch(pMessage->MessageType()) - { - case CMessage::APP_PAINT : - if (pMessage->Destination() == this) - { - StartDrawProc(); - bHandled = true; - } - break; - default : - break; - } - } - return bHandled; } --- 273,280 ---- ! bool CWindow::HandleMessage(CMessage* /*pMessage*/) { bool bHandled = false; return bHandled; } Index: wg_listbox.cpp =================================================================== RCS file: /cvsroot/wgui/wgui/src/wg_listbox.cpp,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** wg_listbox.cpp 27 Apr 2004 18:13:51 -0000 1.37 --- wg_listbox.cpp 25 Jun 2004 13:34:15 -0000 1.38 *************** *** 72,76 **** { m_iItemHeight = iItemHeight; ! StartDrawProc(); } --- 72,76 ---- { m_iItemHeight = iItemHeight; ! Draw(); } *************** *** 83,87 **** int iMax = (m_Items.size() - 1) < 0 ? 0 : stdex::safe_static_cast<int>(m_Items.size() - 1); m_pVScrollbar->SetMaxLimit(iMax); ! StartDrawProc(); return stdex::safe_static_cast<int>(m_Items.size()); } --- 83,87 ---- int iMax = (m_Items.size() - 1) < 0 ? 0 : stdex::safe_static_cast<int>(m_Items.size() - 1); m_pVScrollbar->SetMaxLimit(iMax); ! Draw(); return stdex::safe_static_cast<int>(m_Items.size()); } *************** *** 96,100 **** int iMax = (m_Items.size() - 1) < 0 ? 0 : stdex::safe_static_cast<int>(m_Items.size() - 1); m_pVScrollbar->SetMaxLimit(iMax); ! StartDrawProc(); } } --- 96,100 ---- int iMax = (m_Items.size() - 1) < 0 ? 0 : stdex::safe_static_cast<int>(m_Items.size() - 1); m_pVScrollbar->SetMaxLimit(iMax); ! Draw(); } } *************** *** 106,110 **** m_SelectedItems.clear(); m_pVScrollbar->SetMaxLimit(0); ! StartDrawProc(); } --- 106,110 ---- m_SelectedItems.clear(); m_pVScrollbar->SetMaxLimit(0); ! Draw(); } *************** *** 131,135 **** CPainter Painter(m_pSDLSurface); ! Painter.DrawRect(m_WindowRect, false, COLOR_BLACK); CRect ClientRect(GetClientRect()); int iStartIndex = m_pVScrollbar->GetValue(); --- 131,135 ---- CPainter Painter(m_pSDLSurface); ! Painter.DrawRect(m_WindowRect.SizeRect(), false, COLOR_BLACK); CRect ClientRect(GetClientRect()); int iStartIndex = m_pVScrollbar->GetValue(); *************** *** 186,190 **** // Prep the new selection m_iFocusedItem = (Point.YPos() - ClientRect.Top()) / m_iItemHeight + m_pVScrollbar->GetValue(); ! StartDrawProc(); } bResult = true; --- 186,190 ---- // Prep the new selection m_iFocusedItem = (Point.YPos() - ClientRect.Top()) / m_iItemHeight + m_pVScrollbar->GetValue(); ! Draw(); } bResult = true; *************** *** 216,220 **** } CMessageServer::Instance().QueueMessage(new TIntMessage(CMessage::CTRL_VALUECHANGE, pDestination, this, m_iFocusedItem)); ! StartDrawProc(); } bResult = true; --- 216,220 ---- } CMessageServer::Instance().QueueMessage(new TIntMessage(CMessage::CTRL_VALUECHANGE, pDestination, this, m_iFocusedItem)); ! Draw(); } bResult = true; *************** *** 252,256 **** } ! StartDrawProc(); bHandled = true; } --- 252,256 ---- } ! Draw(); bHandled = true; } *************** *** 266,270 **** m_pVScrollbar->SetValue(m_pVScrollbar->GetValue() - 1); } ! StartDrawProc(); bHandled = true; } --- 266,270 ---- m_pVScrollbar->SetValue(m_pVScrollbar->GetValue() - 1); } ! Draw(); bHandled = true; } *************** *** 285,289 **** } m_pVScrollbar->SetValue(m_iFocusedItem); ! StartDrawProc(); bHandled=true; break; --- 285,289 ---- } m_pVScrollbar->SetValue(m_iFocusedItem); ! Draw(); bHandled=true; break; *************** *** 302,306 **** } m_pVScrollbar->SetValue(m_iFocusedItem); ! StartDrawProc(); bHandled=true; break; --- 302,306 ---- } m_pVScrollbar->SetValue(m_iFocusedItem); ! Draw(); bHandled=true; break; *************** *** 311,315 **** { SetSelection(m_iFocusedItem, !IsSelected(m_iFocusedItem)); ! StartDrawProc(); } bHandled = true; --- 311,315 ---- { SetSelection(m_iFocusedItem, !IsSelected(m_iFocusedItem)); ! Draw(); } bHandled = true; *************** *** 330,334 **** if (pMessage->Source() == m_pVScrollbar) { ! StartDrawProc(); bHandled = true; } --- 330,334 ---- if (pMessage->Source() == m_pVScrollbar) { ! Draw(); bHandled = true; } Index: wg_textbox.cpp =================================================================== RCS file: /cvsroot/wgui/wgui/src/wg_textbox.cpp,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** wg_textbox.cpp 5 May 2004 14:52:35 -0000 1.19 --- wg_textbox.cpp 25 Jun 2004 13:34:15 -0000 1.20 *************** *** 101,105 **** m_BGColor = bReadOnly ? COLOR_LIGHTGRAY : COLOR_WHITE; m_bReadOnly = bReadOnly; ! StartDrawProc(); } --- 101,105 ---- m_BGColor = bReadOnly ? COLOR_LIGHTGRAY : COLOR_WHITE; m_bReadOnly = bReadOnly; ! Draw(); } *************** *** 157,163 **** CPainter Painter(m_pSDLSurface); ! Painter.DrawRect(m_WindowRect, false, COLOR_BLACK); CPoint FontCenterPoint = m_WindowRect.Center(); ! CRect TextRect(GetClientRect()); CRGBColor FontColor = m_bReadOnly ? DEFAULT_DISABLED_LINE_COLOR : DEFAULT_LINE_COLOR; --- 157,163 ---- CPainter Painter(m_pSDLSurface); ! Painter.DrawRect(m_WindowRect.SizeRect(), false, COLOR_BLACK); CPoint FontCenterPoint = m_WindowRect.Center(); ! CRect TextRect(m_ClientRect); CRGBColor FontColor = m_bReadOnly ? DEFAULT_DISABLED_LINE_COLOR : DEFAULT_LINE_COLOR; *************** *** 349,353 **** m_SelLength = 0; m_bMouseDown = true; ! StartDrawProc(); bResult = true; } --- 349,353 ---- m_SelLength = 0; m_bMouseDown = true; ! Draw(); bResult = true; } *************** *** 383,387 **** m_SelStart = 0; m_SelLength = stdex::safe_static_cast<int>(m_sWindowText.length()); ! StartDrawProc(); bHandled = true; } --- 383,387 ---- m_SelStart = 0; m_SelLength = stdex::safe_static_cast<int>(m_sWindowText.length()); ! Draw(); bHandled = true; } *************** *** 470,474 **** } bHandled = true; ! StartDrawProc(); } } --- 470,474 ---- } bHandled = true; ! Draw(); } } *************** *** 480,484 **** //This redraws the whole control each time we want to show/not show the cursor, that's probably a bad idea. m_bDrawCursor = !m_bDrawCursor; ! StartDrawProc(); bHandled = true; } --- 480,484 ---- //This redraws the whole control each time we want to show/not show the cursor, that's probably a bad idea. m_bDrawCursor = !m_bDrawCursor; ! Draw(); bHandled = true; } *************** *** 489,493 **** m_pCursorTimer->StartTimer(750, true); m_bDrawCursor = true; ! StartDrawProc(); bHandled = true; } --- 489,493 ---- m_pCursorTimer->StartTimer(750, true); m_bDrawCursor = true; ! Draw(); bHandled = true; } *************** *** 497,501 **** { m_pCursorTimer->StopTimer(); ! StartDrawProc(); bHandled = true; } --- 497,501 ---- { m_pCursorTimer->StopTimer(); ! Draw(); bHandled = true; } *************** *** 777,781 **** m_bDrawCursor = true; m_bScrollToCursor = true; // a key was pressed, so we need to make sure that the cursor is visible ! StartDrawProc(); } break; --- 777,781 ---- m_bDrawCursor = true; m_bScrollToCursor = true; // a key was pressed, so we need to make sure that the cursor is visible ! Draw(); } break; *************** *** 786,790 **** if (pMessage->Source() == m_pVerticalScrollBar || pMessage->Source() == m_pHorizontalScrollBar) { ! StartDrawProc(); bHandled = true; } --- 786,790 ---- if (pMessage->Source() == m_pVerticalScrollBar || pMessage->Source() == m_pHorizontalScrollBar) { ! Draw(); bHandled = true; } |