// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
-#ifdef __GNUG__
+#if defined(__GNUG__) && !defined(__APPLE__)
#pragma implementation
#pragma interface
#endif
#include "wx/msw/wince/time.h"
#endif
+#include "wx/numdlg.h"
#include "wx/colordlg.h"
#include "wx/filedlg.h"
#include "wx/dirdlg.h"
#include "wx/progdlg.h"
#include "wx/fdrepdlg.h"
#include "wx/busyinfo.h"
+#include "wx/image.h"
#define wxTEST_GENERIC_DIALOGS_IN_MSW 0
#define wxUSE_DIRDLGG 0
-#if !defined(__WXMSW__) || defined(wxUSE_DIRDLGG) && wxUSE_DIRDLGG
+#if !(defined(__WXMSW__) || defined(__WXMAC__)) || wxUSE_DIRDLGG
#include "wx/generic/dirdlgg.h"
#endif
// `Main program' equivalent, creating windows and returning main app frame
bool MyApp::OnInit()
{
+#if wxUSE_IMAGE
+ wxInitAllImageHandlers();
+#endif
+
#if defined(__WXGTK__) && defined(wxUSE_UNICODE)
wxConvCurrent = &wxConvLibc;
#endif
m_canvasFont = *wxNORMAL_FONT;
// Create the main frame window
- MyFrame *frame = new MyFrame((wxFrame *) NULL, _T("wxWindows dialogs example"), wxPoint(20, 20), wxSize(400, 300));
+ MyFrame *frame = new MyFrame((wxFrame *) NULL, _T("wxWidgets dialogs example"), wxPoint(20, 20), wxSize(400, 300));
// Make a menubar
wxMenu *file_menu = new wxMenu;
-
+
file_menu->Append(DIALOGS_CHOOSE_COLOUR, _T("&Choose colour"));
#if defined(__WXMSW__) && wxTEST_GENERIC_DIALOGS_IN_MSW
m_dlgFind =
m_dlgReplace = NULL;
#endif
+
+ m_clrData.SetChooseFull(true);
+ for (int i = 0; i < 16; i++)
+ {
+ m_clrData.SetCustomColour(i, wxColour(i*16, i*16, i*16));
+ }
CreateStatusBar();
}
void MyFrame::ChooseColour(wxCommandEvent& WXUNUSED(event) )
{
- wxColour col = myCanvas->GetBackgroundColour();
-
- wxColourData data;
- data.SetColour(col);
- data.SetChooseFull(TRUE);
- for (int i = 0; i < 16; i++)
- {
- wxColour colour(i*16, i*16, i*16);
- data.SetCustomColour(i, colour);
- }
+ m_clrData.SetColour(myCanvas->GetBackgroundColour());
- wxColourDialog dialog(this, &data);
+ wxColourDialog dialog(this, &m_clrData);
dialog.SetTitle(_T("Choose the background colour"));
if (dialog.ShowModal() == wxID_OK)
{
- wxColourData retData = dialog.GetColourData();
- col = retData.GetColour();
- myCanvas->SetBackgroundColour(col);
- myCanvas->Clear();
+ m_clrData = dialog.GetColourData();
+ myCanvas->SetBackgroundColour(m_clrData.GetColour());
+ myCanvas->ClearBackground();
myCanvas->Refresh();
}
}
wxColour col = retData.GetColour();
// wxBrush *brush = wxTheBrushList->FindOrCreateBrush(&col, wxSOLID);
myCanvas->SetBackgroundColour(col);
- myCanvas->Clear();
+ myCanvas->ClearBackground();
myCanvas->Refresh();
}
dialog->Destroy();
}
#endif // wxTEST_GENERIC_DIALOGS_IN_MSW
-void MyFrame::LogDialog(wxCommandEvent& event)
+void MyFrame::LogDialog(wxCommandEvent& WXUNUSED(event))
{
// calling wxYield() (as ~wxBusyCursor does) shouldn't result in messages
// being flushed -- test it
void MyFrame::FilesOpen(wxCommandEvent& WXUNUSED(event) )
{
+ wxString wildcards =
+#ifdef __WXMOTIF__
+ _T("C++ files (*.cpp)|*.cpp");
+#else
+ _T("All files (*.*)|*.*|C++ files (*.h;*.cpp)|*.h;*.cpp");
+#endif
wxFileDialog dialog(this, _T("Testing open multiple file dialog"),
- _T(""), _T(""), wxFileSelectorDefaultWildcardStr,
+ _T(""), _T(""), wildcards,
wxMULTIPLE);
if (dialog.ShowModal() == wxID_OK)
msg += s;
}
+ s.Printf(_T("Filter index: %d"), dialog.GetFilterIndex());
+ msg += s;
wxMessageDialog dialog2(this, msg, _T("Selected files"));
dialog2.ShowModal();
void MyFrame::GenericDirChoose(wxCommandEvent& WXUNUSED(event) )
{
-#if !defined(__WXMSW__) || defined(wxUSE_DIRDLGG) && wxUSE_DIRDLGG
+#if !(defined(__WXMSW__) || defined(__WXMAC__)) || wxUSE_DIRDLGG
// pass some initial dir to wxDirDialog
wxString dirHome;
wxGetHomeDir(&dirHome);
}
}
-void MyFrame::ShowTip(wxCommandEvent& event)
+void MyFrame::ShowTip(wxCommandEvent& WXUNUSED(event))
{
#if wxUSE_STARTUP_TIPS
static size_t s_index = (size_t)-1;
dc.SetFont(wxGetApp().m_canvasFont);
dc.SetTextForeground(wxGetApp().m_canvasTextColour);
dc.SetBackgroundMode(wxTRANSPARENT);
- dc.DrawText(_T("wxWindows common dialogs test application"), 10, 10);
+ dc.DrawText(_T("wxWidgets common dialogs test application"), 10, 10);
}
// ----------------------------------------------------------------------------