Removed some warnings in widgets sample
Reduced some flicker in wxNotebook when using XP controls git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@22413 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
055f8a8b28
commit
c02e5a31c5
@ -148,6 +148,8 @@ protected:
|
||||
// set the size of the given page to fit in the notebook
|
||||
void AdjustPageSize(wxNotebookPage *page);
|
||||
|
||||
// override WndProc
|
||||
virtual long MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
|
||||
|
||||
// the current selection (-1 if none)
|
||||
int m_nSelection;
|
||||
|
@ -229,7 +229,7 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size,
|
||||
);
|
||||
|
||||
m_panel = new wxPanel(this, -1, wxDefaultPosition, wxDefaultSize,
|
||||
wxTAB_TRAVERSAL | wxCLIP_CHILDREN | wxNO_BORDER);
|
||||
wxTAB_TRAVERSAL | wxCLIP_CHILDREN | wxNO_BORDER | wxNO_FULL_REPAINT_ON_RESIZE);
|
||||
|
||||
// Create remaining controls
|
||||
|
||||
@ -368,7 +368,7 @@ void MyFrame::ReInitNotebook()
|
||||
|
||||
m_notebook = new MyNotebook(m_panel, ID_NOTEBOOK,
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
flags);
|
||||
flags|wxCLIP_CHILDREN|wxNO_FULL_REPAINT_ON_RESIZE);
|
||||
|
||||
if ( m_chkShowImages->IsChecked() )
|
||||
{
|
||||
@ -429,7 +429,7 @@ BEGIN_EVENT_TABLE(MyFrame, wxFrame)
|
||||
EVT_IDLE(MyFrame::OnIdle)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
void MyFrame::OnCheckOrRadioBox(wxCommandEvent& event)
|
||||
void MyFrame::OnCheckOrRadioBox(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
ReInitNotebook();
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ class MyFrame : public wxFrame
|
||||
{
|
||||
public:
|
||||
MyFrame(const wxString& title, const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize, long style = wxDEFAULT_FRAME_STYLE);
|
||||
const wxSize& size = wxDefaultSize, long style = wxDEFAULT_FRAME_STYLE|wxCLIP_CHILDREN|wxNO_FULL_REPAINT_ON_RESIZE);
|
||||
|
||||
virtual ~MyFrame();
|
||||
|
||||
|
@ -355,7 +355,7 @@ void ButtonWidgetsPage::OnButtonReset(wxCommandEvent& WXUNUSED(event))
|
||||
CreateButton();
|
||||
}
|
||||
|
||||
void ButtonWidgetsPage::OnCheckOrRadioBox(wxCommandEvent& event)
|
||||
void ButtonWidgetsPage::OnCheckOrRadioBox(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
CreateButton();
|
||||
}
|
||||
@ -365,7 +365,7 @@ void ButtonWidgetsPage::OnButtonChangeLabel(wxCommandEvent& WXUNUSED(event))
|
||||
m_button->SetLabel(m_textLabel->GetValue());
|
||||
}
|
||||
|
||||
void ButtonWidgetsPage::OnButton(wxCommandEvent& event)
|
||||
void ButtonWidgetsPage::OnButton(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
wxLogMessage(_T("Test button clicked."));
|
||||
}
|
||||
|
@ -420,12 +420,12 @@ void ComboboxWidgetsPage::OnButtonDeleteSel(wxCommandEvent& WXUNUSED(event))
|
||||
}
|
||||
}
|
||||
|
||||
void ComboboxWidgetsPage::OnButtonClear(wxCommandEvent& event)
|
||||
void ComboboxWidgetsPage::OnButtonClear(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
m_combobox->Clear();
|
||||
}
|
||||
|
||||
void ComboboxWidgetsPage::OnButtonInsert(wxCommandEvent& event)
|
||||
void ComboboxWidgetsPage::OnButtonInsert(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
static unsigned int s_item = 0;
|
||||
|
||||
@ -440,7 +440,7 @@ void ComboboxWidgetsPage::OnButtonInsert(wxCommandEvent& event)
|
||||
m_combobox->Insert(s, m_combobox->GetSelection());
|
||||
}
|
||||
|
||||
void ComboboxWidgetsPage::OnButtonAdd(wxCommandEvent& event)
|
||||
void ComboboxWidgetsPage::OnButtonAdd(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
static unsigned int s_item = 0;
|
||||
|
||||
@ -463,7 +463,7 @@ void ComboboxWidgetsPage::OnButtonAddMany(wxCommandEvent& WXUNUSED(event))
|
||||
}
|
||||
}
|
||||
|
||||
void ComboboxWidgetsPage::OnButtonAddSeveral(wxCommandEvent& event)
|
||||
void ComboboxWidgetsPage::OnButtonAddSeveral(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
m_combobox->Append(_T("First"));
|
||||
m_combobox->Append(_T("another one"));
|
||||
@ -545,7 +545,7 @@ void ComboboxWidgetsPage::OnComboBox(wxCommandEvent& event)
|
||||
wxLogMessage(_T("Combobox item %ld selected"), sel);
|
||||
}
|
||||
|
||||
void ComboboxWidgetsPage::OnCheckOrRadioBox(wxCommandEvent& event)
|
||||
void ComboboxWidgetsPage::OnCheckOrRadioBox(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
CreateCombo();
|
||||
}
|
||||
|
@ -362,7 +362,7 @@ void GaugeWidgetsPage::OnUpdateUIResetButton(wxUpdateUIEvent& event)
|
||||
event.Enable( m_chkVert->GetValue() || m_chkSmooth->GetValue() );
|
||||
}
|
||||
|
||||
void GaugeWidgetsPage::OnCheckOrRadioBox(wxCommandEvent& event)
|
||||
void GaugeWidgetsPage::OnCheckOrRadioBox(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
CreateGauge();
|
||||
}
|
||||
|
@ -422,12 +422,12 @@ void ListboxWidgetsPage::OnButtonDeleteSel(wxCommandEvent& WXUNUSED(event))
|
||||
}
|
||||
}
|
||||
|
||||
void ListboxWidgetsPage::OnButtonClear(wxCommandEvent& event)
|
||||
void ListboxWidgetsPage::OnButtonClear(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
m_lbox->Clear();
|
||||
}
|
||||
|
||||
void ListboxWidgetsPage::OnButtonAdd(wxCommandEvent& event)
|
||||
void ListboxWidgetsPage::OnButtonAdd(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
static unsigned int s_item = 0;
|
||||
|
||||
@ -450,7 +450,7 @@ void ListboxWidgetsPage::OnButtonAddMany(wxCommandEvent& WXUNUSED(event))
|
||||
}
|
||||
}
|
||||
|
||||
void ListboxWidgetsPage::OnButtonAddSeveral(wxCommandEvent& event)
|
||||
void ListboxWidgetsPage::OnButtonAddSeveral(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
wxArrayString items;
|
||||
items.Add(_T("First"));
|
||||
@ -508,7 +508,7 @@ void ListboxWidgetsPage::OnCheckListbox(wxCommandEvent& event)
|
||||
wxLogMessage( _T("Listbox item %ld toggled"), event.GetInt() );
|
||||
}
|
||||
|
||||
void ListboxWidgetsPage::OnCheckOrRadioBox(wxCommandEvent& event)
|
||||
void ListboxWidgetsPage::OnCheckOrRadioBox(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
CreateLbox();
|
||||
}
|
||||
|
@ -459,7 +459,7 @@ void NotebookWidgetsPage::OnButtonDeleteAll(wxCommandEvent& WXUNUSED(event))
|
||||
m_notebook->DeleteAllPages();
|
||||
}
|
||||
|
||||
void NotebookWidgetsPage::OnButtonSelectPage(wxCommandEvent& event)
|
||||
void NotebookWidgetsPage::OnButtonSelectPage(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
int pos = GetTextValue(m_textSelect);
|
||||
wxCHECK_RET( IsValidValue(pos), _T("button should be disabled") );
|
||||
@ -521,7 +521,7 @@ void NotebookWidgetsPage::OnUpdateUICurSelectText(wxUpdateUIEvent& event)
|
||||
event.SetText( wxString::Format(_T("%d"), m_notebook->GetSelection()) );
|
||||
}
|
||||
|
||||
void NotebookWidgetsPage::OnCheckOrRadioBox(wxCommandEvent& event)
|
||||
void NotebookWidgetsPage::OnCheckOrRadioBox(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
CreateNotebook();
|
||||
}
|
||||
|
@ -377,7 +377,7 @@ void RadioWidgetsPage::OnButtonReset(wxCommandEvent& WXUNUSED(event))
|
||||
CreateRadio();
|
||||
}
|
||||
|
||||
void RadioWidgetsPage::OnCheckOrRadioBox(wxCommandEvent& event)
|
||||
void RadioWidgetsPage::OnCheckOrRadioBox(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
CreateRadio();
|
||||
}
|
||||
|
@ -536,7 +536,7 @@ void SliderWidgetsPage::OnUpdateUIResetButton(wxUpdateUIEvent& event)
|
||||
m_chkBothSides->GetValue() );
|
||||
}
|
||||
|
||||
void SliderWidgetsPage::OnCheckOrRadioBox(wxCommandEvent& event)
|
||||
void SliderWidgetsPage::OnCheckOrRadioBox(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
CreateSlider();
|
||||
}
|
||||
|
@ -384,7 +384,7 @@ void SpinBtnWidgetsPage::OnUpdateUIResetButton(wxUpdateUIEvent& event)
|
||||
event.Enable( !m_chkVert->GetValue() || m_chkWrap->GetValue() );
|
||||
}
|
||||
|
||||
void SpinBtnWidgetsPage::OnCheckOrRadioBox(wxCommandEvent& event)
|
||||
void SpinBtnWidgetsPage::OnCheckOrRadioBox(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
CreateSpin();
|
||||
}
|
||||
|
@ -94,7 +94,7 @@ public:
|
||||
}
|
||||
|
||||
protected:
|
||||
void OnMouseEvent(wxMouseEvent& event)
|
||||
void OnMouseEvent(wxMouseEvent& WXUNUSED(event))
|
||||
{
|
||||
wxLogMessage(wxT("Clicked on static text"));
|
||||
}
|
||||
@ -116,7 +116,7 @@ public:
|
||||
}
|
||||
|
||||
protected:
|
||||
void OnMouseEvent(wxMouseEvent& event)
|
||||
void OnMouseEvent(wxMouseEvent& WXUNUSED(event))
|
||||
{
|
||||
wxLogMessage(wxT("Clicked on static box"));
|
||||
}
|
||||
@ -413,17 +413,17 @@ void StaticWidgetsPage::OnButtonReset(wxCommandEvent& WXUNUSED(event))
|
||||
CreateStatic();
|
||||
}
|
||||
|
||||
void StaticWidgetsPage::OnCheckOrRadioBox(wxCommandEvent& event)
|
||||
void StaticWidgetsPage::OnCheckOrRadioBox(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
CreateStatic();
|
||||
}
|
||||
|
||||
void StaticWidgetsPage::OnButtonBoxText(wxCommandEvent& event)
|
||||
void StaticWidgetsPage::OnButtonBoxText(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
m_sizerStatBox->GetStaticBox()->SetLabel(m_textBox->GetValue());
|
||||
}
|
||||
|
||||
void StaticWidgetsPage::OnButtonLabelText(wxCommandEvent& event)
|
||||
void StaticWidgetsPage::OnButtonLabelText(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
m_statText->SetLabel(m_textLabel->GetValue());
|
||||
}
|
||||
|
@ -735,7 +735,7 @@ void TextWidgetsPage::OnUpdateUIResetButton(wxUpdateUIEvent& event)
|
||||
(m_chkWrapLines->GetValue() != DEFAULTS.wraplines) );
|
||||
}
|
||||
|
||||
void TextWidgetsPage::OnText(wxCommandEvent& event)
|
||||
void TextWidgetsPage::OnText(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
// small hack to suppress the very first message: by then the logging is
|
||||
// not yet redirected and so initial setting of the text value results in
|
||||
@ -755,7 +755,7 @@ void TextWidgetsPage::OnTextEnter(wxCommandEvent& event)
|
||||
wxLogMessage(_T("Text entered: '%s'"), event.GetString().c_str());
|
||||
}
|
||||
|
||||
void TextWidgetsPage::OnCheckOrRadioBox(wxCommandEvent& event)
|
||||
void TextWidgetsPage::OnCheckOrRadioBox(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
CreateText();
|
||||
}
|
||||
|
@ -142,7 +142,7 @@ private:
|
||||
}
|
||||
}
|
||||
|
||||
virtual void DoLogString(const wxChar *szString, time_t t)
|
||||
virtual void DoLogString(const wxChar *szString, time_t WXUNUSED(t))
|
||||
{
|
||||
wxString msg;
|
||||
TimeStamp(&msg);
|
||||
@ -228,7 +228,7 @@ bool WidgetsApp::OnInit()
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
WidgetsFrame::WidgetsFrame(const wxString& title)
|
||||
: wxFrame(NULL, -1, title, wxPoint(0, 50))
|
||||
: wxFrame(NULL, -1, title, wxPoint(0, 50), wxDefaultSize, wxDEFAULT_FRAME_STYLE|wxNO_FULL_REPAINT_ON_RESIZE|wxCLIP_CHILDREN)
|
||||
{
|
||||
// init everything
|
||||
m_lboxLog = (wxListBox *)NULL;
|
||||
@ -237,14 +237,14 @@ WidgetsFrame::WidgetsFrame(const wxString& title)
|
||||
m_imaglist = (wxImageList *)NULL;
|
||||
|
||||
// create controls
|
||||
m_panel = new wxPanel(this, -1);
|
||||
m_panel = new wxPanel(this, -1, wxDefaultPosition, wxDefaultSize, wxCLIP_CHILDREN);
|
||||
|
||||
wxSizer *sizerTop = new wxBoxSizer(wxVERTICAL);
|
||||
|
||||
// we have 2 panes: notebook which pages demonstrating the controls in the
|
||||
// upper one and the log window with some buttons in the lower
|
||||
|
||||
m_notebook = new wxNotebook(m_panel, -1);
|
||||
m_notebook = new wxNotebook(m_panel, -1, wxDefaultPosition, wxDefaultSize, wxNO_FULL_REPAINT_ON_RESIZE|wxCLIP_CHILDREN);
|
||||
InitNotebook();
|
||||
wxSizer *sizerUp = new wxNotebookSizer(m_notebook);
|
||||
|
||||
@ -333,7 +333,7 @@ void WidgetsFrame::OnButtonQuit(wxCommandEvent& WXUNUSED(event))
|
||||
Close();
|
||||
}
|
||||
|
||||
void WidgetsFrame::OnButtonClearLog(wxCommandEvent& event)
|
||||
void WidgetsFrame::OnButtonClearLog(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
m_lboxLog->Clear();
|
||||
}
|
||||
@ -358,7 +358,7 @@ WidgetsPageInfo::WidgetsPageInfo(Constructor ctor, const wxChar *label)
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
WidgetsPage::WidgetsPage(wxNotebook *notebook)
|
||||
: wxPanel(notebook, -1)
|
||||
: wxPanel(notebook, -1, wxDefaultPosition, wxDefaultSize, wxNO_FULL_REPAINT_ON_RESIZE|wxCLIP_CHILDREN)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -485,11 +485,21 @@ bool wxNotebook::InsertPage(int nPage,
|
||||
_T("notebook pages must have notebook as parent") );
|
||||
|
||||
#if wxUSE_UXTHEME && wxUSE_UXTHEME_AUTO
|
||||
static bool g_TestedForTheme = FALSE;
|
||||
static bool g_UseTheme = FALSE;
|
||||
if (!g_TestedForTheme)
|
||||
{
|
||||
int commCtrlVersion = wxTheApp->GetComCtl32Version() ;
|
||||
|
||||
g_UseTheme = (commCtrlVersion >= 600);
|
||||
g_TestedForTheme = TRUE;
|
||||
}
|
||||
|
||||
// Automatically apply the theme background,
|
||||
// changing the colour of the panel to match the
|
||||
// tab page colour. This won't work well with all
|
||||
// themes but it's a start.
|
||||
if (wxUxThemeEngine::Get() && pPage->IsKindOf(CLASSINFO(wxPanel)))
|
||||
if (g_UseTheme && wxUxThemeEngine::Get() && pPage->IsKindOf(CLASSINFO(wxPanel)))
|
||||
{
|
||||
ApplyThemeBackground(pPage, GetThemeBackgroundColour());
|
||||
}
|
||||
@ -848,4 +858,31 @@ void wxNotebook::ApplyThemeBackground(wxWindow* window, const wxColour& colour)
|
||||
#endif
|
||||
}
|
||||
|
||||
long wxNotebook::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam)
|
||||
{
|
||||
static bool g_TestedForTheme = FALSE;
|
||||
static bool g_UseTheme = FALSE;
|
||||
switch ( nMsg )
|
||||
{
|
||||
case WM_ERASEBKGND:
|
||||
{
|
||||
if (!g_TestedForTheme)
|
||||
{
|
||||
int commCtrlVersion = wxTheApp->GetComCtl32Version() ;
|
||||
|
||||
g_UseTheme = (commCtrlVersion >= 600);
|
||||
g_TestedForTheme = TRUE;
|
||||
}
|
||||
|
||||
// If using XP themes, it seems we can get away
|
||||
// with not drawing a background, which reduces flicker.
|
||||
if (g_UseTheme)
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return wxControl::MSWWindowProc(nMsg, wParam, lParam);
|
||||
}
|
||||
|
||||
|
||||
#endif // wxUSE_NOTEBOOK
|
||||
|
Loading…
Reference in New Issue
Block a user