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
This commit is contained in:
Vadim Zeitlin
1999-06-13 22:54:04 +00:00
parent a9b5e89f5f
commit d427503c36
19 changed files with 306 additions and 231 deletions

View File

@@ -60,22 +60,6 @@ enum
wxCONFIG_USE_RELATIVE_PATH = 4 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 // abstract base class wxConfigBase which defines the interface for derived
// classes // classes
@@ -311,9 +295,23 @@ private:
#define sm_classwxConfig sm_classwxFileConfig #define sm_classwxConfig sm_classwxFileConfig
#endif #endif
#endif #endif // wxUSE_CONFIG
// wxUSE_CONFIG // ----------------------------------------------------------------------------
// various helper global functions (defined even if !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 #endif
// _WX_CONFIG_H_ // _WX_CONFIG_H_

View File

@@ -16,6 +16,8 @@
#pragma interface "dcprint.h" #pragma interface "dcprint.h"
#endif #endif
#if wxUSE_PRINTING_ARCHITECTURE
#include "wx/dc.h" #include "wx/dc.h"
#include "wx/cmndata.h" #include "wx/cmndata.h"
@@ -49,6 +51,8 @@ protected:
// Gets an HDC for the specified printer configuration // Gets an HDC for the specified printer configuration
WXHDC WXDLLEXPORT wxGetPrinterDC(const wxPrintData& data); WXHDC WXDLLEXPORT wxGetPrinterDC(const wxPrintData& data);
#endif // wxUSE_PRINTING_ARCHITECTURE
#endif #endif
// _WX_DCPRINT_H_ // _WX_DCPRINT_H_

View File

@@ -85,6 +85,7 @@ public:
virtual void SetIcon(const wxIcon& icon); virtual void SetIcon(const wxIcon& icon);
// Toolbar // Toolbar
#if wxUSE_TOOLBAR
virtual wxToolBar* CreateToolBar(long style = wxNO_BORDER | wxTB_HORIZONTAL | wxTB_FLAT, virtual wxToolBar* CreateToolBar(long style = wxNO_BORDER | wxTB_HORIZONTAL | wxTB_FLAT,
wxWindowID id = -1, wxWindowID id = -1,
const wxString& name = wxToolBarNameStr); const wxString& name = wxToolBarNameStr);
@@ -95,7 +96,9 @@ public:
virtual wxToolBar *GetToolBar() const { return m_frameToolBar; } virtual wxToolBar *GetToolBar() const { return m_frameToolBar; }
virtual void PositionToolBar(); virtual void PositionToolBar();
#endif // wxUSE_TOOLBAR
#if wxUSE_STATUSBAR
// Status bar // Status bar
virtual wxStatusBar* CreateStatusBar(int number = 1, virtual wxStatusBar* CreateStatusBar(int number = 1,
long style = wxST_SIZEGRIP, long style = wxST_SIZEGRIP,
@@ -121,6 +124,7 @@ public:
// TODO: should this go into a wxFrameworkSettings class perhaps? // TODO: should this go into a wxFrameworkSettings class perhaps?
static void UseNativeStatusBar(bool useNative) { m_useNativeStatusBar = useNative; }; static void UseNativeStatusBar(bool useNative) { m_useNativeStatusBar = useNative; };
static bool UsesNativeStatusBar() { return m_useNativeStatusBar; }; static bool UsesNativeStatusBar() { return m_useNativeStatusBar; };
#endif // wxUSE_STATUSBAR
// Iconize // Iconize
virtual void Iconize(bool iconize); virtual void Iconize(bool iconize);
@@ -191,13 +195,19 @@ protected:
long MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam); long MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
wxMenuBar * m_frameMenuBar; wxMenuBar * m_frameMenuBar;
wxStatusBar * m_frameStatusBar;
wxIcon m_icon; wxIcon m_icon;
bool m_iconized; bool m_iconized;
WXHICON m_defaultIcon; WXHICON m_defaultIcon;
wxToolBar * m_frameToolBar;
#if wxUSE_STATUSBAR
wxStatusBar * m_frameStatusBar;
static bool m_useNativeStatusBar; static bool m_useNativeStatusBar;
#endif // wxUSE_STATUSBAR
#if wxUSE_TOOLBAR
wxToolBar * m_frameToolBar;
#endif // wxUSE_TOOLBAR
private: private:
#if wxUSE_TOOLTIPS #if wxUSE_TOOLTIPS

View File

@@ -126,8 +126,10 @@ public:
void Attach(wxMenuBar *menubar); void Attach(wxMenuBar *menubar);
void Detach(); void Detach();
#if wxUSE_ACCEL
size_t GetAccelCount() const { return m_accelKeyCodes.GetCount(); } size_t GetAccelCount() const { return m_accelKeyCodes.GetCount(); }
size_t CopyAccels(wxAcceleratorEntry *accels) const; size_t CopyAccels(wxAcceleratorEntry *accels) const;
#endif // wxUSE_ACCEL
#ifdef WXWIN_COMPATIBILITY #ifdef WXWIN_COMPATIBILITY
void Callback(const wxFunction func) { m_callback = func; } void Callback(const wxFunction func) { m_callback = func; }
@@ -160,8 +162,10 @@ private:
wxWindow *m_pInvokingWindow; wxWindow *m_pInvokingWindow;
void* m_clientData; void* m_clientData;
#if wxUSE_ACCEL
// the accelerators data // the accelerators data
wxArrayInt m_accelKeyCodes, m_accelFlags, m_accelIds; wxArrayInt m_accelKeyCodes, m_accelFlags, m_accelIds;
#endif // wxUSE_ACCEL
}; };
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@@ -246,8 +250,11 @@ public:
// attach to a frame // attach to a frame
void Attach(wxFrame *frame); void Attach(wxFrame *frame);
#if wxUSE_ACCEL
// get the accel table for the menus // get the accel table for the menus
const wxAcceleratorTable& GetAccelTable() const { return m_accelTable; } const wxAcceleratorTable& GetAccelTable() const { return m_accelTable; }
#endif // wxUSE_ACCEL
// get the menu handle // get the menu handle
WXHMENU GetHMenu() const { return m_hMenu; } WXHMENU GetHMenu() const { return m_hMenu; }
@@ -266,8 +273,10 @@ protected:
wxFrame *m_menuBarFrame; wxFrame *m_menuBarFrame;
WXHMENU m_hMenu; WXHMENU m_hMenu;
#if wxUSE_ACCEL
// the accelerator table for all accelerators in all our menus // the accelerator table for all accelerators in all our menus
wxAcceleratorTable m_accelTable; wxAcceleratorTable m_accelTable;
#endif // wxUSE_ACCEL
}; };
#endif // _WX_MENU_H_ #endif // _WX_MENU_H_

View File

@@ -16,6 +16,8 @@
#pragma interface "printdlg.h" #pragma interface "printdlg.h"
#endif #endif
#if wxUSE_PRINTING_ARCHITECTURE
#include "wx/dialog.h" #include "wx/dialog.h"
#include "wx/cmndata.h" #include "wx/cmndata.h"
@@ -68,5 +70,7 @@ private:
wxWindow* m_dialogParent; wxWindow* m_dialogParent;
}; };
#endif // wxUSE_PRINTING_ARCHITECTURE
#endif #endif
// _WX_PRINTDLG_H_ // _WX_PRINTDLG_H_

View File

@@ -20,6 +20,7 @@
#include "wx/msw/winundef.h" #include "wx/msw/winundef.h"
class WXDLLEXPORT wxFont; class WXDLLEXPORT wxFont;
class WXDLLEXPORT wxWindow;
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// private constants // private constants

View File

@@ -179,6 +179,8 @@
#define wxUSE_ACCEL 1 #define wxUSE_ACCEL 1
#define wxUSE_SASH 1 #define wxUSE_SASH 1
#define wxUSE_TEXTDLG 1 #define wxUSE_TEXTDLG 1
#define wxUSE_TOOLBAR 1
#define wxUSE_STATUSBAR 1
/* /*
* Finer detail * Finer detail

View File

@@ -6,7 +6,7 @@
// Created: 01/02/97 // Created: 01/02/97
// RCS-ID: $Id$ // RCS-ID: $Id$
// Copyright: (c) Julian Smart // Copyright: (c) Julian Smart
// Licence: wxWindows licence // Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
#ifndef _WX_TBAR95_H_ #ifndef _WX_TBAR95_H_
@@ -16,7 +16,7 @@
#pragma interface "tbar95.h" #pragma interface "tbar95.h"
#endif #endif
#if wxUSE_BUTTONBAR && wxUSE_TOOLBAR #if wxUSE_TOOLBAR
#include "wx/tbarbase.h" #include "wx/tbarbase.h"
WXDLLEXPORT_DATA(extern const wxChar*) wxToolBarNameStr; WXDLLEXPORT_DATA(extern const wxChar*) wxToolBarNameStr;
@@ -89,6 +89,7 @@ protected:
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };
#endif // wxUSE_TOOL/BUTTONBAR #endif // wxUSE_TOOLBAR
#endif #endif
// _WX_TBAR95_H_ // _WX_TBAR95_H_

View File

@@ -15,6 +15,7 @@
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// headers // headers
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
#ifdef __GNUG__ #ifdef __GNUG__
#pragma interface "treectrl.h" #pragma interface "treectrl.h"
#endif #endif
@@ -23,6 +24,12 @@
#include "wx/event.h" #include "wx/event.h"
#include "wx/textctrl.h" #include "wx/textctrl.h"
#ifdef __GNUWIN32__
// Cygwin windows.h defines these identifiers
#undef GetFirstChild
#undef GetNextSibling
#endif // Cygwin
// the type for "untyped" data // the type for "untyped" data
typedef long wxDataType; typedef long wxDataType;

View File

@@ -17,6 +17,9 @@
#endif #endif
#include "wx/defs.h" #include "wx/defs.h"
#if wxUSE_PRINTING_ARCHITECTURE
#include "wx/event.h" #include "wx/event.h"
#include "wx/cmndata.h" #include "wx/cmndata.h"
#include "wx/panel.h" #include "wx/panel.h"
@@ -367,5 +370,7 @@ private:
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };
#endif // wxUSE_PRINTING_ARCHITECTURE
#endif #endif
// _WX_PRNTBASEH__ // _WX_PRNTBASEH__

View File

@@ -21,12 +21,15 @@
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// headers // headers
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
#include "wx/wxprec.h" #include "wx/wxprec.h"
#ifdef __BORLANDC__ #ifdef __BORLANDC__
#pragma hdrstop #pragma hdrstop
#endif //__BORLANDC__ #endif //__BORLANDC__
#if wxUSE_CONFIG
#ifndef WX_PRECOMP #ifndef WX_PRECOMP
#include "wx/string.h" #include "wx/string.h"
#include "wx/intl.h" #include "wx/intl.h"
@@ -1483,3 +1486,6 @@ static wxString GetAppName(const wxString& appName)
else else
return appName; return appName;
} }
#endif // wxUSE_CONFIG

View File

@@ -28,6 +28,8 @@
#pragma hdrstop #pragma hdrstop
#endif #endif
#if wxUSE_INTL
// standard headers // standard headers
#include <locale.h> #include <locale.h>
#include <ctype.h> #include <ctype.h>
@@ -646,3 +648,6 @@ wxLocale *wxSetLocale(wxLocale *pLocale)
g_pLocale = pLocale; g_pLocale = pLocale;
return pOld; return pOld;
} }
#endif // wxUSE_INTL

View File

@@ -16,6 +16,7 @@
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// headers // headers
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
#ifdef __GNUG__ #ifdef __GNUG__
#pragma implementation "layout.h" #pragma implementation "layout.h"
#endif #endif
@@ -29,6 +30,8 @@
#include "wx/defs.h" #include "wx/defs.h"
#if wxUSE_CONSTRAINTS
#ifndef WX_PRECOMP #ifndef WX_PRECOMP
#include "wx/window.h" #include "wx/window.h"
#include "wx/utils.h" #include "wx/utils.h"
@@ -1762,3 +1765,4 @@ wxSpacingSizer::~wxSpacingSizer()
{ {
} }
#endif // wxUSE_CONSTRAINTS

View File

@@ -1,4 +1,5 @@
%{ %{
#include "wx/setup.h"
#include <string.h> #include <string.h>
#ifdef _MSC_VER #ifdef _MSC_VER
#include <io.h> #include <io.h>
@@ -156,7 +157,7 @@ void yyerror(char *s)
* to test * to test
*/ */
#ifndef __SC__ #if !defined(__SC__) && !defined(__GNUWIN32__)
#ifdef USE_DEFINE #ifdef USE_DEFINE
#ifndef yywrap #ifndef yywrap
#define yywrap() 1 #define yywrap() 1

View File

@@ -22,6 +22,8 @@
#include "wx/defs.h" #include "wx/defs.h"
#if wxUSE_PRINTING_ARCHITECTURE
#ifndef WX_PRECOMP #ifndef WX_PRECOMP
#include "wx/utils.h" #include "wx/utils.h"
#include "wx/dc.h" #include "wx/dc.h"
@@ -45,20 +47,13 @@
#include <string.h> #include <string.h>
#ifdef __WXMSW__ #ifdef __WXMSW__
#include <windows.h> #include "wx/msw/private.h"
#include <commdlg.h> #include <commdlg.h>
// Clash with Windows header files #ifndef __WIN32__
#ifdef StartDoc #include <print.h>
#undef StartDoc #endif
#endif #endif // __WXMSW__
#ifndef __WIN32__
#include <print.h>
#endif
#endif
// End __WXMSW__
#if !USE_SHARED_LIBRARY #if !USE_SHARED_LIBRARY
IMPLEMENT_CLASS(wxPrinterBase, wxObject) IMPLEMENT_CLASS(wxPrinterBase, wxObject)
@@ -69,12 +64,12 @@ IMPLEMENT_CLASS(wxPreviewFrame, wxFrame)
IMPLEMENT_CLASS(wxPrintPreviewBase, wxObject) IMPLEMENT_CLASS(wxPrintPreviewBase, wxObject)
BEGIN_EVENT_TABLE(wxPrintAbortDialog, wxDialog) BEGIN_EVENT_TABLE(wxPrintAbortDialog, wxDialog)
EVT_BUTTON(wxID_CANCEL, wxPrintAbortDialog::OnCancel) EVT_BUTTON(wxID_CANCEL, wxPrintAbortDialog::OnCancel)
END_EVENT_TABLE() END_EVENT_TABLE()
BEGIN_EVENT_TABLE(wxPreviewCanvas, wxScrolledWindow) BEGIN_EVENT_TABLE(wxPreviewCanvas, wxScrolledWindow)
EVT_PAINT(wxPreviewCanvas::OnPaint) EVT_PAINT(wxPreviewCanvas::OnPaint)
EVT_SYS_COLOUR_CHANGED(wxPreviewCanvas::OnSysColourChanged) EVT_SYS_COLOUR_CHANGED(wxPreviewCanvas::OnSysColourChanged)
END_EVENT_TABLE() END_EVENT_TABLE()
#endif #endif
@@ -763,3 +758,4 @@ void wxPrintPreviewBase::SetZoom(int percent)
} }
} }
#endif // wxUSE_PRINTING_ARCHITECTURE

View File

@@ -6,29 +6,31 @@
// Created: 04/01/98 // Created: 04/01/98
// RCS-ID: $Id$ // RCS-ID: $Id$
// Copyright: (c) Julian Smart and Markus Holzem // Copyright: (c) Julian Smart and Markus Holzem
// Licence: wxWindows license // Licence: wxWindows license
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__ #ifdef __GNUG__
#pragma implementation "choicdgg.h" #pragma implementation "choicdgg.h"
#endif #endif
// For compilers that support precompilation, includes "wx.h". // For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h" #include "wx/wxprec.h"
#ifdef __BORLANDC__ #ifdef __BORLANDC__
#pragma hdrstop #pragma hdrstop
#endif #endif
#if wxUSE_CONSTRAINTS
#ifndef WX_PRECOMP #ifndef WX_PRECOMP
#include <stdio.h> #include <stdio.h>
#include "wx/utils.h" #include "wx/utils.h"
#include "wx/dialog.h" #include "wx/dialog.h"
#include "wx/listbox.h" #include "wx/listbox.h"
#include "wx/button.h" #include "wx/button.h"
#include "wx/stattext.h" #include "wx/stattext.h"
#include "wx/layout.h" #include "wx/layout.h"
#include "wx/intl.h" #include "wx/intl.h"
#endif #endif
#include "wx/generic/choicdgg.h" #include "wx/generic/choicdgg.h"
@@ -50,10 +52,10 @@ static void wxSplitMessage2(const wxChar *message, wxList *messageList, wxWindow
/* /*
wxLayoutConstraints *c = new wxLayoutConstraints; wxLayoutConstraints *c = new wxLayoutConstraints;
c->left.SameAs (parent, wxLeft, 10); c->left.SameAs (parent, wxLeft, 10);
c->top.SameAs (lastWindow, wxBottom, 5); c->top.SameAs (lastWindow, wxBottom, 5);
c->right.AsIs (); c->right.AsIs ();
c->height.AsIs (); c->height.AsIs ();
mess->SetConstraints(c); 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, wxString wxGetSingleChoice( const wxString& message, const wxString& caption, int n,
const wxString *choices, wxWindow *parent, const wxString *choices, wxWindow *parent,
int WXUNUSED(x), int WXUNUSED(y), bool WXUNUSED(centre), int WXUNUSED(x), int WXUNUSED(y), bool WXUNUSED(centre),
int WXUNUSED(width), int WXUNUSED(height) ) int WXUNUSED(width), int WXUNUSED(height) )
{ {
wxSingleChoiceDialog dialog(parent, message, caption, n, choices); wxSingleChoiceDialog dialog(parent, message, caption, n, choices);
if ( dialog.ShowModal() == wxID_OK ) if ( dialog.ShowModal() == wxID_OK )
{ {
return dialog.GetStringSelection(); return dialog.GetStringSelection();
} }
else else
return ""; return "";
} }
// Overloaded for backward compatibility // Overloaded for backward compatibility
wxString wxGetSingleChoice( const wxString& message, const wxString& caption, int n, wxString wxGetSingleChoice( const wxString& message, const wxString& caption, int n,
char *choices[], wxWindow *parent, char *choices[], wxWindow *parent,
int x, int y, bool centre, int x, int y, bool centre,
int width, int height ) int width, int height )
{ {
wxString *strings = new wxString[n]; wxString *strings = new wxString[n];
int i; int i;
for ( i = 0; i < n; i++) for ( i = 0; i < n; i++)
{ {
strings[i] = choices[i]; strings[i] = choices[i];
} }
wxString ans(wxGetSingleChoice(message, caption, n, (const wxString *)strings, parent, wxString ans(wxGetSingleChoice(message, caption, n, (const wxString *)strings, parent,
x, y, centre, width, height)); x, y, centre, width, height));
delete[] strings; delete[] strings;
return ans; return ans;
} }
int wxGetSingleChoiceIndex( const wxString& message, const wxString& caption, int n, int wxGetSingleChoiceIndex( const wxString& message, const wxString& caption, int n,
const wxString *choices, wxWindow *parent, const wxString *choices, wxWindow *parent,
int WXUNUSED(x), int WXUNUSED(y), bool WXUNUSED(centre), int WXUNUSED(x), int WXUNUSED(y), bool WXUNUSED(centre),
int WXUNUSED(width), int WXUNUSED(height) ) int WXUNUSED(width), int WXUNUSED(height) )
{ {
wxSingleChoiceDialog dialog(parent, message, caption, n, choices); wxSingleChoiceDialog dialog(parent, message, caption, n, choices);
if ( dialog.ShowModal() == wxID_OK ) if ( dialog.ShowModal() == wxID_OK )
{ {
return dialog.GetSelection(); return dialog.GetSelection();
} }
else else
return -1; return -1;
} }
// Overloaded for backward compatibility // Overloaded for backward compatibility
int wxGetSingleChoiceIndex( const wxString& message, const wxString& caption, int n, int wxGetSingleChoiceIndex( const wxString& message, const wxString& caption, int n,
wxChar *choices[], wxWindow *parent, wxChar *choices[], wxWindow *parent,
int x, int y, bool centre, int x, int y, bool centre,
int width, int height ) int width, int height )
{ {
wxString *strings = new wxString[n]; wxString *strings = new wxString[n];
int i; int i;
for ( i = 0; i < n; i++) for ( i = 0; i < n; i++)
{ {
strings[i] = choices[i]; strings[i] = choices[i];
} }
int ans = wxGetSingleChoiceIndex(message, caption, n, (const wxString *)strings, parent, int ans = wxGetSingleChoiceIndex(message, caption, n, (const wxString *)strings, parent,
x, y, centre, width, height); x, y, centre, width, height);
delete[] strings; delete[] strings;
return ans; return ans;
} }
wxChar *wxGetSingleChoiceData( const wxString& message, const wxString& caption, int n, wxChar *wxGetSingleChoiceData( const wxString& message, const wxString& caption, int n,
const wxString *choices, wxChar **client_data, wxWindow *parent, const wxString *choices, wxChar **client_data, wxWindow *parent,
int WXUNUSED(x), int WXUNUSED(y), bool WXUNUSED(centre), int WXUNUSED(x), int WXUNUSED(y), bool WXUNUSED(centre),
int WXUNUSED(width), int WXUNUSED(height) ) int WXUNUSED(width), int WXUNUSED(height) )
{ {
wxSingleChoiceDialog dialog(parent, message, caption, n, choices, client_data); wxSingleChoiceDialog dialog(parent, message, caption, n, choices, client_data);
if ( dialog.ShowModal() == wxID_OK ) if ( dialog.ShowModal() == wxID_OK )
{ {
return dialog.GetSelectionClientData(); return dialog.GetSelectionClientData();
} }
else else
return NULL; return NULL;
} }
// Overloaded for backward compatibility // Overloaded for backward compatibility
wxChar *wxGetSingleChoiceData( const wxString& message, const wxString& caption, int n, wxChar *wxGetSingleChoiceData( const wxString& message, const wxString& caption, int n,
wxChar *choices[], wxChar **client_data, wxWindow *parent, wxChar *choices[], wxChar **client_data, wxWindow *parent,
int x, int y, bool centre, int x, int y, bool centre,
int width, int height ) int width, int height )
{ {
wxString *strings = new wxString[n]; wxString *strings = new wxString[n];
int i; int i;
for ( i = 0; i < n; i++) for ( i = 0; i < n; i++)
{ {
strings[i] = choices[i]; strings[i] = choices[i];
} }
wxChar *data = wxGetSingleChoiceData(message, caption, n, (const wxString *)strings, client_data, parent, wxChar *data = wxGetSingleChoiceData(message, caption, n, (const wxString *)strings, client_data, parent,
x, y, centre, width, height); x, y, centre, width, height);
delete[] strings; delete[] strings;
return data; return data;
} }
@@ -181,12 +183,12 @@ selected.
*/ */
/* /*
int wxGetMultipleChoice(const wxString& message, const wxString& caption, int wxGetMultipleChoice(const wxString& message, const wxString& caption,
int n, const wxString *choices, int n, const wxString *choices,
int nsel, int * selection, int nsel, int * selection,
wxWindow *parent , int x , int y, bool centre, wxWindow *parent , int x , int y, bool centre,
int width, int height) int width, int height)
{ {
return -1; return -1;
} }
*/ */
@@ -194,8 +196,8 @@ int wxGetMultipleChoice(const wxString& message, const wxString& caption,
#if !USE_SHARED_LIBRARY #if !USE_SHARED_LIBRARY
BEGIN_EVENT_TABLE(wxSingleChoiceDialog, wxDialog) BEGIN_EVENT_TABLE(wxSingleChoiceDialog, wxDialog)
EVT_BUTTON(wxID_OK, wxSingleChoiceDialog::OnOK) EVT_BUTTON(wxID_OK, wxSingleChoiceDialog::OnOK)
EVT_LISTBOX_DCLICK(wxID_LISTBOX, wxSingleChoiceDialog::OnListBoxDClick) EVT_LISTBOX_DCLICK(wxID_LISTBOX, wxSingleChoiceDialog::OnListBoxDClick)
END_EVENT_TABLE() END_EVENT_TABLE()
IMPLEMENT_CLASS(wxSingleChoiceDialog, wxDialog) IMPLEMENT_CLASS(wxSingleChoiceDialog, wxDialog)
@@ -203,14 +205,14 @@ IMPLEMENT_CLASS(wxSingleChoiceDialog, wxDialog)
wxSingleChoiceDialog::wxSingleChoiceDialog(wxWindow *parent, const wxString& message, const wxString& caption, wxSingleChoiceDialog::wxSingleChoiceDialog(wxWindow *parent, const wxString& message, const wxString& caption,
int n, const wxString *choices, wxChar **clientData, long style, const wxPoint& pos): 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); Create(parent, message, caption, n, choices, clientData, style);
} }
wxSingleChoiceDialog::wxSingleChoiceDialog(wxWindow *parent, const wxString& message, const wxString& caption, wxSingleChoiceDialog::wxSingleChoiceDialog(wxWindow *parent, const wxString& message, const wxString& caption,
const wxStringList& choices, wxChar **clientData, long style, const wxPoint& pos): 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); 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, bool wxSingleChoiceDialog::Create(wxWindow *parent, const wxString& message, const wxString& caption,
const wxStringList& choices, wxChar **clientData, long style, const wxPoint& pos) const wxStringList& choices, wxChar **clientData, long style, const wxPoint& pos)
{ {
wxString *strings = new wxString[choices.Number()]; wxString *strings = new wxString[choices.Number()];
int i; int i;
for ( i = 0; i < choices.Number(); i++) for ( i = 0; i < choices.Number(); i++)
{ {
strings[i] = (char *)choices.Nth(i)->Data(); strings[i] = (char *)choices.Nth(i)->Data();
} }
bool ans = Create(parent, message, caption, choices.Number(), strings, clientData, style, pos); bool ans = Create(parent, message, caption, choices.Number(), strings, clientData, style, pos);
delete[] strings; delete[] strings;
return ans; return ans;
} }
bool wxSingleChoiceDialog::Create( wxWindow *WXUNUSED(parent), const wxString& message, bool wxSingleChoiceDialog::Create( wxWindow *WXUNUSED(parent), const wxString& message,
const wxString& WXUNUSED(caption), int n, const wxString& WXUNUSED(caption), int n,
const wxString *choices, wxChar **clientData, long style, const wxString *choices, wxChar **clientData, long style,
const wxPoint& WXUNUSED(pos) ) const wxPoint& WXUNUSED(pos) )
{ {
m_dialogStyle = style; m_dialogStyle = style;
m_selection = 0; m_selection = 0;
m_stringSelection = _T(""); m_stringSelection = _T("");
m_clientData = NULL; m_clientData = NULL;
wxBeginBusyCursor(); wxBeginBusyCursor();
wxSizer *topSizer = new wxSizer(this, wxSizerShrink); wxSizer *topSizer = new wxSizer(this, wxSizerShrink);
topSizer->SetBorder(10, 10); topSizer->SetBorder(10, 10);
wxRowColSizer *messageSizer = new wxRowColSizer(topSizer, wxSIZER_COLS, 100); wxRowColSizer *messageSizer = new wxRowColSizer(topSizer, wxSIZER_COLS, 100);
messageSizer->SetName(_T("messageSizer")); messageSizer->SetName(_T("messageSizer"));
// bool centre = ((style & wxCENTRE) == wxCENTRE); // bool centre = ((style & wxCENTRE) == wxCENTRE);
wxList messageList; wxList messageList;
wxSplitMessage2(message, &messageList, this, messageSizer); wxSplitMessage2(message, &messageList, this, messageSizer);
// Insert a spacer // Insert a spacer
wxSpacingSizer *spacingSizer = new wxSpacingSizer(topSizer, wxBelow, messageSizer, 10); wxSpacingSizer *spacingSizer = new wxSpacingSizer(topSizer, wxBelow, messageSizer, 10);
wxListBox *listBox = new wxListBox(this, wxID_LISTBOX, wxPoint(-1, -1), wxSize(240, 160), wxListBox *listBox = new wxListBox(this, wxID_LISTBOX, wxPoint(-1, -1), wxSize(240, 160),
n, choices); n, choices);
listBox->SetSelection(m_selection); listBox->SetSelection(m_selection);
if ( clientData ) if ( clientData )
{ {
int i; int i;
for ( i = 0; i < n; i++) for ( i = 0; i < n; i++)
{ {
listBox->SetClientData(i, clientData[i]); listBox->SetClientData(i, clientData[i]);
} }
} }
wxRowColSizer *listBoxSizer = new wxRowColSizer(topSizer, wxSIZER_ROWS); wxRowColSizer *listBoxSizer = new wxRowColSizer(topSizer, wxSIZER_ROWS);
listBoxSizer->AddSizerChild(listBox); listBoxSizer->AddSizerChild(listBox);
listBoxSizer->SetName(_T("listBoxSizer")); listBoxSizer->SetName(_T("listBoxSizer"));
// Create constraints for the text sizer // Create constraints for the text sizer
wxLayoutConstraints *textC = new wxLayoutConstraints; wxLayoutConstraints *textC = new wxLayoutConstraints;
textC->left.SameAs (messageSizer, wxLeft); textC->left.SameAs (messageSizer, wxLeft);
textC->top.Below (spacingSizer); textC->top.Below (spacingSizer);
listBoxSizer->SetConstraints(textC); listBoxSizer->SetConstraints(textC);
// Insert another spacer // Insert another spacer
wxSpacingSizer *spacingSizer2 = new wxSpacingSizer(topSizer, wxBelow, listBoxSizer, 10); wxSpacingSizer *spacingSizer2 = new wxSpacingSizer(topSizer, wxBelow, listBoxSizer, 10);
spacingSizer->SetName(_T("spacingSizer2")); spacingSizer->SetName(_T("spacingSizer2"));
// Insert a sizer for the buttons // Insert a sizer for the buttons
wxRowColSizer *buttonSizer = new wxRowColSizer(topSizer, wxSIZER_ROWS); wxRowColSizer *buttonSizer = new wxRowColSizer(topSizer, wxSIZER_ROWS);
buttonSizer->SetName(_T("buttonSizer")); buttonSizer->SetName(_T("buttonSizer"));
buttonSizer->SetSpacing(12,0); buttonSizer->SetSpacing(12,0);
// Specify constraints for the button sizer // Specify constraints for the button sizer
wxLayoutConstraints *c = new wxLayoutConstraints; wxLayoutConstraints *c = new wxLayoutConstraints;
c->width.AsIs (); c->width.AsIs ();
c->height.AsIs (); c->height.AsIs ();
c->top.Below (spacingSizer2); c->top.Below (spacingSizer2);
c->centreX.SameAs (listBoxSizer, wxCentreX); c->centreX.SameAs (listBoxSizer, wxCentreX);
buttonSizer->SetConstraints(c); buttonSizer->SetConstraints(c);
wxButton *ok = NULL; wxButton *ok = NULL;
wxButton *cancel = NULL; wxButton *cancel = NULL;
if (style & wxOK) { if (style & wxOK) {
ok = new wxButton(this, wxID_OK, _("OK"), wxDefaultPosition, wxSize(75,-1) ); ok = new wxButton(this, wxID_OK, _("OK"), wxDefaultPosition, wxSize(75,-1) );
buttonSizer->AddSizerChild(ok); buttonSizer->AddSizerChild(ok);
} }
if (style & wxCANCEL) { if (style & wxCANCEL) {
cancel = new wxButton(this, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxSize(75,-1)); cancel = new wxButton(this, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxSize(75,-1));
buttonSizer->AddSizerChild(cancel); buttonSizer->AddSizerChild(cancel);
} }
if (ok) if (ok)
{ {
ok->SetDefault(); ok->SetDefault();
ok->SetFocus(); ok->SetFocus();
} }
Layout(); Layout();
Centre(wxBOTH); Centre(wxBOTH);
wxEndBusyCursor(); wxEndBusyCursor();
return TRUE; return TRUE;
} }
// Set the selection // Set the selection
void wxSingleChoiceDialog::SetSelection(int sel) void wxSingleChoiceDialog::SetSelection(int sel)
{ {
wxListBox *listBox = (wxListBox *)FindWindow(wxID_LISTBOX); wxListBox *listBox = (wxListBox *)FindWindow(wxID_LISTBOX);
if (listBox) if (listBox)
{ {
listBox->SetSelection(sel); listBox->SetSelection(sel);
@@ -334,28 +336,29 @@ void wxSingleChoiceDialog::SetSelection(int sel)
void wxSingleChoiceDialog::OnOK(wxCommandEvent& WXUNUSED(event)) void wxSingleChoiceDialog::OnOK(wxCommandEvent& WXUNUSED(event))
{ {
wxListBox *listBox = (wxListBox *)FindWindow(wxID_LISTBOX); wxListBox *listBox = (wxListBox *)FindWindow(wxID_LISTBOX);
if ( listBox ) if ( listBox )
{ {
m_selection = listBox->GetSelection(); m_selection = listBox->GetSelection();
m_stringSelection = listBox->GetStringSelection(); m_stringSelection = listBox->GetStringSelection();
m_clientData = (wxChar*)listBox->GetClientData(m_selection); m_clientData = (wxChar*)listBox->GetClientData(m_selection);
} }
EndModal(wxID_OK); EndModal(wxID_OK);
} }
void wxSingleChoiceDialog::OnListBoxDClick(wxCommandEvent& WXUNUSED(event)) void wxSingleChoiceDialog::OnListBoxDClick(wxCommandEvent& WXUNUSED(event))
{ {
wxListBox *listBox = (wxListBox *)FindWindow(wxID_LISTBOX); wxListBox *listBox = (wxListBox *)FindWindow(wxID_LISTBOX);
if ( listBox ) if ( listBox )
{ {
m_selection = listBox->GetSelection(); m_selection = listBox->GetSelection();
m_stringSelection = listBox->GetStringSelection(); m_stringSelection = listBox->GetStringSelection();
m_clientData = (wxChar*)listBox->GetClientData(m_selection); m_clientData = (wxChar*)listBox->GetClientData(m_selection);
} }
EndModal(wxID_OK); EndModal(wxID_OK);
} }
#endif // wxUSE_CONSTRAINTS

View File

@@ -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 # these are the common files which always make part of the library
libwx_msw_la_SOURCES = \ libwx_msw_la_SOURCES = \
\ \
winestub.c \
extended.c \ extended.c \
parser.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, # 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) # automake tries to build lexer.lo... and fails, of course. (VZ)
BUILT_SOURCES = parser.c lexer.c 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 parser.c: $(srcdir)/../common/parser.y lexer.c
$(YACC) $(srcdir)/../common/parser.y $(YACC) $(srcdir)/../common/parser.y
@sed -e "s;$(srcdir)/../common/y.tab.c;parser.y;g" < y.tab.c | \ @sed -e "s;$(srcdir)/../common/y.tab.c;parser.y;g" < y.tab.c | \
sed -e "s/BUFSIZ/5000/g" | \ sed -e "s/BUFSIZ/5000/g" | \
sed -e "s/YYLMAX 200/YYLMAX 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/input/PROIO_input/g" | \
sed -e "s/unput/PROIO_unput/g" > parser.c sed -e "s/unput/PROIO_unput/g" > parser.c
@$(RM) y.tab.c @$(RM) y.tab.c
@@ -191,13 +192,13 @@ parser.c: $(srcdir)/../common/parser.y lexer.c
lexer.c: $(srcdir)/../common/lexer.l lexer.c: $(srcdir)/../common/lexer.l
$(LEX) $(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;$(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/input/PROIO_input/g" | \
sed -e "s/unput/PROIO_unput/g" > lexer.c sed -e "s/unput/PROIO_unput/g" > lexer.c
@$(RM) lex.yy.c @$(RM) lex.yy.c
libwx_msw_la_LDFLAGS = -rpath @libdir@ \ libwx_msw_la_LDFLAGS = -rpath @libdir@ \
-version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) \ -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) \
-release $(LT_RELEASE) -release $(LT_RELEASE) -no-undefined
libwx_msw_la_LIBADD = $(LTLIBOBJS) libwx_msw_la_LIBADD = $(LTLIBOBJS)
libwx_msw_la_DEPENDENCIES = $(libwx_msw_la_LIBADD) lexer.l parser.y libwx_msw_la_DEPENDENCIES = $(libwx_msw_la_LIBADD) lexer.l parser.y

View File

@@ -346,6 +346,7 @@ void wxFrame::SetIcon(const wxIcon& icon)
#endif #endif
} }
#if wxUSE_STATUSBAR
wxStatusBar *wxFrame::OnCreateStatusBar(int number, long style, wxWindowID id, wxStatusBar *wxFrame::OnCreateStatusBar(int number, long style, wxWindowID id,
const wxString& name) const wxString& name)
{ {
@@ -430,6 +431,7 @@ void wxFrame::PositionStatusBar()
m_frameStatusBar->SetSize(0, h, w, sh); m_frameStatusBar->SetSize(0, h, w, sh);
} }
} }
#endif // wxUSE_STATUSBAR
void wxFrame::SetMenuBar(wxMenuBar *menu_bar) void wxFrame::SetMenuBar(wxMenuBar *menu_bar)
{ {
@@ -571,13 +573,19 @@ void wxFrame::OnSize(wxSizeEvent& event)
// do we have _exactly_ one child? // do we have _exactly_ one child?
wxWindow *child = NULL; 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(); wxWindow *win = node->GetData();
if ( !win->IsKindOf(CLASSINFO(wxFrame)) && if ( !win->IsTopLevel()
!win->IsKindOf(CLASSINFO(wxDialog)) && #if wxUSE_STATUSBAR
(win != GetStatusBar()) && && (win != GetStatusBar())
(win != GetToolBar()) ) #endif // wxUSE_STATUSBAR
#if wxUSE_TOOLBAR
&& (win != GetToolBar())
#endif // wxUSE_TOOLBAR
)
{ {
if ( child ) if ( child )
return; // it's our second subwindow - nothing to do 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); wxWindow::ClientToScreen(x, y);
} }
#if wxUSE_TOOLBAR
wxToolBar* wxFrame::CreateToolBar(long style, wxWindowID id, const wxString& name) wxToolBar* wxFrame::CreateToolBar(long style, wxWindowID id, const wxString& name)
{ {
wxCHECK_MSG( m_frameToolBar == NULL, FALSE, 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 // 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 // Windows behaviour where child frames float independently of the parent one

View File

@@ -146,6 +146,7 @@ void wxMenu::Append(wxMenuItem *pItem)
{ {
wxCHECK_RET( pItem != NULL, "can't append NULL item to the menu" ); wxCHECK_RET( pItem != NULL, "can't append NULL item to the menu" );
#if wxUSE_ACCEL
// check for accelerators: they are given after '\t' // check for accelerators: they are given after '\t'
wxString label = pItem->GetName(); wxString label = pItem->GetName();
int posTab = label.Find('\t'); int posTab = label.Find('\t');
@@ -206,6 +207,7 @@ void wxMenu::Append(wxMenuItem *pItem)
m_accelIds.Add(pItem->GetId()); m_accelIds.Add(pItem->GetId());
} }
} }
#endif // wxUSE_ACCEL
UINT flags = 0; UINT flags = 0;
@@ -344,6 +346,8 @@ void wxMenu::Delete(int id)
delete item; delete item;
} }
#if wxUSE_ACCEL
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// accelerator helpers // accelerator helpers
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
@@ -361,6 +365,8 @@ size_t wxMenu::CopyAccels(wxAcceleratorEntry *accels) const
return count; return count;
} }
#endif // wxUSE_ACCEL
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// wxMenu functions implemented in wxMenuItem // wxMenu functions implemented in wxMenuItem
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
@@ -1014,6 +1020,7 @@ void wxMenuBar::Attach(wxFrame *frame)
m_menuBarFrame = frame; m_menuBarFrame = frame;
#if wxUSE_ACCEL
// create the accel table - we consider that the menubar construction is // create the accel table - we consider that the menubar construction is
// finished // finished
size_t nAccelCount = 0; size_t nAccelCount = 0;
@@ -1037,6 +1044,7 @@ void wxMenuBar::Attach(wxFrame *frame)
delete [] accelEntries; delete [] accelEntries;
} }
#endif // wxUSE_ACCEL
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------