added wxMiniFrame demonstration to the dialogs sample

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@47799 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2007-07-29 00:21:45 +00:00
parent 8630a814ce
commit 1baa0a9db5
3 changed files with 30 additions and 5 deletions

View File

@@ -3,6 +3,9 @@
A miniframe is a frame with a small title bar. It is suitable for floating toolbars that must not A miniframe is a frame with a small title bar. It is suitable for floating toolbars that must not
take up too much screen area. take up too much screen area.
An example of mini frame can be seen in the \helpref{dialogs sample}{sampledialogs}
using the ``Mini frame'' command of the ``Generic dialogs'' submenu.
\wxheading{Derived from} \wxheading{Derived from}
\helpref{wxFrame}{wxframe}\\ \helpref{wxFrame}{wxframe}\\

View File

@@ -27,6 +27,7 @@
#include "wx/bookctrl.h" #include "wx/bookctrl.h"
#include "wx/artprov.h" #include "wx/artprov.h"
#include "wx/imaglist.h" #include "wx/imaglist.h"
#include "wx/minifram.h"
#include "wx/sysopt.h" #include "wx/sysopt.h"
#if wxUSE_COLOURDLG #if wxUSE_COLOURDLG
@@ -162,10 +163,11 @@ BEGIN_EVENT_TABLE(MyFrame, wxFrame)
#if USE_MODAL_PRESENTATION #if USE_MODAL_PRESENTATION
EVT_MENU(DIALOGS_MODAL, MyFrame::ModalDlg) EVT_MENU(DIALOGS_MODAL, MyFrame::ModalDlg)
#endif // USE_MODAL_PRESENTATION
EVT_MENU(DIALOGS_MODELESS, MyFrame::ModelessDlg) EVT_MENU(DIALOGS_MODELESS, MyFrame::ModelessDlg)
EVT_MENU(DIALOGS_CENTRE_SCREEN, MyFrame::DlgCenteredScreen) EVT_MENU(DIALOGS_CENTRE_SCREEN, MyFrame::DlgCenteredScreen)
EVT_MENU(DIALOGS_CENTRE_PARENT, MyFrame::DlgCenteredParent) EVT_MENU(DIALOGS_CENTRE_PARENT, MyFrame::DlgCenteredParent)
#endif // USE_MODAL EVT_MENU(DIALOGS_MINIFRAME, MyFrame::MiniFrame)
#if wxUSE_STARTUP_TIPS #if wxUSE_STARTUP_TIPS
EVT_MENU(DIALOGS_TIP, MyFrame::ShowTip) EVT_MENU(DIALOGS_TIP, MyFrame::ShowTip)
@@ -380,14 +382,15 @@ bool MyApp::OnInit()
menuDlg->Append(wxID_ANY,_T("&Searching"),find_menu); menuDlg->Append(wxID_ANY,_T("&Searching"),find_menu);
#endif // wxUSE_FINDREPLDLG #endif // wxUSE_FINDREPLDLG
#if USE_MODAL_PRESENTATION
wxMenu *dialogs_menu = new wxMenu; wxMenu *dialogs_menu = new wxMenu;
#if USE_MODAL_PRESENTATION
dialogs_menu->Append(DIALOGS_MODAL, _T("&Modal dialog\tCtrl-W")); dialogs_menu->Append(DIALOGS_MODAL, _T("&Modal dialog\tCtrl-W"));
#endif // USE_MODAL_PRESENTATION
dialogs_menu->AppendCheckItem(DIALOGS_MODELESS, _T("Mode&less dialog\tCtrl-Z")); dialogs_menu->AppendCheckItem(DIALOGS_MODELESS, _T("Mode&less dialog\tCtrl-Z"));
dialogs_menu->Append(DIALOGS_CENTRE_SCREEN, _T("Centered on &screen\tShift-Ctrl-1")); dialogs_menu->Append(DIALOGS_CENTRE_SCREEN, _T("Centered on &screen\tShift-Ctrl-1"));
dialogs_menu->Append(DIALOGS_CENTRE_PARENT, _T("Centered on &parent\tShift-Ctrl-2")); dialogs_menu->Append(DIALOGS_CENTRE_PARENT, _T("Centered on &parent\tShift-Ctrl-2"));
dialogs_menu->Append(DIALOGS_MINIFRAME, _T("&Mini frame"));
menuDlg->Append(wxID_ANY, _T("&Generic dialogs"), dialogs_menu); menuDlg->Append(wxID_ANY, _T("&Generic dialogs"), dialogs_menu);
#endif // USE_MODAL_PRESENTATION
#if USE_SETTINGS_DIALOG #if USE_SETTINGS_DIALOG
wxMenu *sheet_menu = new wxMenu; wxMenu *sheet_menu = new wxMenu;
@@ -990,6 +993,7 @@ void MyFrame::ModalDlg(wxCommandEvent& WXUNUSED(event))
MyModalDialog dlg(this); MyModalDialog dlg(this);
dlg.ShowModal(); dlg.ShowModal();
} }
#endif // USE_MODAL_PRESENTATION
void MyFrame::ModelessDlg(wxCommandEvent& event) void MyFrame::ModelessDlg(wxCommandEvent& event)
{ {
@@ -1035,7 +1039,23 @@ void MyFrame::DlgCenteredParent(wxCommandEvent& WXUNUSED(event))
dlg.ShowModal(); dlg.ShowModal();
} }
#endif // USE_MODAL_PRESENTATION void MyFrame::MiniFrame(wxCommandEvent& WXUNUSED(event))
{
wxFrame *frame = new wxMiniFrame(this, wxID_ANY, _T("Mini frame"),
wxDefaultPosition, wxSize(300, 100),
wxCAPTION | wxCLOSE_BOX);
new wxStaticText(frame,
wxID_ANY,
_T("Mini frames have slightly different appearance"),
wxPoint(5, 5));
new wxStaticText(frame,
wxID_ANY,
_T("from the normal frames but that's the only difference."),
wxPoint(5, 25));
frame->CentreOnParent();
frame->Show();
}
#if wxUSE_STARTUP_TIPS #if wxUSE_STARTUP_TIPS
void MyFrame::ShowTip(wxCommandEvent& WXUNUSED(event)) void MyFrame::ShowTip(wxCommandEvent& WXUNUSED(event))

View File

@@ -263,10 +263,11 @@ public:
#if USE_MODAL_PRESENTATION #if USE_MODAL_PRESENTATION
void ModalDlg(wxCommandEvent& event); void ModalDlg(wxCommandEvent& event);
#endif // USE_MODAL_PRESENTATION
void ModelessDlg(wxCommandEvent& event); void ModelessDlg(wxCommandEvent& event);
void DlgCenteredScreen(wxCommandEvent& event); void DlgCenteredScreen(wxCommandEvent& event);
void DlgCenteredParent(wxCommandEvent& event); void DlgCenteredParent(wxCommandEvent& event);
#endif // USE_MODAL_PRESENTATION void MiniFrame(wxCommandEvent& event);
#if wxUSE_PROGRESSDLG #if wxUSE_PROGRESSDLG
void ShowProgress(wxCommandEvent& event); void ShowProgress(wxCommandEvent& event);
@@ -364,6 +365,7 @@ enum
DIALOGS_MODELESS, DIALOGS_MODELESS,
DIALOGS_CENTRE_SCREEN, DIALOGS_CENTRE_SCREEN,
DIALOGS_CENTRE_PARENT, DIALOGS_CENTRE_PARENT,
DIALOGS_MINIFRAME,
DIALOGS_MODELESS_BTN, DIALOGS_MODELESS_BTN,
DIALOGS_PROGRESS, DIALOGS_PROGRESS,
DIALOGS_ABOUTDLG_SIMPLE, DIALOGS_ABOUTDLG_SIMPLE,