#include "wx/colordlg.h"
#include "wx/wxhtml.h"
#include "wx/imaglist.h"
+#include "wx/dataobj.h"
#include "wx/aui/aui.h"
#include "../sample.xpm"
void DoUpdate();
private:
- wxTextCtrl* CreateTextCtrl();
+ wxTextCtrl* CreateTextCtrl(const wxString& text = wxEmptyString);
wxGrid* CreateGrid();
wxTreeCtrl* CreateTreeCtrl();
wxSizeReportCtrl* CreateSizeReportCtrl(int width = 80, int height = 80);
private:
- void OnEraseBackground(wxEraseEvent& event);
- void OnSize(wxSizeEvent& event);
-
- void OnCreateTree(wxCommandEvent& event);
- void OnCreateGrid(wxCommandEvent& event);
- void OnCreateHTML(wxCommandEvent& event);
- void OnCreateText(wxCommandEvent& event);
- void OnCreateSizeReport(wxCommandEvent& event);
- void OnChangeContentPane(wxCommandEvent& event);
- void OnCreatePerspective(wxCommandEvent& event);
- void OnCopyPerspectiveCode(wxCommandEvent& event);
- void OnRestorePerspective(wxCommandEvent& event);
- void OnSettings(wxCommandEvent& event);
- void OnExit(wxCommandEvent& event);
- void OnAbout(wxCommandEvent& event);
-
- void OnGradient(wxCommandEvent& event);
- void OnManagerFlag(wxCommandEvent& event);
- void OnUpdateUI(wxUpdateUIEvent& event);
-
+ void OnEraseBackground(wxEraseEvent& evt);
+ void OnSize(wxSizeEvent& evt);
+
+ void OnCreateTree(wxCommandEvent& evt);
+ void OnCreateGrid(wxCommandEvent& evt);
+ void OnCreateHTML(wxCommandEvent& evt);
+ void OnCreateText(wxCommandEvent& evt);
+ void OnCreateSizeReport(wxCommandEvent& evt);
+ void OnChangeContentPane(wxCommandEvent& evt);
+ void OnCreatePerspective(wxCommandEvent& evt);
+ void OnCopyPerspectiveCode(wxCommandEvent& evt);
+ void OnRestorePerspective(wxCommandEvent& evt);
+ void OnSettings(wxCommandEvent& evt);
+ void OnExit(wxCommandEvent& evt);
+ void OnAbout(wxCommandEvent& evt);
+
+ void OnGradient(wxCommandEvent& evt);
+ void OnManagerFlag(wxCommandEvent& evt);
+ void OnUpdateUI(wxUpdateUIEvent& evt);
+
+ void OnPaneClose(wxFrameManagerEvent& evt);
+
private:
wxFrameManager m_mgr;
EVT_UPDATE_UI(ID_HorizontalGradient, MyFrame::OnUpdateUI)
EVT_MENU_RANGE(MyFrame::ID_FirstPerspective, MyFrame::ID_FirstPerspective+1000,
MyFrame::OnRestorePerspective)
+ EVT_AUI_PANECLOSE(MyFrame::OnPaneClose)
END_EVENT_TABLE()
BestSize(wxSize(200,100)).MinSize(wxSize(200,100)).
Bottom().Layer(1));
- m_mgr.AddPane(CreateTextCtrl(), wxPaneInfo().
- Name(wxT("test10")).Caption(wxT("Text Pane")).
+ wxWindow* wnd10 = CreateTextCtrl(wxT("This pane will prompt the user before hiding."));
+ m_mgr.AddPane(wnd10, wxPaneInfo().
+ Name(wxT("test10")).Caption(wxT("Text Pane with Hide Prompt")).
Bottom().Layer(1).Position(1));
m_mgr.AddPane(CreateSizeReportCtrl(), wxPaneInfo().
LeftDockable(false).RightDockable(false));
-
// make some default perspectives
wxString perspective_all = m_mgr.SavePerspective();
{
unsigned int flag = 0;
-#ifndef __WXMSW__
+#if !defined(__WXMSW__) && !defined(__WXMAC__)
if (event.GetId() == ID_TransparentDrag ||
event.GetId() == ID_TransparentHint ||
event.GetId() == ID_TransparentHintFade)
{
- wxMessageBox(wxT("This option is presently only available on wxMSW"));
+ wxMessageBox(wxT("This option is presently only available on wxMSW and wxMac"));
return;
}
#endif
}
}
+void MyFrame::OnPaneClose(wxFrameManagerEvent& evt)
+{
+ if (evt.pane->name == wxT("test10"))
+ {
+ int res = wxMessageBox(wxT("Are you sure you want to close/hide this pane?"),
+ wxT("wxAUI"),
+ wxYES_NO,
+ this);
+ if (res != wxYES)
+ evt.Veto();
+ }
+}
+
+
+
void MyFrame::OnCreatePerspective(wxCommandEvent& WXUNUSED(event))
{
wxTextEntryDialog dlg(this, wxT("Enter a name for the new perspective:"),
wxMessageBox(_("wxAUI Demo\nAn advanced window management library for wxWidgets\n(c) Copyright 2005-2006, Kirix Corporation"), _("About wxAUI Demo"), wxOK, this);
}
-wxTextCtrl* MyFrame::CreateTextCtrl()
+wxTextCtrl* MyFrame::CreateTextCtrl(const wxString& ctrl_text)
{
- wxString text;
static int n = 0;
- text.Printf(wxT("This is text box %d"), ++n);
+ wxString text;
+ if (ctrl_text.Length() > 0)
+ text = ctrl_text;
+ else
+ text.Printf(wxT("This is text box %d"), ++n);
return new wxTextCtrl(this,wxID_ANY, text,
wxPoint(0,0), wxSize(150,90),