added tests for setting fg/bg colour

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@14328 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2002-02-20 17:41:39 +00:00
parent 5c7766de90
commit d88a24858a
2 changed files with 27 additions and 3 deletions

View File

@ -26,6 +26,7 @@
#ifndef WX_PRECOMP
#include "wx/wx.h"
#include "wx/colordlg.h"
#endif
#include "wx/log.h"
@ -62,10 +63,11 @@
return; \
}
#define MENU_LINK(name) EVT_MENU(TreeTest_##name, MyFrame::On##name)
BEGIN_EVENT_TABLE(MyFrame, wxFrame)
EVT_SIZE(MyFrame::OnSize)
#define MENU_LINK(name) EVT_MENU(TreeTest_##name, MyFrame::On##name)
MENU_LINK(Quit)
MENU_LINK(About)
MENU_LINK(TogButtons)
@ -76,6 +78,8 @@ BEGIN_EVENT_TABLE(MyFrame, wxFrame)
MENU_LINK(TogRootLines)
MENU_LINK(TogBorder)
MENU_LINK(TogFullHighlight)
MENU_LINK(SetFgColour)
MENU_LINK(SetBgColour)
MENU_LINK(Dump)
#ifndef NO_MULTIPLE_SELECTION
MENU_LINK(DumpSelected)
@ -193,6 +197,9 @@ MyFrame::MyFrame(const wxString& title, int x, int y, int w, int h)
#endif // NO_MULTIPLE_SELECTION
style_menu->Append(TreeTest_ToggleImages, wxT("Toggle show ima&ges"));
style_menu->Append(TreeTest_SetImageSize, wxT("Set image si&ze..."));
style_menu->AppendSeparator();
style_menu->Append(TreeTest_SetFgColour, wxT("Set &foreground colour..."));
style_menu->Append(TreeTest_SetBgColour, wxT("Set &background colour..."));
tree_menu->Append(TreeTest_Recreate, "&Recreate the tree");
tree_menu->Append(TreeTest_CollapseAndReset, "C&ollapse and reset");
@ -251,8 +258,6 @@ MyFrame::MyFrame(const wxString& title, int x, int y, int w, int h)
#endif
wxSUNKEN_BORDER);
// m_treeCtrl->SetBackgroundColour( *wxLIGHT_GREY );
m_textCtrl = new wxTextCtrl(this, -1, "",
wxDefaultPosition, wxDefaultSize,
wxTE_MULTILINE | wxSUNKEN_BORDER);
@ -564,6 +569,20 @@ void MyFrame::OnToggleIcon(wxCommandEvent& WXUNUSED(event))
m_treeCtrl->DoToggleIcon(item);
}
void MyFrame::OnSetFgColour(wxCommandEvent& WXUNUSED(event))
{
wxColour col = wxGetColourFromUser(this, m_treeCtrl->GetForegroundColour());
if ( col.Ok() )
m_treeCtrl->SetForegroundColour(col);
}
void MyFrame::OnSetBgColour(wxCommandEvent& WXUNUSED(event))
{
wxColour col = wxGetColourFromUser(this, m_treeCtrl->GetBackgroundColour());
if ( col.Ok() )
m_treeCtrl->SetBackgroundColour(col);
}
// MyTreeCtrl implementation
#if USE_GENERIC_TREECTRL
IMPLEMENT_DYNAMIC_CLASS(MyTreeCtrl, wxGenericTreeCtrl)

View File

@ -155,6 +155,9 @@ public:
void OnTogBorder(wxCommandEvent& event) { TogStyle(wxTR_ROW_LINES); }
void OnTogFullHighlight(wxCommandEvent& event) { TogStyle(wxTR_FULL_ROW_HIGHLIGHT); }
void OnSetFgColour(wxCommandEvent& event);
void OnSetBgColour(wxCommandEvent& event);
void OnDump(wxCommandEvent& event);
#ifndef NO_MULTIPLE_SELECTION
void OnDumpSelected(wxCommandEvent& event);
@ -225,6 +228,8 @@ enum
TreeTest_TogRootLines,
TreeTest_TogBorder,
TreeTest_TogFullHighlight,
TreeTest_SetFgColour,
TreeTest_SetBgColour,
TreeTest_Dump,
TreeTest_DumpSelected,
TreeTest_Count,