void MyFrame::OnStyleChange( wxCommandEvent& WXUNUSED(event) ) { unsigned int nPanel = m_notebook->GetSelection(); // build the style unsigned long style = 0; /*if (GetMenuBar()->FindItem(ID_SINGLE)->IsChecked()) style |= wxDV_SINGLE;*/ if (GetMenuBar()->FindItem(ID_MULTIPLE)->IsChecked()) style |= wxDV_MULTIPLE; if (GetMenuBar()->FindItem(ID_ROW_LINES)->IsChecked()) style |= wxDV_ROW_LINES; if (GetMenuBar()->FindItem(ID_HORIZ_RULES)->IsChecked()) style |= wxDV_HORIZ_RULES; if (GetMenuBar()->FindItem(ID_VERT_RULES)->IsChecked()) style |= wxDV_VERT_RULES; wxSizer* sz = m_ctrl[nPanel]->GetContainingSizer(); wxASSERT(sz); sz->Detach(m_ctrl[nPanel]); wxDELETE(m_ctrl[nPanel]); m_ctrl[nPanel] = NULL; if (nPanel == 0) m_music_model.reset(NULL); else if (nPanel == 1) m_list_model.reset(NULL); // rebuild the DVC for the selected panel: BuildDataViewCtrl((wxPanel*)m_notebook->GetPage(nPanel), nPanel, style); sz->Prepend(m_ctrl[nPanel], 1, wxGROW|wxALL, 5); sz->Layout(); }
void wxMacControl::SetupTabs( const wxNotebook& notebook) { const size_t countPages = notebook.GetPageCount(); SetMaximum( countPages ) ; wxNotebookPage *page; ControlTabInfoRecV1 info; for (size_t ii = 0; ii < countPages; ii++) { page = (wxNotebookPage*) notebook.GetPage(ii); info.version = kControlTabInfoVersionOne; info.iconSuiteID = 0; wxCFStringRef cflabel( page->GetLabel(), page->GetFont().GetEncoding() ) ; info.name = cflabel ; SetData<ControlTabInfoRecV1>( ii + 1, kControlTabInfoTag, &info ) ; if ( notebook.GetImageList() && notebook.GetPageImage(ii) >= 0 ) { const wxBitmap bmap = notebook.GetImageList()->GetBitmap( notebook.GetPageImage( ii ) ) ; if ( bmap.IsOk() ) { ControlButtonContentInfo info ; wxMacCreateBitmapButton( &info, bmap ) ; OSStatus err = SetData<ControlButtonContentInfo>( ii + 1, kControlTabImageContentTag, &info ); if ( err != noErr ) { wxFAIL_MSG("Error when setting icon on tab"); } wxMacReleaseBitmapButton( &info ) ; } } SetTabEnabled( ii + 1, true ) ; } }