From d427503c3696486ef84cd0e5081884ccd8d6b434 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 13 Jun 1999 22:54:04 +0000 Subject: [PATCH] 1. some more of "#if wxUSE_XXX" here and there 2. Makefile fixes for Cygwin compilation git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@2773 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/confbase.h | 34 ++-- include/wx/msw/dcprint.h | 4 + include/wx/msw/frame.h | 14 +- include/wx/msw/menu.h | 9 + include/wx/msw/printdlg.h | 4 + include/wx/msw/private.h | 1 + include/wx/msw/setup0.h | 2 + include/wx/msw/tbar95.h | 7 +- include/wx/msw/treectrl.h | 7 + include/wx/prntbase.h | 5 + src/common/fileconf.cpp | 6 + src/common/intl.cpp | 5 + src/common/layout.cpp | 4 + src/common/parser.y | 3 +- src/common/prntbase.cpp | 28 ++- src/generic/choicdgg.cpp | 379 +++++++++++++++++++------------------- src/msw/Makefile.am | 9 +- src/msw/frame.cpp | 22 ++- src/msw/menu.cpp | 8 + 19 files changed, 313 insertions(+), 238 deletions(-) diff --git a/include/wx/confbase.h b/include/wx/confbase.h index 483c9d0a80..c4cfa87538 100644 --- a/include/wx/confbase.h +++ b/include/wx/confbase.h @@ -60,22 +60,6 @@ enum wxCONFIG_USE_RELATIVE_PATH = 4 }; -// ---------------------------------------------------------------------------- -// various helper global functions -// ---------------------------------------------------------------------------- - -/* - Replace environment variables ($SOMETHING) with their values. The format is - $VARNAME or ${VARNAME} where VARNAME contains alphanumeric characters and - '_' only. '$' must be escaped ('\$') in order to be taken literally. - */ -extern wxString wxExpandEnvVars(const wxString &sz); - -/* - Split path into parts removing '..' in progress - */ -extern void wxSplitPath(wxArrayString& aParts, const wxChar *sz); - // ---------------------------------------------------------------------------- // abstract base class wxConfigBase which defines the interface for derived // classes @@ -311,9 +295,23 @@ private: #define sm_classwxConfig sm_classwxFileConfig #endif -#endif +#endif // wxUSE_CONFIG + +// ---------------------------------------------------------------------------- +// various helper global functions (defined even if !wxUSE_CONFIG) +// ---------------------------------------------------------------------------- - // wxUSE_CONFIG +/* + Replace environment variables ($SOMETHING) with their values. The format is + $VARNAME or ${VARNAME} where VARNAME contains alphanumeric characters and + '_' only. '$' must be escaped ('\$') in order to be taken literally. + */ +extern wxString wxExpandEnvVars(const wxString &sz); + +/* + Split path into parts removing '..' in progress + */ +extern void wxSplitPath(wxArrayString& aParts, const wxChar *sz); #endif // _WX_CONFIG_H_ diff --git a/include/wx/msw/dcprint.h b/include/wx/msw/dcprint.h index 3dcf523f55..4052a617a1 100644 --- a/include/wx/msw/dcprint.h +++ b/include/wx/msw/dcprint.h @@ -16,6 +16,8 @@ #pragma interface "dcprint.h" #endif +#if wxUSE_PRINTING_ARCHITECTURE + #include "wx/dc.h" #include "wx/cmndata.h" @@ -49,6 +51,8 @@ protected: // Gets an HDC for the specified printer configuration WXHDC WXDLLEXPORT wxGetPrinterDC(const wxPrintData& data); +#endif // wxUSE_PRINTING_ARCHITECTURE + #endif // _WX_DCPRINT_H_ diff --git a/include/wx/msw/frame.h b/include/wx/msw/frame.h index c54d5f66f8..ba106bdcd2 100644 --- a/include/wx/msw/frame.h +++ b/include/wx/msw/frame.h @@ -85,6 +85,7 @@ public: virtual void SetIcon(const wxIcon& icon); // Toolbar +#if wxUSE_TOOLBAR virtual wxToolBar* CreateToolBar(long style = wxNO_BORDER | wxTB_HORIZONTAL | wxTB_FLAT, wxWindowID id = -1, const wxString& name = wxToolBarNameStr); @@ -95,7 +96,9 @@ public: virtual wxToolBar *GetToolBar() const { return m_frameToolBar; } virtual void PositionToolBar(); +#endif // wxUSE_TOOLBAR +#if wxUSE_STATUSBAR // Status bar virtual wxStatusBar* CreateStatusBar(int number = 1, long style = wxST_SIZEGRIP, @@ -121,6 +124,7 @@ public: // TODO: should this go into a wxFrameworkSettings class perhaps? static void UseNativeStatusBar(bool useNative) { m_useNativeStatusBar = useNative; }; static bool UsesNativeStatusBar() { return m_useNativeStatusBar; }; +#endif // wxUSE_STATUSBAR // Iconize virtual void Iconize(bool iconize); @@ -191,13 +195,19 @@ protected: long MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam); wxMenuBar * m_frameMenuBar; - wxStatusBar * m_frameStatusBar; wxIcon m_icon; bool m_iconized; WXHICON m_defaultIcon; - wxToolBar * m_frameToolBar; + +#if wxUSE_STATUSBAR + wxStatusBar * m_frameStatusBar; static bool m_useNativeStatusBar; +#endif // wxUSE_STATUSBAR + +#if wxUSE_TOOLBAR + wxToolBar * m_frameToolBar; +#endif // wxUSE_TOOLBAR private: #if wxUSE_TOOLTIPS diff --git a/include/wx/msw/menu.h b/include/wx/msw/menu.h index 82663872ef..5e553d3d4c 100644 --- a/include/wx/msw/menu.h +++ b/include/wx/msw/menu.h @@ -126,8 +126,10 @@ public: void Attach(wxMenuBar *menubar); void Detach(); +#if wxUSE_ACCEL size_t GetAccelCount() const { return m_accelKeyCodes.GetCount(); } size_t CopyAccels(wxAcceleratorEntry *accels) const; +#endif // wxUSE_ACCEL #ifdef WXWIN_COMPATIBILITY void Callback(const wxFunction func) { m_callback = func; } @@ -160,8 +162,10 @@ private: wxWindow *m_pInvokingWindow; void* m_clientData; +#if wxUSE_ACCEL // the accelerators data wxArrayInt m_accelKeyCodes, m_accelFlags, m_accelIds; +#endif // wxUSE_ACCEL }; // ---------------------------------------------------------------------------- @@ -246,8 +250,11 @@ public: // attach to a frame void Attach(wxFrame *frame); +#if wxUSE_ACCEL // get the accel table for the menus const wxAcceleratorTable& GetAccelTable() const { return m_accelTable; } +#endif // wxUSE_ACCEL + // get the menu handle WXHMENU GetHMenu() const { return m_hMenu; } @@ -266,8 +273,10 @@ protected: wxFrame *m_menuBarFrame; WXHMENU m_hMenu; +#if wxUSE_ACCEL // the accelerator table for all accelerators in all our menus wxAcceleratorTable m_accelTable; +#endif // wxUSE_ACCEL }; #endif // _WX_MENU_H_ diff --git a/include/wx/msw/printdlg.h b/include/wx/msw/printdlg.h index 69921c0b4a..7704c3f15d 100644 --- a/include/wx/msw/printdlg.h +++ b/include/wx/msw/printdlg.h @@ -16,6 +16,8 @@ #pragma interface "printdlg.h" #endif +#if wxUSE_PRINTING_ARCHITECTURE + #include "wx/dialog.h" #include "wx/cmndata.h" @@ -68,5 +70,7 @@ private: wxWindow* m_dialogParent; }; +#endif // wxUSE_PRINTING_ARCHITECTURE + #endif // _WX_PRINTDLG_H_ diff --git a/include/wx/msw/private.h b/include/wx/msw/private.h index 889b6d7f67..b9decc997c 100644 --- a/include/wx/msw/private.h +++ b/include/wx/msw/private.h @@ -20,6 +20,7 @@ #include "wx/msw/winundef.h" class WXDLLEXPORT wxFont; +class WXDLLEXPORT wxWindow; // --------------------------------------------------------------------------- // private constants diff --git a/include/wx/msw/setup0.h b/include/wx/msw/setup0.h index 2d2b52a2dc..173518be10 100644 --- a/include/wx/msw/setup0.h +++ b/include/wx/msw/setup0.h @@ -179,6 +179,8 @@ #define wxUSE_ACCEL 1 #define wxUSE_SASH 1 #define wxUSE_TEXTDLG 1 +#define wxUSE_TOOLBAR 1 +#define wxUSE_STATUSBAR 1 /* * Finer detail diff --git a/include/wx/msw/tbar95.h b/include/wx/msw/tbar95.h index acbf6aed48..14e5eb14c5 100644 --- a/include/wx/msw/tbar95.h +++ b/include/wx/msw/tbar95.h @@ -6,7 +6,7 @@ // Created: 01/02/97 // RCS-ID: $Id$ // Copyright: (c) Julian Smart -// Licence: wxWindows licence +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #ifndef _WX_TBAR95_H_ @@ -16,7 +16,7 @@ #pragma interface "tbar95.h" #endif -#if wxUSE_BUTTONBAR && wxUSE_TOOLBAR +#if wxUSE_TOOLBAR #include "wx/tbarbase.h" WXDLLEXPORT_DATA(extern const wxChar*) wxToolBarNameStr; @@ -89,6 +89,7 @@ protected: DECLARE_EVENT_TABLE() }; -#endif // wxUSE_TOOL/BUTTONBAR +#endif // wxUSE_TOOLBAR + #endif // _WX_TBAR95_H_ diff --git a/include/wx/msw/treectrl.h b/include/wx/msw/treectrl.h index 97baa3f6a4..b9b401cdbc 100644 --- a/include/wx/msw/treectrl.h +++ b/include/wx/msw/treectrl.h @@ -15,6 +15,7 @@ // ---------------------------------------------------------------------------- // headers // ---------------------------------------------------------------------------- + #ifdef __GNUG__ #pragma interface "treectrl.h" #endif @@ -23,6 +24,12 @@ #include "wx/event.h" #include "wx/textctrl.h" +#ifdef __GNUWIN32__ + // Cygwin windows.h defines these identifiers + #undef GetFirstChild + #undef GetNextSibling +#endif // Cygwin + // the type for "untyped" data typedef long wxDataType; diff --git a/include/wx/prntbase.h b/include/wx/prntbase.h index 9e3cd730bc..98e4ce8f0a 100644 --- a/include/wx/prntbase.h +++ b/include/wx/prntbase.h @@ -17,6 +17,9 @@ #endif #include "wx/defs.h" + +#if wxUSE_PRINTING_ARCHITECTURE + #include "wx/event.h" #include "wx/cmndata.h" #include "wx/panel.h" @@ -367,5 +370,7 @@ private: DECLARE_EVENT_TABLE() }; +#endif // wxUSE_PRINTING_ARCHITECTURE + #endif // _WX_PRNTBASEH__ diff --git a/src/common/fileconf.cpp b/src/common/fileconf.cpp index b41119bb0a..231c156482 100644 --- a/src/common/fileconf.cpp +++ b/src/common/fileconf.cpp @@ -21,12 +21,15 @@ // ---------------------------------------------------------------------------- // headers // ---------------------------------------------------------------------------- + #include "wx/wxprec.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //__BORLANDC__ +#if wxUSE_CONFIG + #ifndef WX_PRECOMP #include "wx/string.h" #include "wx/intl.h" @@ -1483,3 +1486,6 @@ static wxString GetAppName(const wxString& appName) else return appName; } + +#endif // wxUSE_CONFIG + diff --git a/src/common/intl.cpp b/src/common/intl.cpp index 5571f62634..7153596262 100644 --- a/src/common/intl.cpp +++ b/src/common/intl.cpp @@ -28,6 +28,8 @@ #pragma hdrstop #endif +#if wxUSE_INTL + // standard headers #include #include @@ -646,3 +648,6 @@ wxLocale *wxSetLocale(wxLocale *pLocale) g_pLocale = pLocale; return pOld; } + +#endif // wxUSE_INTL + diff --git a/src/common/layout.cpp b/src/common/layout.cpp index 441a1217c0..3718e78c12 100644 --- a/src/common/layout.cpp +++ b/src/common/layout.cpp @@ -16,6 +16,7 @@ // ---------------------------------------------------------------------------- // headers // ---------------------------------------------------------------------------- + #ifdef __GNUG__ #pragma implementation "layout.h" #endif @@ -29,6 +30,8 @@ #include "wx/defs.h" +#if wxUSE_CONSTRAINTS + #ifndef WX_PRECOMP #include "wx/window.h" #include "wx/utils.h" @@ -1762,3 +1765,4 @@ wxSpacingSizer::~wxSpacingSizer() { } +#endif // wxUSE_CONSTRAINTS diff --git a/src/common/parser.y b/src/common/parser.y index cea8e3a3bb..ee3db0f8ec 100644 --- a/src/common/parser.y +++ b/src/common/parser.y @@ -1,4 +1,5 @@ %{ +#include "wx/setup.h" #include #ifdef _MSC_VER #include @@ -156,7 +157,7 @@ void yyerror(char *s) * to test */ -#ifndef __SC__ +#if !defined(__SC__) && !defined(__GNUWIN32__) #ifdef USE_DEFINE #ifndef yywrap #define yywrap() 1 diff --git a/src/common/prntbase.cpp b/src/common/prntbase.cpp index 71843dd88c..0c2aba22e5 100644 --- a/src/common/prntbase.cpp +++ b/src/common/prntbase.cpp @@ -22,6 +22,8 @@ #include "wx/defs.h" +#if wxUSE_PRINTING_ARCHITECTURE + #ifndef WX_PRECOMP #include "wx/utils.h" #include "wx/dc.h" @@ -45,20 +47,13 @@ #include #ifdef __WXMSW__ -#include -#include - -// Clash with Windows header files -#ifdef StartDoc -#undef StartDoc -#endif + #include "wx/msw/private.h" + #include -#ifndef __WIN32__ -#include -#endif - -#endif -// End __WXMSW__ + #ifndef __WIN32__ + #include + #endif +#endif // __WXMSW__ #if !USE_SHARED_LIBRARY IMPLEMENT_CLASS(wxPrinterBase, wxObject) @@ -69,12 +64,12 @@ IMPLEMENT_CLASS(wxPreviewFrame, wxFrame) IMPLEMENT_CLASS(wxPrintPreviewBase, wxObject) BEGIN_EVENT_TABLE(wxPrintAbortDialog, wxDialog) -EVT_BUTTON(wxID_CANCEL, wxPrintAbortDialog::OnCancel) + EVT_BUTTON(wxID_CANCEL, wxPrintAbortDialog::OnCancel) END_EVENT_TABLE() BEGIN_EVENT_TABLE(wxPreviewCanvas, wxScrolledWindow) -EVT_PAINT(wxPreviewCanvas::OnPaint) -EVT_SYS_COLOUR_CHANGED(wxPreviewCanvas::OnSysColourChanged) + EVT_PAINT(wxPreviewCanvas::OnPaint) + EVT_SYS_COLOUR_CHANGED(wxPreviewCanvas::OnSysColourChanged) END_EVENT_TABLE() #endif @@ -763,3 +758,4 @@ void wxPrintPreviewBase::SetZoom(int percent) } } +#endif // wxUSE_PRINTING_ARCHITECTURE diff --git a/src/generic/choicdgg.cpp b/src/generic/choicdgg.cpp index 3758f96020..efe516c05d 100644 --- a/src/generic/choicdgg.cpp +++ b/src/generic/choicdgg.cpp @@ -6,29 +6,31 @@ // Created: 04/01/98 // RCS-ID: $Id$ // Copyright: (c) Julian Smart and Markus Holzem -// Licence: wxWindows license +// Licence: wxWindows license ///////////////////////////////////////////////////////////////////////////// #ifdef __GNUG__ -#pragma implementation "choicdgg.h" + #pragma implementation "choicdgg.h" #endif // For compilers that support precompilation, includes "wx.h". #include "wx/wxprec.h" #ifdef __BORLANDC__ -#pragma hdrstop + #pragma hdrstop #endif +#if wxUSE_CONSTRAINTS + #ifndef WX_PRECOMP -#include -#include "wx/utils.h" -#include "wx/dialog.h" -#include "wx/listbox.h" -#include "wx/button.h" -#include "wx/stattext.h" -#include "wx/layout.h" -#include "wx/intl.h" + #include + #include "wx/utils.h" + #include "wx/dialog.h" + #include "wx/listbox.h" + #include "wx/button.h" + #include "wx/stattext.h" + #include "wx/layout.h" + #include "wx/intl.h" #endif #include "wx/generic/choicdgg.h" @@ -50,10 +52,10 @@ static void wxSplitMessage2(const wxChar *message, wxList *messageList, wxWindow /* wxLayoutConstraints *c = new wxLayoutConstraints; - c->left.SameAs (parent, wxLeft, 10); - c->top.SameAs (lastWindow, wxBottom, 5); - c->right.AsIs (); - c->height.AsIs (); + c->left.SameAs (parent, wxLeft, 10); + c->top.SameAs (lastWindow, wxBottom, 5); + c->right.AsIs (); + c->height.AsIs (); mess->SetConstraints(c); */ @@ -68,98 +70,98 @@ static void wxSplitMessage2(const wxChar *message, wxList *messageList, wxWindow wxString wxGetSingleChoice( const wxString& message, const wxString& caption, int n, const wxString *choices, wxWindow *parent, - int WXUNUSED(x), int WXUNUSED(y), bool WXUNUSED(centre), - int WXUNUSED(width), int WXUNUSED(height) ) + int WXUNUSED(x), int WXUNUSED(y), bool WXUNUSED(centre), + int WXUNUSED(width), int WXUNUSED(height) ) { - wxSingleChoiceDialog dialog(parent, message, caption, n, choices); - if ( dialog.ShowModal() == wxID_OK ) - { - return dialog.GetStringSelection(); - } - else - return ""; + wxSingleChoiceDialog dialog(parent, message, caption, n, choices); + if ( dialog.ShowModal() == wxID_OK ) + { + return dialog.GetStringSelection(); + } + else + return ""; } // Overloaded for backward compatibility wxString wxGetSingleChoice( const wxString& message, const wxString& caption, int n, char *choices[], wxWindow *parent, - int x, int y, bool centre, - int width, int height ) + int x, int y, bool centre, + int width, int height ) { - wxString *strings = new wxString[n]; - int i; - for ( i = 0; i < n; i++) - { - strings[i] = choices[i]; - } - wxString ans(wxGetSingleChoice(message, caption, n, (const wxString *)strings, parent, - x, y, centre, width, height)); - delete[] strings; - return ans; + wxString *strings = new wxString[n]; + int i; + for ( i = 0; i < n; i++) + { + strings[i] = choices[i]; + } + wxString ans(wxGetSingleChoice(message, caption, n, (const wxString *)strings, parent, + x, y, centre, width, height)); + delete[] strings; + return ans; } int wxGetSingleChoiceIndex( const wxString& message, const wxString& caption, int n, const wxString *choices, wxWindow *parent, - int WXUNUSED(x), int WXUNUSED(y), bool WXUNUSED(centre), - int WXUNUSED(width), int WXUNUSED(height) ) + int WXUNUSED(x), int WXUNUSED(y), bool WXUNUSED(centre), + int WXUNUSED(width), int WXUNUSED(height) ) { - wxSingleChoiceDialog dialog(parent, message, caption, n, choices); - if ( dialog.ShowModal() == wxID_OK ) - { - return dialog.GetSelection(); - } - else - return -1; + wxSingleChoiceDialog dialog(parent, message, caption, n, choices); + if ( dialog.ShowModal() == wxID_OK ) + { + return dialog.GetSelection(); + } + else + return -1; } // Overloaded for backward compatibility int wxGetSingleChoiceIndex( const wxString& message, const wxString& caption, int n, wxChar *choices[], wxWindow *parent, - int x, int y, bool centre, - int width, int height ) + int x, int y, bool centre, + int width, int height ) { - wxString *strings = new wxString[n]; - int i; - for ( i = 0; i < n; i++) - { - strings[i] = choices[i]; - } - int ans = wxGetSingleChoiceIndex(message, caption, n, (const wxString *)strings, parent, - x, y, centre, width, height); - delete[] strings; - return ans; + wxString *strings = new wxString[n]; + int i; + for ( i = 0; i < n; i++) + { + strings[i] = choices[i]; + } + int ans = wxGetSingleChoiceIndex(message, caption, n, (const wxString *)strings, parent, + x, y, centre, width, height); + delete[] strings; + return ans; } wxChar *wxGetSingleChoiceData( const wxString& message, const wxString& caption, int n, - const wxString *choices, wxChar **client_data, wxWindow *parent, - int WXUNUSED(x), int WXUNUSED(y), bool WXUNUSED(centre), - int WXUNUSED(width), int WXUNUSED(height) ) + const wxString *choices, wxChar **client_data, wxWindow *parent, + int WXUNUSED(x), int WXUNUSED(y), bool WXUNUSED(centre), + int WXUNUSED(width), int WXUNUSED(height) ) { - wxSingleChoiceDialog dialog(parent, message, caption, n, choices, client_data); - if ( dialog.ShowModal() == wxID_OK ) - { - return dialog.GetSelectionClientData(); - } - else - return NULL; + wxSingleChoiceDialog dialog(parent, message, caption, n, choices, client_data); + if ( dialog.ShowModal() == wxID_OK ) + { + return dialog.GetSelectionClientData(); + } + else + return NULL; } // Overloaded for backward compatibility wxChar *wxGetSingleChoiceData( const wxString& message, const wxString& caption, int n, - wxChar *choices[], wxChar **client_data, wxWindow *parent, - int x, int y, bool centre, - int width, int height ) + wxChar *choices[], wxChar **client_data, wxWindow *parent, + int x, int y, bool centre, + int width, int height ) { - wxString *strings = new wxString[n]; - int i; - for ( i = 0; i < n; i++) - { - strings[i] = choices[i]; - } - wxChar *data = wxGetSingleChoiceData(message, caption, n, (const wxString *)strings, client_data, parent, - x, y, centre, width, height); - delete[] strings; - return data; + wxString *strings = new wxString[n]; + int i; + for ( i = 0; i < n; i++) + { + strings[i] = choices[i]; + } + wxChar *data = wxGetSingleChoiceData(message, caption, n, (const wxString *)strings, client_data, parent, + x, y, centre, width, height); + delete[] strings; + return data; } @@ -181,12 +183,12 @@ selected. */ /* int wxGetMultipleChoice(const wxString& message, const wxString& caption, - int n, const wxString *choices, - int nsel, int * selection, - wxWindow *parent , int x , int y, bool centre, - int width, int height) + int n, const wxString *choices, + int nsel, int * selection, + wxWindow *parent , int x , int y, bool centre, + int width, int height) { - return -1; + return -1; } */ @@ -194,8 +196,8 @@ int wxGetMultipleChoice(const wxString& message, const wxString& caption, #if !USE_SHARED_LIBRARY BEGIN_EVENT_TABLE(wxSingleChoiceDialog, wxDialog) - EVT_BUTTON(wxID_OK, wxSingleChoiceDialog::OnOK) - EVT_LISTBOX_DCLICK(wxID_LISTBOX, wxSingleChoiceDialog::OnListBoxDClick) + EVT_BUTTON(wxID_OK, wxSingleChoiceDialog::OnOK) + EVT_LISTBOX_DCLICK(wxID_LISTBOX, wxSingleChoiceDialog::OnListBoxDClick) END_EVENT_TABLE() IMPLEMENT_CLASS(wxSingleChoiceDialog, wxDialog) @@ -203,14 +205,14 @@ IMPLEMENT_CLASS(wxSingleChoiceDialog, wxDialog) wxSingleChoiceDialog::wxSingleChoiceDialog(wxWindow *parent, const wxString& message, const wxString& caption, int n, const wxString *choices, wxChar **clientData, long style, const wxPoint& pos): - wxDialog(parent, -1, caption, pos, wxDefaultSize, wxDEFAULT_DIALOG_STYLE|wxDIALOG_MODAL|wxTAB_TRAVERSAL) + wxDialog(parent, -1, caption, pos, wxDefaultSize, wxDEFAULT_DIALOG_STYLE|wxDIALOG_MODAL|wxTAB_TRAVERSAL) { Create(parent, message, caption, n, choices, clientData, style); } wxSingleChoiceDialog::wxSingleChoiceDialog(wxWindow *parent, const wxString& message, const wxString& caption, const wxStringList& choices, wxChar **clientData, long style, const wxPoint& pos): - wxDialog(parent, -1, caption, pos, wxDefaultSize, wxDEFAULT_DIALOG_STYLE|wxDIALOG_MODAL) + wxDialog(parent, -1, caption, pos, wxDefaultSize, wxDEFAULT_DIALOG_STYLE|wxDIALOG_MODAL) { Create(parent, message, caption, choices, clientData, style); } @@ -218,113 +220,113 @@ wxSingleChoiceDialog::wxSingleChoiceDialog(wxWindow *parent, const wxString& mes bool wxSingleChoiceDialog::Create(wxWindow *parent, const wxString& message, const wxString& caption, const wxStringList& choices, wxChar **clientData, long style, const wxPoint& pos) { - wxString *strings = new wxString[choices.Number()]; - int i; - for ( i = 0; i < choices.Number(); i++) - { - strings[i] = (char *)choices.Nth(i)->Data(); - } - bool ans = Create(parent, message, caption, choices.Number(), strings, clientData, style, pos); - delete[] strings; - return ans; + wxString *strings = new wxString[choices.Number()]; + int i; + for ( i = 0; i < choices.Number(); i++) + { + strings[i] = (char *)choices.Nth(i)->Data(); + } + bool ans = Create(parent, message, caption, choices.Number(), strings, clientData, style, pos); + delete[] strings; + return ans; } bool wxSingleChoiceDialog::Create( wxWindow *WXUNUSED(parent), const wxString& message, const wxString& WXUNUSED(caption), int n, - const wxString *choices, wxChar **clientData, long style, - const wxPoint& WXUNUSED(pos) ) + const wxString *choices, wxChar **clientData, long style, + const wxPoint& WXUNUSED(pos) ) { - m_dialogStyle = style; - m_selection = 0; - m_stringSelection = _T(""); - m_clientData = NULL; + m_dialogStyle = style; + m_selection = 0; + m_stringSelection = _T(""); + m_clientData = NULL; - wxBeginBusyCursor(); + wxBeginBusyCursor(); - wxSizer *topSizer = new wxSizer(this, wxSizerShrink); - topSizer->SetBorder(10, 10); + wxSizer *topSizer = new wxSizer(this, wxSizerShrink); + topSizer->SetBorder(10, 10); - wxRowColSizer *messageSizer = new wxRowColSizer(topSizer, wxSIZER_COLS, 100); - messageSizer->SetName(_T("messageSizer")); + wxRowColSizer *messageSizer = new wxRowColSizer(topSizer, wxSIZER_COLS, 100); + messageSizer->SetName(_T("messageSizer")); -// bool centre = ((style & wxCENTRE) == wxCENTRE); + // bool centre = ((style & wxCENTRE) == wxCENTRE); - wxList messageList; - wxSplitMessage2(message, &messageList, this, messageSizer); + wxList messageList; + wxSplitMessage2(message, &messageList, this, messageSizer); - // Insert a spacer - wxSpacingSizer *spacingSizer = new wxSpacingSizer(topSizer, wxBelow, messageSizer, 10); + // Insert a spacer + wxSpacingSizer *spacingSizer = new wxSpacingSizer(topSizer, wxBelow, messageSizer, 10); - wxListBox *listBox = new wxListBox(this, wxID_LISTBOX, wxPoint(-1, -1), wxSize(240, 160), - n, choices); + wxListBox *listBox = new wxListBox(this, wxID_LISTBOX, wxPoint(-1, -1), wxSize(240, 160), + n, choices); listBox->SetSelection(m_selection); - if ( clientData ) - { - int i; - for ( i = 0; i < n; i++) - { - listBox->SetClientData(i, clientData[i]); - } - } - - wxRowColSizer *listBoxSizer = new wxRowColSizer(topSizer, wxSIZER_ROWS); - listBoxSizer->AddSizerChild(listBox); - listBoxSizer->SetName(_T("listBoxSizer")); - - // Create constraints for the text sizer - wxLayoutConstraints *textC = new wxLayoutConstraints; - textC->left.SameAs (messageSizer, wxLeft); - textC->top.Below (spacingSizer); - listBoxSizer->SetConstraints(textC); - - // Insert another spacer - wxSpacingSizer *spacingSizer2 = new wxSpacingSizer(topSizer, wxBelow, listBoxSizer, 10); - spacingSizer->SetName(_T("spacingSizer2")); - - // Insert a sizer for the buttons - wxRowColSizer *buttonSizer = new wxRowColSizer(topSizer, wxSIZER_ROWS); - buttonSizer->SetName(_T("buttonSizer")); - buttonSizer->SetSpacing(12,0); - - // Specify constraints for the button sizer - wxLayoutConstraints *c = new wxLayoutConstraints; - c->width.AsIs (); - c->height.AsIs (); - c->top.Below (spacingSizer2); - c->centreX.SameAs (listBoxSizer, wxCentreX); - buttonSizer->SetConstraints(c); + if ( clientData ) + { + int i; + for ( i = 0; i < n; i++) + { + listBox->SetClientData(i, clientData[i]); + } + } + + wxRowColSizer *listBoxSizer = new wxRowColSizer(topSizer, wxSIZER_ROWS); + listBoxSizer->AddSizerChild(listBox); + listBoxSizer->SetName(_T("listBoxSizer")); + + // Create constraints for the text sizer + wxLayoutConstraints *textC = new wxLayoutConstraints; + textC->left.SameAs (messageSizer, wxLeft); + textC->top.Below (spacingSizer); + listBoxSizer->SetConstraints(textC); + + // Insert another spacer + wxSpacingSizer *spacingSizer2 = new wxSpacingSizer(topSizer, wxBelow, listBoxSizer, 10); + spacingSizer->SetName(_T("spacingSizer2")); + + // Insert a sizer for the buttons + wxRowColSizer *buttonSizer = new wxRowColSizer(topSizer, wxSIZER_ROWS); + buttonSizer->SetName(_T("buttonSizer")); + buttonSizer->SetSpacing(12,0); + + // Specify constraints for the button sizer + wxLayoutConstraints *c = new wxLayoutConstraints; + c->width.AsIs (); + c->height.AsIs (); + c->top.Below (spacingSizer2); + c->centreX.SameAs (listBoxSizer, wxCentreX); + buttonSizer->SetConstraints(c); wxButton *ok = NULL; - wxButton *cancel = NULL; + wxButton *cancel = NULL; - if (style & wxOK) { - ok = new wxButton(this, wxID_OK, _("OK"), wxDefaultPosition, wxSize(75,-1) ); - buttonSizer->AddSizerChild(ok); - } + if (style & wxOK) { + ok = new wxButton(this, wxID_OK, _("OK"), wxDefaultPosition, wxSize(75,-1) ); + buttonSizer->AddSizerChild(ok); + } - if (style & wxCANCEL) { - cancel = new wxButton(this, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxSize(75,-1)); - buttonSizer->AddSizerChild(cancel); - } + if (style & wxCANCEL) { + cancel = new wxButton(this, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxSize(75,-1)); + buttonSizer->AddSizerChild(cancel); + } - if (ok) - { - ok->SetDefault(); - ok->SetFocus(); - } + if (ok) + { + ok->SetDefault(); + ok->SetFocus(); + } - Layout(); - Centre(wxBOTH); + Layout(); + Centre(wxBOTH); - wxEndBusyCursor(); + wxEndBusyCursor(); - return TRUE; + return TRUE; } // Set the selection void wxSingleChoiceDialog::SetSelection(int sel) { - wxListBox *listBox = (wxListBox *)FindWindow(wxID_LISTBOX); + wxListBox *listBox = (wxListBox *)FindWindow(wxID_LISTBOX); if (listBox) { listBox->SetSelection(sel); @@ -334,28 +336,29 @@ void wxSingleChoiceDialog::SetSelection(int sel) void wxSingleChoiceDialog::OnOK(wxCommandEvent& WXUNUSED(event)) { - wxListBox *listBox = (wxListBox *)FindWindow(wxID_LISTBOX); - if ( listBox ) - { - m_selection = listBox->GetSelection(); - m_stringSelection = listBox->GetStringSelection(); - m_clientData = (wxChar*)listBox->GetClientData(m_selection); - } - - EndModal(wxID_OK); + wxListBox *listBox = (wxListBox *)FindWindow(wxID_LISTBOX); + if ( listBox ) + { + m_selection = listBox->GetSelection(); + m_stringSelection = listBox->GetStringSelection(); + m_clientData = (wxChar*)listBox->GetClientData(m_selection); + } + + EndModal(wxID_OK); } void wxSingleChoiceDialog::OnListBoxDClick(wxCommandEvent& WXUNUSED(event)) { - wxListBox *listBox = (wxListBox *)FindWindow(wxID_LISTBOX); - if ( listBox ) - { - m_selection = listBox->GetSelection(); - m_stringSelection = listBox->GetStringSelection(); - m_clientData = (wxChar*)listBox->GetClientData(m_selection); - } - - EndModal(wxID_OK); + wxListBox *listBox = (wxListBox *)FindWindow(wxID_LISTBOX); + if ( listBox ) + { + m_selection = listBox->GetSelection(); + m_stringSelection = listBox->GetStringSelection(); + m_clientData = (wxChar*)listBox->GetClientData(m_selection); + } + + EndModal(wxID_OK); } +#endif // wxUSE_CONSTRAINTS diff --git a/src/msw/Makefile.am b/src/msw/Makefile.am index 9a155b7aa0..45128e4bbf 100644 --- a/src/msw/Makefile.am +++ b/src/msw/Makefile.am @@ -19,7 +19,6 @@ EXTRA_LTLIBRARIES = libwx_gtk.la libwx_motif.la libwx_msw.la # these are the common files which always make part of the library libwx_msw_la_SOURCES = \ \ - winestub.c \ extended.c \ parser.c \ \ @@ -178,12 +177,14 @@ libwx_msw_la_SOURCES = \ # don't know where to put lexer.l - if I put it in the sources too, # automake tries to build lexer.lo... and fails, of course. (VZ) BUILT_SOURCES = parser.c lexer.c + +# VZ: can anyone please explain me why are we doing these substitutions? parser.c: $(srcdir)/../common/parser.y lexer.c $(YACC) $(srcdir)/../common/parser.y @sed -e "s;$(srcdir)/../common/y.tab.c;parser.y;g" < y.tab.c | \ sed -e "s/BUFSIZ/5000/g" | \ sed -e "s/YYLMAX 200/YYLMAX 5000/g" | \ - sed -e "s/yy/PROIO_yy/g" | \ + sed -e "s/yy\([^.]\)/PROIO_yy\1/g" | \ sed -e "s/input/PROIO_input/g" | \ sed -e "s/unput/PROIO_unput/g" > parser.c @$(RM) y.tab.c @@ -191,13 +192,13 @@ parser.c: $(srcdir)/../common/parser.y lexer.c lexer.c: $(srcdir)/../common/lexer.l $(LEX) $(srcdir)/../common/lexer.l @sed -e "s;$(srcdir)/../common/lex.yy.c;lexer.l;g" < lex.yy.c | \ - sed -e "s/yy/PROIO_yy/g" | \ + sed -e "s/yy\([^.]\)/PROIO_yy\1/g" | \ sed -e "s/input/PROIO_input/g" | \ sed -e "s/unput/PROIO_unput/g" > lexer.c @$(RM) lex.yy.c libwx_msw_la_LDFLAGS = -rpath @libdir@ \ -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) \ - -release $(LT_RELEASE) + -release $(LT_RELEASE) -no-undefined libwx_msw_la_LIBADD = $(LTLIBOBJS) libwx_msw_la_DEPENDENCIES = $(libwx_msw_la_LIBADD) lexer.l parser.y diff --git a/src/msw/frame.cpp b/src/msw/frame.cpp index 2c459e4c3a..c71be7552c 100644 --- a/src/msw/frame.cpp +++ b/src/msw/frame.cpp @@ -346,6 +346,7 @@ void wxFrame::SetIcon(const wxIcon& icon) #endif } +#if wxUSE_STATUSBAR wxStatusBar *wxFrame::OnCreateStatusBar(int number, long style, wxWindowID id, const wxString& name) { @@ -430,6 +431,7 @@ void wxFrame::PositionStatusBar() m_frameStatusBar->SetSize(0, h, w, sh); } } +#endif // wxUSE_STATUSBAR void wxFrame::SetMenuBar(wxMenuBar *menu_bar) { @@ -571,13 +573,19 @@ void wxFrame::OnSize(wxSizeEvent& event) // do we have _exactly_ one child? wxWindow *child = NULL; - for ( wxNode *node = GetChildren().First(); node; node = node->Next() ) + for ( wxWindowList::Node *node = GetChildren().GetFirst(); + node; + node = node->GetNext() ) { - wxWindow *win = (wxWindow *)node->Data(); - if ( !win->IsKindOf(CLASSINFO(wxFrame)) && - !win->IsKindOf(CLASSINFO(wxDialog)) && - (win != GetStatusBar()) && - (win != GetToolBar()) ) + wxWindow *win = node->GetData(); + if ( !win->IsTopLevel() +#if wxUSE_STATUSBAR + && (win != GetStatusBar()) +#endif // wxUSE_STATUSBAR +#if wxUSE_TOOLBAR + && (win != GetToolBar()) +#endif // wxUSE_TOOLBAR + ) { if ( child ) return; // it's our second subwindow - nothing to do @@ -720,6 +728,7 @@ void wxFrame::ClientToScreen(int *x, int *y) const wxWindow::ClientToScreen(x, y); } +#if wxUSE_TOOLBAR wxToolBar* wxFrame::CreateToolBar(long style, wxWindowID id, const wxString& name) { wxCHECK_MSG( m_frameToolBar == NULL, FALSE, @@ -772,6 +781,7 @@ void wxFrame::PositionToolBar() } } } +#endif // wxUSE_TOOLBAR // propagate our state change to all child frames: this allows us to emulate X // Windows behaviour where child frames float independently of the parent one diff --git a/src/msw/menu.cpp b/src/msw/menu.cpp index 59fc836e29..94bb4a0116 100644 --- a/src/msw/menu.cpp +++ b/src/msw/menu.cpp @@ -146,6 +146,7 @@ void wxMenu::Append(wxMenuItem *pItem) { wxCHECK_RET( pItem != NULL, "can't append NULL item to the menu" ); +#if wxUSE_ACCEL // check for accelerators: they are given after '\t' wxString label = pItem->GetName(); int posTab = label.Find('\t'); @@ -206,6 +207,7 @@ void wxMenu::Append(wxMenuItem *pItem) m_accelIds.Add(pItem->GetId()); } } +#endif // wxUSE_ACCEL UINT flags = 0; @@ -344,6 +346,8 @@ void wxMenu::Delete(int id) delete item; } +#if wxUSE_ACCEL + // --------------------------------------------------------------------------- // accelerator helpers // --------------------------------------------------------------------------- @@ -361,6 +365,8 @@ size_t wxMenu::CopyAccels(wxAcceleratorEntry *accels) const return count; } +#endif // wxUSE_ACCEL + // --------------------------------------------------------------------------- // wxMenu functions implemented in wxMenuItem // --------------------------------------------------------------------------- @@ -1014,6 +1020,7 @@ void wxMenuBar::Attach(wxFrame *frame) m_menuBarFrame = frame; +#if wxUSE_ACCEL // create the accel table - we consider that the menubar construction is // finished size_t nAccelCount = 0; @@ -1037,6 +1044,7 @@ void wxMenuBar::Attach(wxFrame *frame) delete [] accelEntries; } +#endif // wxUSE_ACCEL } // --------------------------------------------------------------------------- -- 2.45.2