From 82ab1215070a84414f4e6a8f8ebe9bdecdd176f5 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Karsten=20Ball=C3=BCder?= Date: Wed, 29 Jul 1998 13:57:51 +0000 Subject: [PATCH] Setting of background colours is now correct. Made virtual declarations depend on BROKEN_COMPILER define. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@400 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- user/wxLayout/wxLayout.cpp | 7 +++---- user/wxLayout/wxllist.cpp | 9 --------- user/wxLayout/wxllist.h | 3 +++ user/wxLayout/wxlwindow.h | 22 ++++++++++++++++++++-- 4 files changed, 26 insertions(+), 15 deletions(-) diff --git a/user/wxLayout/wxLayout.cpp b/user/wxLayout/wxLayout.cpp index 87387fc68b..94604e6f5d 100644 --- a/user/wxLayout/wxLayout.cpp +++ b/user/wxLayout/wxLayout.cpp @@ -69,6 +69,7 @@ IMPLEMENT_DYNAMIC_CLASS( MyFrame, wxFrame ) m_lwin = new wxLayoutWindow(this); m_lwin->SetEventId(ID_CLICK); m_lwin->GetLayoutList().SetEditable(true); + m_lwin->Clear(wxROMAN,16,wxNORMAL,wxNORMAL, false); m_lwin->SetFocus(); }; @@ -76,8 +77,6 @@ void MyFrame::AddSampleText(wxLayoutList &llist) { - llist.Clear(wxROMAN,16,wxNORMAL,wxNORMAL, false); - llist.Insert("The quick brown fox jumps over the lazy dog."); llist.LineBreak(); llist.Insert("Hello "); @@ -114,8 +113,8 @@ MyFrame::AddSampleText(wxLayoutList &llist) llist.Insert("blue"); llist.SetFont(-1,-1,-1,-1,-1,"black"); llist.Insert(" and "); - llist.SetFont(-1,-1,-1,-1,-1,"red","black"); - llist.Insert("red on black"); + llist.SetFont(-1,-1,-1,-1,-1,"green","black"); + llist.Insert("green on black"); llist.SetFont(-1,-1,-1,-1,-1,"black","white"); llist.Insert(" text."); llist.LineBreak(); diff --git a/user/wxLayout/wxllist.cpp b/user/wxLayout/wxllist.cpp index 6303a07005..214dba5232 100644 --- a/user/wxLayout/wxllist.cpp +++ b/user/wxLayout/wxllist.cpp @@ -329,17 +329,8 @@ wxLayoutList::Draw(wxDC &dc, bool findObject, wxPoint const &findCoords) //FIXME: who frees the brush, how long does it need to exist? if(m_DefaultSetting) - { m_DefaultSetting->Draw(dc,wxPoint(0,0),0,true); - dc.SetBackground( wxBrush(* m_DefaultSetting->GetBGColour(),wxSOLID)); - } - else - dc.SetBackground( wxBrush(wxColour("White"), wxSOLID) ); - dc.Clear(); - - - // we calculate everything for drawing a line, then rewind to the // begin of line and actually draw it i = begin(); diff --git a/user/wxLayout/wxllist.h b/user/wxLayout/wxllist.h index f8242f3f06..d4744a77ba 100644 --- a/user/wxLayout/wxllist.h +++ b/user/wxLayout/wxllist.h @@ -246,6 +246,9 @@ public: void Clear(int family = wxROMAN, int size=12, int style=wxNORMAL, int weight=wxNORMAL, int underline=0, char const *fg="black", char const *bg="white"); + /// return a pointer to the default settings: + wxLayoutObjectCmd const *GetDefaults(void) const { return m_DefaultSetting ; } + //@} protected: /// font parameters: diff --git a/user/wxLayout/wxlwindow.h b/user/wxLayout/wxlwindow.h index 86a487fc64..3170c6537a 100644 --- a/user/wxLayout/wxlwindow.h +++ b/user/wxLayout/wxlwindow.h @@ -16,6 +16,10 @@ #include "wxllist.h" +#ifdef BROKEN_COMPILER +# define virtual +#endif + class wxLayoutWindow : public wxScrolledWindow { public: @@ -23,10 +27,19 @@ public: wxLayoutList & GetLayoutList(void) { return m_llist; } + // clears the window and sets default parameters: + void Clear(int family = wxROMAN, int size=12, int style=wxNORMAL, int weight=wxNORMAL, + int underline=0, char const *fg="black", char const + *bg="white") + { + GetLayoutList().Clear(family,size,style,weight,underline,fg,bg); + SetBackgroundColour( *GetLayoutList().GetDefaults()->GetBGColour()); + } + //virtual void OnDraw(wxDC &dc); void OnPaint(wxPaintEvent &WXUNUSED(event)); - /*virtual*/ void OnMouse(wxMouseEvent& event); - /*virtual*/ void OnChar(wxKeyEvent& event); + virtual void OnMouse(wxMouseEvent& event); + virtual void OnChar(wxKeyEvent& event); void UpdateScrollbars(void); void Print(void); void Erase(void) @@ -34,6 +47,7 @@ public: void SetEventId(int id) { m_EventId = id; } wxPoint const &GetClickPosition(void) const { return m_ClickPosition; } + virtual ~wxLayoutList() {} ; private: /// for sending events wxWindow *m_Parent; @@ -49,4 +63,8 @@ private: DECLARE_EVENT_TABLE() }; +#ifdef BROKEN_COMPILER +#undef virtual +#endif + #endif -- 2.45.2