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
This commit is contained in:
Karsten Ballüder
1998-07-29 13:57:51 +00:00
parent cf4219e77a
commit 82ab121507
4 changed files with 26 additions and 15 deletions

View File

@@ -69,6 +69,7 @@ IMPLEMENT_DYNAMIC_CLASS( MyFrame, wxFrame )
m_lwin = new wxLayoutWindow(this); m_lwin = new wxLayoutWindow(this);
m_lwin->SetEventId(ID_CLICK); m_lwin->SetEventId(ID_CLICK);
m_lwin->GetLayoutList().SetEditable(true); m_lwin->GetLayoutList().SetEditable(true);
m_lwin->Clear(wxROMAN,16,wxNORMAL,wxNORMAL, false);
m_lwin->SetFocus(); m_lwin->SetFocus();
}; };
@@ -76,8 +77,6 @@ void
MyFrame::AddSampleText(wxLayoutList &llist) MyFrame::AddSampleText(wxLayoutList &llist)
{ {
llist.Clear(wxROMAN,16,wxNORMAL,wxNORMAL, false);
llist.Insert("The quick brown fox jumps over the lazy dog."); llist.Insert("The quick brown fox jumps over the lazy dog.");
llist.LineBreak(); llist.LineBreak();
llist.Insert("Hello "); llist.Insert("Hello ");
@@ -114,8 +113,8 @@ MyFrame::AddSampleText(wxLayoutList &llist)
llist.Insert("blue"); llist.Insert("blue");
llist.SetFont(-1,-1,-1,-1,-1,"black"); llist.SetFont(-1,-1,-1,-1,-1,"black");
llist.Insert(" and "); llist.Insert(" and ");
llist.SetFont(-1,-1,-1,-1,-1,"red","black"); llist.SetFont(-1,-1,-1,-1,-1,"green","black");
llist.Insert("red on black"); llist.Insert("green on black");
llist.SetFont(-1,-1,-1,-1,-1,"black","white"); llist.SetFont(-1,-1,-1,-1,-1,"black","white");
llist.Insert(" text."); llist.Insert(" text.");
llist.LineBreak(); llist.LineBreak();

View File

@@ -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? //FIXME: who frees the brush, how long does it need to exist?
if(m_DefaultSetting) if(m_DefaultSetting)
{
m_DefaultSetting->Draw(dc,wxPoint(0,0),0,true); 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 // we calculate everything for drawing a line, then rewind to the
// begin of line and actually draw it // begin of line and actually draw it
i = begin(); i = begin();

View File

@@ -246,6 +246,9 @@ public:
void Clear(int family = wxROMAN, int size=12, int style=wxNORMAL, int weight=wxNORMAL, 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"); 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: protected:
/// font parameters: /// font parameters:

View File

@@ -16,6 +16,10 @@
#include "wxllist.h" #include "wxllist.h"
#ifdef BROKEN_COMPILER
# define virtual
#endif
class wxLayoutWindow : public wxScrolledWindow class wxLayoutWindow : public wxScrolledWindow
{ {
public: public:
@@ -23,10 +27,19 @@ public:
wxLayoutList & GetLayoutList(void) { return m_llist; } 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); //virtual void OnDraw(wxDC &dc);
void OnPaint(wxPaintEvent &WXUNUSED(event)); void OnPaint(wxPaintEvent &WXUNUSED(event));
/*virtual*/ void OnMouse(wxMouseEvent& event); virtual void OnMouse(wxMouseEvent& event);
/*virtual*/ void OnChar(wxKeyEvent& event); virtual void OnChar(wxKeyEvent& event);
void UpdateScrollbars(void); void UpdateScrollbars(void);
void Print(void); void Print(void);
void Erase(void) void Erase(void)
@@ -34,6 +47,7 @@ public:
void SetEventId(int id) { m_EventId = id; } void SetEventId(int id) { m_EventId = id; }
wxPoint const &GetClickPosition(void) const { return wxPoint const &GetClickPosition(void) const { return
m_ClickPosition; } m_ClickPosition; }
virtual ~wxLayoutList() {} ;
private: private:
/// for sending events /// for sending events
wxWindow *m_Parent; wxWindow *m_Parent;
@@ -49,4 +63,8 @@ private:
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };
#ifdef BROKEN_COMPILER
#undef virtual
#endif
#endif #endif