From dcf924a345ea8ffbc1cf6b40b5f75c6005e504c0 Mon Sep 17 00:00:00 2001 From: Robert Roebling Date: Mon, 14 Jun 1999 23:04:05 +0000 Subject: [PATCH] Added zillions of #if wxUSE_XXX Removed cmndlgs usage of wxSizer and constraints Changed occurences of wxConv_xxx to wxConvXxxx and changed some wxConvLibc to wxConvCurrent Added Unicode tests to typetests (not finished) Compile fix for wxString in Unicode mode - we have to use the "experimental" printf then, I guess. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@2794 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- acconfig.h | 8 +- include/wx/gtk/accel.h | 5 + include/wx/gtk/bmpbuttn.h | 5 + include/wx/gtk/checkbox.h | 5 + include/wx/gtk/checklst.h | 6 +- include/wx/gtk/combobox.h | 4 + include/wx/gtk/frame.h | 4 + include/wx/gtk/gauge.h | 5 + include/wx/gtk/listbox.h | 5 + include/wx/gtk/mdi.h | 4 + include/wx/gtk/minifram.h | 5 + include/wx/gtk/notebook.h | 5 + include/wx/gtk/radiobox.h | 5 + include/wx/gtk/radiobut.h | 5 + include/wx/gtk/scrolbar.h | 5 + include/wx/gtk/slider.h | 5 + include/wx/gtk/spinbutt.h | 5 + include/wx/gtk/statbmp.h | 5 + include/wx/gtk/statbox.h | 5 + include/wx/gtk/statline.h | 5 + include/wx/gtk/tbargtk.h | 5 + include/wx/gtk1/accel.h | 5 + include/wx/gtk1/bmpbuttn.h | 5 + include/wx/gtk1/checkbox.h | 5 + include/wx/gtk1/checklst.h | 6 +- include/wx/gtk1/combobox.h | 4 + include/wx/gtk1/frame.h | 4 + include/wx/gtk1/gauge.h | 5 + include/wx/gtk1/listbox.h | 5 + include/wx/gtk1/mdi.h | 4 + include/wx/gtk1/minifram.h | 5 + include/wx/gtk1/notebook.h | 5 + include/wx/gtk1/radiobox.h | 5 + include/wx/gtk1/radiobut.h | 5 + include/wx/gtk1/scrolbar.h | 5 + include/wx/gtk1/slider.h | 5 + include/wx/gtk1/spinbutt.h | 5 + include/wx/gtk1/statbmp.h | 5 + include/wx/gtk1/statbox.h | 5 + include/wx/gtk1/statline.h | 5 + include/wx/gtk1/tbargtk.h | 5 + include/wx/string.h | 11 +- samples/dialogs/dialogs.cpp | 2 +- samples/typetest/typetest.cpp | 48 ++++++-- samples/typetest/typetest.h | 4 + src/common/file.cpp | 2 +- src/common/filefn.cpp | 6 +- src/common/intl.cpp | 4 +- src/common/log.cpp | 4 +- src/common/resource.cpp | 18 +-- src/common/string.cpp | 8 +- src/common/valgen.cpp | 123 +++++++++++++------- src/common/wxchar.cpp | 14 +-- src/common/wxexpr.cpp | 6 +- src/generic/choicdgg.cpp | 212 ++++++++++++++++------------------ src/generic/dcpsg.cpp | 8 +- src/generic/msgdlgg.cpp | 29 +++-- src/generic/prntdlgg.cpp | 8 +- src/generic/prop.cpp | 2 +- src/generic/textdlgg.cpp | 212 +++++++++++++++++----------------- src/gtk/accel.cpp | 12 +- src/gtk/app.cpp | 2 +- src/gtk/bitmap.cpp | 6 +- src/gtk/bmpbuttn.cpp | 4 + src/gtk/checkbox.cpp | 3 + src/gtk/checklst.cpp | 6 +- src/gtk/choice.cpp | 6 +- src/gtk/combobox.cpp | 4 + src/gtk/filedlg.cpp | 4 +- src/gtk/font.cpp | 4 +- src/gtk/frame.cpp | 20 ++++ src/gtk/gauge.cpp | 4 + src/gtk/listbox.cpp | 13 ++- src/gtk/mdi.cpp | 4 + src/gtk/minifram.cpp | 5 + src/gtk/notebook.cpp | 4 + src/gtk/radiobox.cpp | 7 +- src/gtk/radiobut.cpp | 5 + src/gtk/scrolbar.cpp | 4 + src/gtk/slider.cpp | 5 + src/gtk/spinbutt.cpp | 5 + src/gtk/statbmp.cpp | 4 + src/gtk/statbox.cpp | 4 + src/gtk/statline.cpp | 3 + src/gtk/tbargtk.cpp | 4 + src/gtk/textctrl.cpp | 4 +- src/gtk/tooltip.cpp | 1 + src/gtk/utilsres.cpp | 14 +-- src/gtk/window.cpp | 2 +- src/gtk1/accel.cpp | 12 +- src/gtk1/app.cpp | 2 +- src/gtk1/bitmap.cpp | 6 +- src/gtk1/bmpbuttn.cpp | 4 + src/gtk1/checkbox.cpp | 3 + src/gtk1/checklst.cpp | 6 +- src/gtk1/choice.cpp | 6 +- src/gtk1/combobox.cpp | 4 + src/gtk1/filedlg.cpp | 4 +- src/gtk1/font.cpp | 4 +- src/gtk1/frame.cpp | 20 ++++ src/gtk1/gauge.cpp | 4 + src/gtk1/listbox.cpp | 13 ++- src/gtk1/mdi.cpp | 4 + src/gtk1/minifram.cpp | 5 + src/gtk1/notebook.cpp | 4 + src/gtk1/radiobox.cpp | 7 +- src/gtk1/radiobut.cpp | 5 + src/gtk1/scrolbar.cpp | 4 + src/gtk1/slider.cpp | 5 + src/gtk1/spinbutt.cpp | 5 + src/gtk1/statbmp.cpp | 4 + src/gtk1/statbox.cpp | 4 + src/gtk1/statline.cpp | 3 + src/gtk1/tbargtk.cpp | 4 + src/gtk1/textctrl.cpp | 4 +- src/gtk1/tooltip.cpp | 1 + src/gtk1/utilsres.cpp | 14 +-- src/gtk1/window.cpp | 2 +- src/unix/utilsunx.cpp | 16 +-- 119 files changed, 851 insertions(+), 416 deletions(-) diff --git a/acconfig.h b/acconfig.h index c1839ecc6d..54d1593744 100644 --- a/acconfig.h +++ b/acconfig.h @@ -15,11 +15,6 @@ /* wxWindows version (not used but required by autoheader) */ /* ------------------------------------------------------------------------ */ -#if 0 -#undef PACKAGE -#undef VERSION -#endif - /* needed for older automake? */ #undef WITH_SYMBOL_UNDERSCORE @@ -579,4 +574,7 @@ @BOTTOM@ +#undef PACKAGE +#undef VERSION + #endif /* __GTKSETUPH__ */ diff --git a/include/wx/gtk/accel.h b/include/wx/gtk/accel.h index 4765e6fe3d..4066849bea 100644 --- a/include/wx/gtk/accel.h +++ b/include/wx/gtk/accel.h @@ -15,6 +15,9 @@ #endif #include "wx/defs.h" + +#if wxUSE_ACCEL + #include "wx/object.h" #include "wx/event.h" @@ -103,3 +106,5 @@ class wxAcceleratorTable: public wxObject }; #endif + +#endif diff --git a/include/wx/gtk/bmpbuttn.h b/include/wx/gtk/bmpbuttn.h index 4a029af1b9..ec13253586 100644 --- a/include/wx/gtk/bmpbuttn.h +++ b/include/wx/gtk/bmpbuttn.h @@ -16,6 +16,9 @@ #endif #include "wx/defs.h" + +#if wxUSE_BMPBUTTON + #include "wx/object.h" #include "wx/list.h" #include "wx/control.h" @@ -91,4 +94,6 @@ public: wxBitmap m_selected; }; +#endif + #endif // __BMPBUTTONH__ diff --git a/include/wx/gtk/checkbox.h b/include/wx/gtk/checkbox.h index cf2109123b..edd5cf3dd0 100644 --- a/include/wx/gtk/checkbox.h +++ b/include/wx/gtk/checkbox.h @@ -16,6 +16,9 @@ #endif #include "wx/defs.h" + +#if wxUSE_CHECKBOX + #include "wx/object.h" #include "wx/list.h" #include "wx/control.h" @@ -73,4 +76,6 @@ public: GtkWidget *m_widgetLabel; }; +#endif + #endif // __GTKCHECKBOXH__ diff --git a/include/wx/gtk/checklst.h b/include/wx/gtk/checklst.h index cbdd0ee233..8022f35658 100644 --- a/include/wx/gtk/checklst.h +++ b/include/wx/gtk/checklst.h @@ -16,6 +16,9 @@ #endif #include "wx/defs.h" + +#if wxUSE_CHECKLISTBOX + #include "wx/object.h" #include "wx/list.h" #include "wx/control.h" @@ -53,4 +56,5 @@ public: }; #endif - //__GTKCHECKLISTH__ + +#endif //__GTKCHECKLISTH__ diff --git a/include/wx/gtk/combobox.h b/include/wx/gtk/combobox.h index a9910b78a3..d1787f8ca0 100644 --- a/include/wx/gtk/combobox.h +++ b/include/wx/gtk/combobox.h @@ -18,6 +18,8 @@ #include "wx/defs.h" +#if wxUSE_COMBOBOX + #include "wx/object.h" #include "wx/control.h" @@ -123,6 +125,8 @@ public: DECLARE_EVENT_TABLE() }; +#endif + #endif // __GTKCOMBOBOXH__ diff --git a/include/wx/gtk/frame.h b/include/wx/gtk/frame.h index 5595a21347..b69144382b 100644 --- a/include/wx/gtk/frame.h +++ b/include/wx/gtk/frame.h @@ -113,8 +113,12 @@ public: virtual void OnInternalIdle(); wxMenuBar *m_frameMenuBar; +#if wxUSE_STATUSBAR wxStatusBar *m_frameStatusBar; +#endif +#if wxUSE_TOOLBAR wxToolBar *m_frameToolBar; +#endif wxString m_title; wxIcon m_icon; int m_miniEdge,m_miniTitle; diff --git a/include/wx/gtk/gauge.h b/include/wx/gtk/gauge.h index e75a0c41b5..479d1d510d 100644 --- a/include/wx/gtk/gauge.h +++ b/include/wx/gtk/gauge.h @@ -16,6 +16,9 @@ #endif #include "wx/defs.h" + +#if wxUSE_GAUGE + #include "wx/object.h" #include "wx/list.h" #include "wx/control.h" @@ -79,4 +82,6 @@ class wxGauge: public wxControl bool m_useProgressBar; }; +#endif + #endif // __GTKGAUGEH__ diff --git a/include/wx/gtk/listbox.h b/include/wx/gtk/listbox.h index fa19c2d4f9..993a9b64c9 100644 --- a/include/wx/gtk/listbox.h +++ b/include/wx/gtk/listbox.h @@ -16,6 +16,9 @@ #endif #include "wx/defs.h" + +#if wxUSE_LISTBOX + #include "wx/object.h" #include "wx/list.h" #include "wx/control.h" @@ -125,4 +128,6 @@ public: #endif // wxUSE_CHECKLISTBOX }; +#endif + #endif // __GTKLISTBOXH__ diff --git a/include/wx/gtk/mdi.h b/include/wx/gtk/mdi.h index 152af27a48..c97928de91 100644 --- a/include/wx/gtk/mdi.h +++ b/include/wx/gtk/mdi.h @@ -119,22 +119,26 @@ class wxMDIChildFrame: public wxFrame virtual void Activate(); +#if wxUSE_STATUSBAR // no status bars virtual wxStatusBar* CreateStatusBar( int WXUNUSED(number)=1, long WXUNUSED(style)=1, wxWindowID WXUNUSED(id)=1, const wxString& WXUNUSED(name)=WXSTRINGCAST NULL ) {return (wxStatusBar*)NULL; } virtual wxStatusBar *GetStatusBar() const { return (wxStatusBar*)NULL; } virtual void SetStatusText( const wxString &WXUNUSED(text), int WXUNUSED(number)=0 ) {} virtual void SetStatusWidths( int WXUNUSED(n), const int WXUNUSED(widths_field)[] ) {} +#endif // no size hints virtual void SetSizeHints( int WXUNUSED(minW), int WXUNUSED(minH), int WXUNUSED(maxW), int WXUNUSED(maxH), int WXUNUSED(incW), int WXUNUSED(incH) ) {} +#if wxUSE_TOOLBAR // no toolbar bars virtual wxToolBar* CreateToolBar( long WXUNUSED(style), wxWindowID WXUNUSED(id), const wxString& WXUNUSED(name) ) { return (wxToolBar*)NULL; } virtual wxToolBar *GetToolBar() const { return (wxToolBar*)NULL; } +#endif // no icon void SetIcon( const wxIcon &icon ) { m_icon = icon; } diff --git a/include/wx/gtk/minifram.h b/include/wx/gtk/minifram.h index 1828439281..f0edcd4b4d 100644 --- a/include/wx/gtk/minifram.h +++ b/include/wx/gtk/minifram.h @@ -15,6 +15,9 @@ #endif #include "wx/defs.h" + +#if wxUSE_MINIFRAME + #include "wx/object.h" #include "wx/frame.h" @@ -60,5 +63,7 @@ public: int m_diffX,m_diffY; }; +#endif + #endif // __GTKMINIFRAMEH__ diff --git a/include/wx/gtk/notebook.h b/include/wx/gtk/notebook.h index 2d10456907..3481d3016c 100644 --- a/include/wx/gtk/notebook.h +++ b/include/wx/gtk/notebook.h @@ -16,6 +16,9 @@ #endif #include "wx/defs.h" + +#if wxUSE_NOTEBOOK + #include "wx/object.h" #include "wx/string.h" #include "wx/control.h" @@ -150,5 +153,7 @@ public: DECLARE_EVENT_TABLE() }; +#endif + #endif // __GTKNOTEBOOKH__ diff --git a/include/wx/gtk/radiobox.h b/include/wx/gtk/radiobox.h index a73c1a608e..b28499448e 100644 --- a/include/wx/gtk/radiobox.h +++ b/include/wx/gtk/radiobox.h @@ -16,6 +16,9 @@ #endif #include "wx/defs.h" + +#if wxUSE_RADIOBOX + #include "wx/object.h" #include "wx/list.h" #include "wx/control.h" @@ -104,4 +107,6 @@ public: DECLARE_EVENT_TABLE() }; +#endif + #endif // __GTKRADIOBOXH__ diff --git a/include/wx/gtk/radiobut.h b/include/wx/gtk/radiobut.h index 35a610b1ad..bbe2112a89 100644 --- a/include/wx/gtk/radiobut.h +++ b/include/wx/gtk/radiobut.h @@ -16,6 +16,9 @@ #endif #include "wx/defs.h" + +#if wxUSE_RADIOBOX + #include "wx/object.h" #include "wx/list.h" #include "wx/control.h" @@ -70,4 +73,6 @@ class wxRadioButton: public wxControl GtkWidget* m_theOtherRadioButtton; }; +#endif + #endif // __GTKRADIOBUTTONH__ diff --git a/include/wx/gtk/scrolbar.h b/include/wx/gtk/scrolbar.h index 98a3da43b1..75344cb221 100644 --- a/include/wx/gtk/scrolbar.h +++ b/include/wx/gtk/scrolbar.h @@ -16,6 +16,9 @@ #endif #include "wx/defs.h" + +#if wxUSE_SCROLLBAR + #include "wx/object.h" #include "wx/control.h" @@ -86,5 +89,7 @@ class wxScrollBar: public wxControl float m_oldPos; }; +#endif + #endif // __GTKSCROLLBARH__ diff --git a/include/wx/gtk/slider.h b/include/wx/gtk/slider.h index 1e2714065a..aa8f0f969e 100644 --- a/include/wx/gtk/slider.h +++ b/include/wx/gtk/slider.h @@ -15,6 +15,9 @@ #endif #include "wx/defs.h" + +#if wxUSE_SLIDER + #include "wx/object.h" #include "wx/list.h" #include "wx/control.h" @@ -89,4 +92,6 @@ class wxSlider: public wxControl }; +#endif + #endif // __GTKSLIDERH__ diff --git a/include/wx/gtk/spinbutt.h b/include/wx/gtk/spinbutt.h index 88161fd770..517d463b55 100644 --- a/include/wx/gtk/spinbutt.h +++ b/include/wx/gtk/spinbutt.h @@ -16,6 +16,9 @@ #endif #include "wx/defs.h" + +#ifdef wxUSE_SPINBTN + #include "wx/object.h" #include "wx/control.h" @@ -94,5 +97,7 @@ typedef void (wxEvtHandler::*wxSpinEventFunction)(wxSpinEvent&); { wxEVT_SCROLL_PAGEDOWN, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxSpinEventFunction) & func },\ { wxEVT_SCROLL_THUMBTRACK, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxSpinEventFunction) & func }, +#endif + #endif // __GTKSPINBUTTH__ diff --git a/include/wx/gtk/statbmp.h b/include/wx/gtk/statbmp.h index ab6e7c331d..632624ce5d 100644 --- a/include/wx/gtk/statbmp.h +++ b/include/wx/gtk/statbmp.h @@ -16,6 +16,9 @@ #endif #include "wx/defs.h" + +#if wxUSE_STATBMP + #include "wx/object.h" #include "wx/control.h" #include "wx/bitmap.h" @@ -57,4 +60,6 @@ class wxStaticBitmap: public wxControl wxBitmap m_bitmap; }; +#endif + #endif // __GTKSTATICBITMAPH__ diff --git a/include/wx/gtk/statbox.h b/include/wx/gtk/statbox.h index 7d827c0d4b..7978dd9bc8 100644 --- a/include/wx/gtk/statbox.h +++ b/include/wx/gtk/statbox.h @@ -16,6 +16,9 @@ #endif #include "wx/defs.h" + +#if wxUSE_STATBOX + #include "wx/object.h" #include "wx/list.h" #include "wx/control.h" @@ -56,4 +59,6 @@ class wxStaticBox: public wxControl void ApplyWidgetStyle(); }; +#endif + #endif // __GTKSTATICBOXH__ diff --git a/include/wx/gtk/statline.h b/include/wx/gtk/statline.h index c6819e51a5..2d31725292 100644 --- a/include/wx/gtk/statline.h +++ b/include/wx/gtk/statline.h @@ -16,6 +16,9 @@ #endif #include "wx/defs.h" + +#if wxUSE_STATLINE + #include "wx/object.h" #include "wx/list.h" #include "wx/control.h" @@ -52,4 +55,6 @@ class wxStaticLine: public wxControl }; +#endif + #endif // __GTKSTATICLINEH__ diff --git a/include/wx/gtk/tbargtk.h b/include/wx/gtk/tbargtk.h index 39545eb984..5a6f17415d 100644 --- a/include/wx/gtk/tbargtk.h +++ b/include/wx/gtk/tbargtk.h @@ -15,6 +15,9 @@ #endif #include "wx/defs.h" + +#if wxUSE_TOOLBAR + #include "wx/control.h" #include "wx/bitmap.h" #include "wx/tbarbase.h" @@ -119,5 +122,7 @@ class wxToolBar: public wxControl bool m_hasToolAlready; }; +#endif + #endif // __TBARGTKH__ diff --git a/include/wx/gtk1/accel.h b/include/wx/gtk1/accel.h index 4765e6fe3d..4066849bea 100644 --- a/include/wx/gtk1/accel.h +++ b/include/wx/gtk1/accel.h @@ -15,6 +15,9 @@ #endif #include "wx/defs.h" + +#if wxUSE_ACCEL + #include "wx/object.h" #include "wx/event.h" @@ -103,3 +106,5 @@ class wxAcceleratorTable: public wxObject }; #endif + +#endif diff --git a/include/wx/gtk1/bmpbuttn.h b/include/wx/gtk1/bmpbuttn.h index 4a029af1b9..ec13253586 100644 --- a/include/wx/gtk1/bmpbuttn.h +++ b/include/wx/gtk1/bmpbuttn.h @@ -16,6 +16,9 @@ #endif #include "wx/defs.h" + +#if wxUSE_BMPBUTTON + #include "wx/object.h" #include "wx/list.h" #include "wx/control.h" @@ -91,4 +94,6 @@ public: wxBitmap m_selected; }; +#endif + #endif // __BMPBUTTONH__ diff --git a/include/wx/gtk1/checkbox.h b/include/wx/gtk1/checkbox.h index cf2109123b..edd5cf3dd0 100644 --- a/include/wx/gtk1/checkbox.h +++ b/include/wx/gtk1/checkbox.h @@ -16,6 +16,9 @@ #endif #include "wx/defs.h" + +#if wxUSE_CHECKBOX + #include "wx/object.h" #include "wx/list.h" #include "wx/control.h" @@ -73,4 +76,6 @@ public: GtkWidget *m_widgetLabel; }; +#endif + #endif // __GTKCHECKBOXH__ diff --git a/include/wx/gtk1/checklst.h b/include/wx/gtk1/checklst.h index cbdd0ee233..8022f35658 100644 --- a/include/wx/gtk1/checklst.h +++ b/include/wx/gtk1/checklst.h @@ -16,6 +16,9 @@ #endif #include "wx/defs.h" + +#if wxUSE_CHECKLISTBOX + #include "wx/object.h" #include "wx/list.h" #include "wx/control.h" @@ -53,4 +56,5 @@ public: }; #endif - //__GTKCHECKLISTH__ + +#endif //__GTKCHECKLISTH__ diff --git a/include/wx/gtk1/combobox.h b/include/wx/gtk1/combobox.h index a9910b78a3..d1787f8ca0 100644 --- a/include/wx/gtk1/combobox.h +++ b/include/wx/gtk1/combobox.h @@ -18,6 +18,8 @@ #include "wx/defs.h" +#if wxUSE_COMBOBOX + #include "wx/object.h" #include "wx/control.h" @@ -123,6 +125,8 @@ public: DECLARE_EVENT_TABLE() }; +#endif + #endif // __GTKCOMBOBOXH__ diff --git a/include/wx/gtk1/frame.h b/include/wx/gtk1/frame.h index 5595a21347..b69144382b 100644 --- a/include/wx/gtk1/frame.h +++ b/include/wx/gtk1/frame.h @@ -113,8 +113,12 @@ public: virtual void OnInternalIdle(); wxMenuBar *m_frameMenuBar; +#if wxUSE_STATUSBAR wxStatusBar *m_frameStatusBar; +#endif +#if wxUSE_TOOLBAR wxToolBar *m_frameToolBar; +#endif wxString m_title; wxIcon m_icon; int m_miniEdge,m_miniTitle; diff --git a/include/wx/gtk1/gauge.h b/include/wx/gtk1/gauge.h index e75a0c41b5..479d1d510d 100644 --- a/include/wx/gtk1/gauge.h +++ b/include/wx/gtk1/gauge.h @@ -16,6 +16,9 @@ #endif #include "wx/defs.h" + +#if wxUSE_GAUGE + #include "wx/object.h" #include "wx/list.h" #include "wx/control.h" @@ -79,4 +82,6 @@ class wxGauge: public wxControl bool m_useProgressBar; }; +#endif + #endif // __GTKGAUGEH__ diff --git a/include/wx/gtk1/listbox.h b/include/wx/gtk1/listbox.h index fa19c2d4f9..993a9b64c9 100644 --- a/include/wx/gtk1/listbox.h +++ b/include/wx/gtk1/listbox.h @@ -16,6 +16,9 @@ #endif #include "wx/defs.h" + +#if wxUSE_LISTBOX + #include "wx/object.h" #include "wx/list.h" #include "wx/control.h" @@ -125,4 +128,6 @@ public: #endif // wxUSE_CHECKLISTBOX }; +#endif + #endif // __GTKLISTBOXH__ diff --git a/include/wx/gtk1/mdi.h b/include/wx/gtk1/mdi.h index 152af27a48..c97928de91 100644 --- a/include/wx/gtk1/mdi.h +++ b/include/wx/gtk1/mdi.h @@ -119,22 +119,26 @@ class wxMDIChildFrame: public wxFrame virtual void Activate(); +#if wxUSE_STATUSBAR // no status bars virtual wxStatusBar* CreateStatusBar( int WXUNUSED(number)=1, long WXUNUSED(style)=1, wxWindowID WXUNUSED(id)=1, const wxString& WXUNUSED(name)=WXSTRINGCAST NULL ) {return (wxStatusBar*)NULL; } virtual wxStatusBar *GetStatusBar() const { return (wxStatusBar*)NULL; } virtual void SetStatusText( const wxString &WXUNUSED(text), int WXUNUSED(number)=0 ) {} virtual void SetStatusWidths( int WXUNUSED(n), const int WXUNUSED(widths_field)[] ) {} +#endif // no size hints virtual void SetSizeHints( int WXUNUSED(minW), int WXUNUSED(minH), int WXUNUSED(maxW), int WXUNUSED(maxH), int WXUNUSED(incW), int WXUNUSED(incH) ) {} +#if wxUSE_TOOLBAR // no toolbar bars virtual wxToolBar* CreateToolBar( long WXUNUSED(style), wxWindowID WXUNUSED(id), const wxString& WXUNUSED(name) ) { return (wxToolBar*)NULL; } virtual wxToolBar *GetToolBar() const { return (wxToolBar*)NULL; } +#endif // no icon void SetIcon( const wxIcon &icon ) { m_icon = icon; } diff --git a/include/wx/gtk1/minifram.h b/include/wx/gtk1/minifram.h index 1828439281..f0edcd4b4d 100644 --- a/include/wx/gtk1/minifram.h +++ b/include/wx/gtk1/minifram.h @@ -15,6 +15,9 @@ #endif #include "wx/defs.h" + +#if wxUSE_MINIFRAME + #include "wx/object.h" #include "wx/frame.h" @@ -60,5 +63,7 @@ public: int m_diffX,m_diffY; }; +#endif + #endif // __GTKMINIFRAMEH__ diff --git a/include/wx/gtk1/notebook.h b/include/wx/gtk1/notebook.h index 2d10456907..3481d3016c 100644 --- a/include/wx/gtk1/notebook.h +++ b/include/wx/gtk1/notebook.h @@ -16,6 +16,9 @@ #endif #include "wx/defs.h" + +#if wxUSE_NOTEBOOK + #include "wx/object.h" #include "wx/string.h" #include "wx/control.h" @@ -150,5 +153,7 @@ public: DECLARE_EVENT_TABLE() }; +#endif + #endif // __GTKNOTEBOOKH__ diff --git a/include/wx/gtk1/radiobox.h b/include/wx/gtk1/radiobox.h index a73c1a608e..b28499448e 100644 --- a/include/wx/gtk1/radiobox.h +++ b/include/wx/gtk1/radiobox.h @@ -16,6 +16,9 @@ #endif #include "wx/defs.h" + +#if wxUSE_RADIOBOX + #include "wx/object.h" #include "wx/list.h" #include "wx/control.h" @@ -104,4 +107,6 @@ public: DECLARE_EVENT_TABLE() }; +#endif + #endif // __GTKRADIOBOXH__ diff --git a/include/wx/gtk1/radiobut.h b/include/wx/gtk1/radiobut.h index 35a610b1ad..bbe2112a89 100644 --- a/include/wx/gtk1/radiobut.h +++ b/include/wx/gtk1/radiobut.h @@ -16,6 +16,9 @@ #endif #include "wx/defs.h" + +#if wxUSE_RADIOBOX + #include "wx/object.h" #include "wx/list.h" #include "wx/control.h" @@ -70,4 +73,6 @@ class wxRadioButton: public wxControl GtkWidget* m_theOtherRadioButtton; }; +#endif + #endif // __GTKRADIOBUTTONH__ diff --git a/include/wx/gtk1/scrolbar.h b/include/wx/gtk1/scrolbar.h index 98a3da43b1..75344cb221 100644 --- a/include/wx/gtk1/scrolbar.h +++ b/include/wx/gtk1/scrolbar.h @@ -16,6 +16,9 @@ #endif #include "wx/defs.h" + +#if wxUSE_SCROLLBAR + #include "wx/object.h" #include "wx/control.h" @@ -86,5 +89,7 @@ class wxScrollBar: public wxControl float m_oldPos; }; +#endif + #endif // __GTKSCROLLBARH__ diff --git a/include/wx/gtk1/slider.h b/include/wx/gtk1/slider.h index 1e2714065a..aa8f0f969e 100644 --- a/include/wx/gtk1/slider.h +++ b/include/wx/gtk1/slider.h @@ -15,6 +15,9 @@ #endif #include "wx/defs.h" + +#if wxUSE_SLIDER + #include "wx/object.h" #include "wx/list.h" #include "wx/control.h" @@ -89,4 +92,6 @@ class wxSlider: public wxControl }; +#endif + #endif // __GTKSLIDERH__ diff --git a/include/wx/gtk1/spinbutt.h b/include/wx/gtk1/spinbutt.h index 88161fd770..517d463b55 100644 --- a/include/wx/gtk1/spinbutt.h +++ b/include/wx/gtk1/spinbutt.h @@ -16,6 +16,9 @@ #endif #include "wx/defs.h" + +#ifdef wxUSE_SPINBTN + #include "wx/object.h" #include "wx/control.h" @@ -94,5 +97,7 @@ typedef void (wxEvtHandler::*wxSpinEventFunction)(wxSpinEvent&); { wxEVT_SCROLL_PAGEDOWN, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxSpinEventFunction) & func },\ { wxEVT_SCROLL_THUMBTRACK, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxSpinEventFunction) & func }, +#endif + #endif // __GTKSPINBUTTH__ diff --git a/include/wx/gtk1/statbmp.h b/include/wx/gtk1/statbmp.h index ab6e7c331d..632624ce5d 100644 --- a/include/wx/gtk1/statbmp.h +++ b/include/wx/gtk1/statbmp.h @@ -16,6 +16,9 @@ #endif #include "wx/defs.h" + +#if wxUSE_STATBMP + #include "wx/object.h" #include "wx/control.h" #include "wx/bitmap.h" @@ -57,4 +60,6 @@ class wxStaticBitmap: public wxControl wxBitmap m_bitmap; }; +#endif + #endif // __GTKSTATICBITMAPH__ diff --git a/include/wx/gtk1/statbox.h b/include/wx/gtk1/statbox.h index 7d827c0d4b..7978dd9bc8 100644 --- a/include/wx/gtk1/statbox.h +++ b/include/wx/gtk1/statbox.h @@ -16,6 +16,9 @@ #endif #include "wx/defs.h" + +#if wxUSE_STATBOX + #include "wx/object.h" #include "wx/list.h" #include "wx/control.h" @@ -56,4 +59,6 @@ class wxStaticBox: public wxControl void ApplyWidgetStyle(); }; +#endif + #endif // __GTKSTATICBOXH__ diff --git a/include/wx/gtk1/statline.h b/include/wx/gtk1/statline.h index c6819e51a5..2d31725292 100644 --- a/include/wx/gtk1/statline.h +++ b/include/wx/gtk1/statline.h @@ -16,6 +16,9 @@ #endif #include "wx/defs.h" + +#if wxUSE_STATLINE + #include "wx/object.h" #include "wx/list.h" #include "wx/control.h" @@ -52,4 +55,6 @@ class wxStaticLine: public wxControl }; +#endif + #endif // __GTKSTATICLINEH__ diff --git a/include/wx/gtk1/tbargtk.h b/include/wx/gtk1/tbargtk.h index 39545eb984..5a6f17415d 100644 --- a/include/wx/gtk1/tbargtk.h +++ b/include/wx/gtk1/tbargtk.h @@ -15,6 +15,9 @@ #endif #include "wx/defs.h" + +#if wxUSE_TOOLBAR + #include "wx/control.h" #include "wx/bitmap.h" #include "wx/tbarbase.h" @@ -119,5 +122,7 @@ class wxToolBar: public wxControl bool m_hasToolAlready; }; +#endif + #endif // __TBARGTKH__ diff --git a/include/wx/string.h b/include/wx/string.h index 91d990fdbd..2f25942e18 100644 --- a/include/wx/string.h +++ b/include/wx/string.h @@ -198,7 +198,6 @@ class WXDLLEXPORT wxMBConv #endif }; WXDLLEXPORT_DATA(extern wxMBConv) wxConvLibc; -#define wxConv_libc wxConvLibc #define wxANOTHER_MBCONV(type) \ class type : public wxMBConv { \ @@ -208,14 +207,11 @@ class type : public wxMBConv { \ } WXDLLEXPORT_DATA(extern wxANOTHER_MBCONV(wxMBConvFile)) wxConvFile; -#define wxConv_file wxConvFile WXDLLEXPORT_DATA(extern wxANOTHER_MBCONV(wxMBConvUTF7)) wxConvUTF7; WXDLLEXPORT_DATA(extern wxANOTHER_MBCONV(wxMBConvUTF8)) wxConvUTF8; -#define wxConv_UTF8 wxConvUTF8 -#if defined(__WXGTK12__) +#ifdef __WXGTK12__ WXDLLEXPORT_DATA(extern wxANOTHER_MBCONV(wxMBConvGdk)) wxConvGdk; - #define wxConv_gdk wxConvGdk -#endif // GTK > 1.0 +#endif class wxCharacterSet; class WXDLLEXPORT wxCSConv : public wxMBConv @@ -260,10 +256,7 @@ public: const char* cWX2MB(const char *psz) const { return psz; } }; WXDLLEXPORT_DATA(extern wxMBConv) wxConvLibc, wxConvFile; -#define wxConv_libc wxConvLibc -#define wxConv_file wxConvFile WXDLLEXPORT_DATA(extern wxMBConv *) wxConvCurrent; -#define wxConv_current wxConvCurrent #define wxFNCONV(name) name #define FNSTRINGCAST WXSTRINGCAST #endif//wxUSE_WCHAR_T diff --git a/samples/dialogs/dialogs.cpp b/samples/dialogs/dialogs.cpp index 5b38a4085d..75fb99d93d 100644 --- a/samples/dialogs/dialogs.cpp +++ b/samples/dialogs/dialogs.cpp @@ -48,7 +48,7 @@ MyCanvas *myCanvas = (MyCanvas *) NULL; bool MyApp::OnInit(void) { #if defined(__WXGTK__) && defined(wxUSE_UNICODE) - wxConvCurrent = &wxConvLocal; + wxConvCurrent = &wxConvLibc; #endif m_canvasTextColour = wxColour("BLACK"); diff --git a/samples/typetest/typetest.cpp b/samples/typetest/typetest.cpp index 3a7545896f..fc30948769 100644 --- a/samples/typetest/typetest.cpp +++ b/samples/typetest/typetest.cpp @@ -40,10 +40,13 @@ IMPLEMENT_APP (MyApp) IMPLEMENT_DYNAMIC_CLASS (MyApp, wxApp) BEGIN_EVENT_TABLE(MyApp, wxApp) - EVT_MENU(TYPES_DATE, MyApp::DoDateDemo) - EVT_MENU(TYPES_TIME, MyApp::DoTimeDemo) - EVT_MENU(TYPES_VARIANT, MyApp::DoVariantDemo) + EVT_MENU(TYPES_DATE, MyApp::DoDateDemo) + EVT_MENU(TYPES_TIME, MyApp::DoTimeDemo) + EVT_MENU(TYPES_VARIANT, MyApp::DoVariantDemo) EVT_MENU(TYPES_BYTEORDER, MyApp::DoByteOrderDemo) +#if wxUSE_UNICODE + EVT_MENU(TYPES_UNICODE, MyApp::DoUnicodeDemo) +#endif END_EVENT_TABLE() bool MyApp::OnInit(void) @@ -64,6 +67,9 @@ bool MyApp::OnInit(void) file_menu->Append(TYPES_TIME, "&Time test"); file_menu->Append(TYPES_VARIANT, "&Variant test"); file_menu->Append(TYPES_BYTEORDER, "&Byteorder test"); +#if wxUSE_UNICODE + file_menu->Append(TYPES_UNICODE, "&Unicode test"); +#endif file_menu->AppendSeparator(); file_menu->Append(TYPES_QUIT, "E&xit"); wxMenuBar *menu_bar = new wxMenuBar; @@ -80,6 +86,32 @@ bool MyApp::OnInit(void) return TRUE; } +#if wxUSE_UNICODE +void MyApp::DoUnicodeDemo(wxCommandEvent& WXUNUSED(event)) +{ + wxTextCtrl& textCtrl = * GetTextCtrl(); + + textCtrl.Clear(); + textCtrl << "\nTest wchar_t to char (Unicode to ANSI/Multibyte) converions:"; + + wxString str; + str = _T("Robert Röbling\n"); + + printf( "\n\nConversion with wxConvLocal:\n" ); + wxConvCurrent = &wxConvLocal; + printf( (const char*) str.mbc_str() ); + + printf( "\n\nConversion with wxConvGdk:\n" ); + wxConvCurrent = &wxConvGdk; + printf( (const char*) str.mbc_str() ); + + printf( "\n\nConversion with wxConvLibc:\n" ); + wxConvCurrent = &wxConvLibc; + printf( (const char*) str.mbc_str() ); + +} +#endif + void MyApp::DoByteOrderDemo(wxCommandEvent& WXUNUSED(event)) { wxTextCtrl& textCtrl = * GetTextCtrl(); @@ -96,19 +128,19 @@ void MyApp::DoByteOrderDemo(wxCommandEvent& WXUNUSED(event)) wxInt32 var = 0xF1F2F3F4; text = ""; - text.Printf( "Value of wxInt32 is now: %#x.\n\n", var ); + text.Printf( _T("Value of wxInt32 is now: %#x.\n\n"), var ); textCtrl.WriteText( text ); text = ""; - text.Printf( "Value of swapped wxInt32 is: %#x.\n\n", wxINT32_SWAP_ALWAYS( var ) ); + text.Printf( _T("Value of swapped wxInt32 is: %#x.\n\n"), wxINT32_SWAP_ALWAYS( var ) ); textCtrl.WriteText( text ); text = ""; - text.Printf( "Value of wxInt32 swapped on little endian is: %#x.\n\n", wxINT32_SWAP_ON_LE( var ) ); + text.Printf( _T("Value of wxInt32 swapped on little endian is: %#x.\n\n"), wxINT32_SWAP_ON_LE( var ) ); textCtrl.WriteText( text ); text = ""; - text.Printf( "Value of wxInt32 swapped on big endian is: %#x.\n\n", wxINT32_SWAP_ON_BE( var ) ); + text.Printf( _T("Value of wxInt32 swapped on big endian is: %#x.\n\n"), wxINT32_SWAP_ON_BE( var ) ); textCtrl.WriteText( text ); } @@ -287,7 +319,7 @@ void MyApp::DoVariantDemo(wxCommandEvent& WXUNUSED(event) ) long l = var1; wxStringList stringList; - stringList.Add("one"); stringList.Add("two"); stringList.Add("three"); + stringList.Add(_T("one")); stringList.Add(_T("two")); stringList.Add(_T("three")); var1 = stringList; textCtrl << "var1 = " << var1.MakeString() << "\n"; diff --git a/samples/typetest/typetest.h b/samples/typetest/typetest.h index dde4128437..454fe984db 100644 --- a/samples/typetest/typetest.h +++ b/samples/typetest/typetest.h @@ -26,6 +26,9 @@ public: void DoTimeDemo(wxCommandEvent& event); void DoVariantDemo(wxCommandEvent& event); void DoByteOrderDemo(wxCommandEvent& event); +#if wxUSE_UNICODE + void DoUnicodeDemo(wxCommandEvent& event); +#endif wxTextCtrl* GetTextCtrl() const { return m_textCtrl; } @@ -62,6 +65,7 @@ public: #define TYPES_TIME 104 #define TYPES_VARIANT 105 #define TYPES_BYTEORDER 106 +#define TYPES_UNICODE 107 #endif // _WX_TYPETEST_H_ diff --git a/src/common/file.cpp b/src/common/file.cpp index 9c207aacf2..07c0f058fa 100644 --- a/src/common/file.cpp +++ b/src/common/file.cpp @@ -160,7 +160,7 @@ bool wxFile::Exists(const wxChar *name) { struct stat st; #if wxUSE_UNICODE && wxMBFILES - wxCharBuffer fname = wxConv_file.cWC2MB(name); + wxCharBuffer fname = wxConvFile.cWC2MB(name); return !access(fname, 0) && !stat(MBSTRINGCAST fname, &st) && diff --git a/src/common/filefn.cpp b/src/common/filefn.cpp index 33b30d5832..13ecedef05 100644 --- a/src/common/filefn.cpp +++ b/src/common/filefn.cpp @@ -1076,8 +1076,8 @@ bool wxDirExists(const wxString& dir) // does the path exists? (may have or not '/' or '\\' at the end) bool wxPathExists(const wxChar *pszPathName) { - // Windows API returns -1 from stat for "c:\dir\" if "c:\dir" exists - // OTOH, we should change "d:" to "d:\" and leave "\" as is. + /* Windows API returns -1 from stat for "c:\dir\" if "c:\dir" exists + * OTOH, we should change "d:" to "d:\" and leave "\" as is. */ wxString strPath(pszPathName); if ( wxEndsWithPathSeparator(pszPathName) && pszPathName[1] != _T('\0') ) strPath.Last() = _T('\0'); @@ -1444,7 +1444,7 @@ wxChar *wxGetWorkingDirectory(wxChar *buf, int sz) } #if wxUSE_UNICODE else { - wxConv_file.MB2WC(buf, cbuf, sz); + wxConvFile.MB2WC(buf, cbuf, sz); delete [] cbuf; } #endif diff --git a/src/common/intl.cpp b/src/common/intl.cpp index 7153596262..020bd9be8b 100644 --- a/src/common/intl.cpp +++ b/src/common/intl.cpp @@ -517,7 +517,7 @@ const wxMB2WXbuf wxLocale::GetString(const wxChar *szOrigString, return szDomain; const char *pszTrans = NULL; - const wxWX2MBbuf szOrgString = wxConv_libc.cWX2MB(szOrigString); + const wxWX2MBbuf szOrgString = wxConvCurrent->cWX2MB(szOrigString); wxMsgCatalog *pMsgCat; if ( szDomain != NULL ) { @@ -564,7 +564,7 @@ const wxMB2WXbuf wxLocale::GetString(const wxChar *szOrigString, return (wxMB2WXbuf)(szOrigString); } else - return (wxMB2WXbuf)(wxConv_libc.cMB2WX(pszTrans)); + return (wxMB2WXbuf)(wxConvCurrent->cMB2WX(pszTrans)); } // find catalog by name in a linked list, return NULL if !found diff --git a/src/common/log.cpp b/src/common/log.cpp index 2f8b2c0a0a..f9729d48d2 100644 --- a/src/common/log.cpp +++ b/src/common/log.cpp @@ -405,7 +405,7 @@ wxLogStream::wxLogStream(ostream *ostr) void wxLogStream::DoLogString(const wxChar *szString, time_t WXUNUSED(t)) { - (*m_ostr) << wxConv_libc.cWX2MB(szString) << endl << flush; + (*m_ostr) << wxConvCurrent->cWX2MB(szString) << endl << flush; } #endif // wxUSE_STD_IOSTREAM @@ -972,7 +972,7 @@ const wxChar *wxSysErrorMsg(unsigned long nErrCode) #else // Unix #if wxUSE_UNICODE static wxChar s_szBuf[LOG_BUFFER_SIZE / 2]; - wxConv_libc.MB2WC(s_szBuf, strerror(nErrCode), WXSIZEOF(s_szBuf) -1); + wxConvCurrent->MB2WC(s_szBuf, strerror(nErrCode), WXSIZEOF(s_szBuf) -1); return s_szBuf; #else return strerror(nErrCode); diff --git a/src/common/resource.cpp b/src/common/resource.cpp index 56b976b194..f194ea4167 100644 --- a/src/common/resource.cpp +++ b/src/common/resource.cpp @@ -1621,9 +1621,9 @@ bool wxResourceReadOneResource(FILE *fd, wxExprDatabase& db, bool *eof, wxResour if (strcmp(wxResourceBuffer, "#define") == 0) { wxGetResourceToken(fd); - wxChar *name = copystring(wxConv_libc.cMB2WX(wxResourceBuffer)); + wxChar *name = copystring(wxConvCurrent->cMB2WX(wxResourceBuffer)); wxGetResourceToken(fd); - wxChar *value = copystring(wxConv_libc.cMB2WX(wxResourceBuffer)); + wxChar *value = copystring(wxConvCurrent->cMB2WX(wxResourceBuffer)); if (wxIsalpha(value[0])) { int val = (int)wxAtol(value); @@ -1644,7 +1644,7 @@ bool wxResourceReadOneResource(FILE *fd, wxExprDatabase& db, bool *eof, wxResour else if (strcmp(wxResourceBuffer, "#include") == 0) { wxGetResourceToken(fd); - wxChar *name = copystring(wxConv_libc.cMB2WX(wxResourceBuffer)); + wxChar *name = copystring(wxConvCurrent->cMB2WX(wxResourceBuffer)); wxChar *actualName = name; if (name[0] == _T('"')) actualName = name + 1; @@ -1662,7 +1662,7 @@ bool wxResourceReadOneResource(FILE *fd, wxExprDatabase& db, bool *eof, wxResour { wxChar buf[300]; wxStrcpy(buf, _("Found ")); - wxStrncat(buf, wxConv_libc.cMB2WX(wxResourceBuffer), 30); + wxStrncat(buf, wxConvCurrent->cMB2WX(wxResourceBuffer), 30); wxStrcat(buf, _(", expected static, #include or #define\nwhilst parsing resource.")); wxLogWarning(buf); return FALSE; @@ -2525,9 +2525,9 @@ bool wxResourceParseIncludeFile(const wxString& f, wxResourceTable *table) if (strcmp(wxResourceBuffer, "#define") == 0) { wxGetResourceToken(fd); - wxChar *name = copystring(wxConv_libc.cMB2WX(wxResourceBuffer)); + wxChar *name = copystring(wxConvCurrent->cMB2WX(wxResourceBuffer)); wxGetResourceToken(fd); - wxChar *value = copystring(wxConv_libc.cMB2WX(wxResourceBuffer)); + wxChar *value = copystring(wxConvCurrent->cMB2WX(wxResourceBuffer)); if (wxIsdigit(value[0])) { int val = (int)wxAtol(value); @@ -2698,9 +2698,9 @@ bool wxResourceReadOneResourceString(char *s, wxExprDatabase& db, bool *eof, wxR if (strcmp(wxResourceBuffer, "#define") == 0) { wxGetResourceTokenString(s); - wxChar *name = copystring(wxConv_libc.cMB2WX(wxResourceBuffer)); + wxChar *name = copystring(wxConvCurrent->cMB2WX(wxResourceBuffer)); wxGetResourceTokenString(s); - wxChar *value = copystring(wxConv_libc.cMB2WX(wxResourceBuffer)); + wxChar *value = copystring(wxConvCurrent->cMB2WX(wxResourceBuffer)); if (wxIsalpha(value[0])) { int val = (int)wxAtol(value); @@ -2743,7 +2743,7 @@ bool wxResourceReadOneResourceString(char *s, wxExprDatabase& db, bool *eof, wxR { wxChar buf[300]; wxStrcpy(buf, _("Found ")); - wxStrncat(buf, wxConv_libc.cMB2WX(wxResourceBuffer), 30); + wxStrncat(buf, wxConvCurrent->cMB2WX(wxResourceBuffer), 30); wxStrcat(buf, _(", expected static, #include or #define\nwhilst parsing resource.")); wxLogWarning(buf); return FALSE; diff --git a/src/common/string.cpp b/src/common/string.cpp index 47f5c3489d..1b42fd7893 100644 --- a/src/common/string.cpp +++ b/src/common/string.cpp @@ -94,6 +94,13 @@ extern const wxChar WXDLLEXPORT *g_szNul = &g_strEmpty.dummy; // conditional compilation // ---------------------------------------------------------------------------- +#if !defined(__WXSW__) && wxUSE_UNICODE + #ifdef wxUSE_EXPERIMENTAL_PRINTF + #undef wxUSE_EXPERIMENTAL_PRINTF + #endif + #define wxUSE_EXPERIMENTAL_PRINTF 1 +#endif + // we want to find out if the current platform supports vsnprintf()-like // function: for Unix this is done with configure, for Windows we test the // compiler explicitly. @@ -2189,7 +2196,6 @@ static void wxLoadCharacterSets(void) wxString uni = token.GetNextToken(); // skip whitespace again while (wxIsEmpty(uni) && token.HasMoreTokens()) uni = token.GetNextToken(); - if ((hex.Len() > 2) && (wxString(hex.GetChar(0)) == escchar) && (hex.GetChar(1) == _T('x')) && (uni.Left(2) == _T("IsKindOf(CLASSINFO(wxCheckBox)) ) { wxCheckBox* pControl = (wxCheckBox*) m_validatorWindow; @@ -94,8 +95,10 @@ bool wxGenericValidator::TransferToWindow(void) pControl->SetValue(*m_pBool) ; return TRUE; } - } - else if (m_validatorWindow->IsKindOf(CLASSINFO(wxRadioButton)) ) + } else +#endif +#if wxUSE_RADIOBTN + if (m_validatorWindow->IsKindOf(CLASSINFO(wxRadioButton)) ) { wxRadioButton* pControl = (wxRadioButton*) m_validatorWindow; if (m_pBool) @@ -103,9 +106,11 @@ bool wxGenericValidator::TransferToWindow(void) pControl->SetValue(*m_pBool) ; return TRUE; } - } + } else +#endif // int controls - else if (m_validatorWindow->IsKindOf(CLASSINFO(wxGauge)) ) +#if wxUSE_GAUGE + if (m_validatorWindow->IsKindOf(CLASSINFO(wxGauge)) ) { wxGauge* pControl = (wxGauge*) m_validatorWindow; if (m_pInt) @@ -114,7 +119,10 @@ bool wxGenericValidator::TransferToWindow(void) return TRUE; } } - else if (m_validatorWindow->IsKindOf(CLASSINFO(wxRadioBox)) ) + else +#endif +#if wxUSE_RADIOBOX + if (m_validatorWindow->IsKindOf(CLASSINFO(wxRadioBox)) ) { wxRadioBox* pControl = (wxRadioBox*) m_validatorWindow; if (m_pInt) @@ -123,7 +131,10 @@ bool wxGenericValidator::TransferToWindow(void) return TRUE; } } - else if (m_validatorWindow->IsKindOf(CLASSINFO(wxScrollBar)) ) + else +#endif +#if wxUSE_SCROLLBAR + if (m_validatorWindow->IsKindOf(CLASSINFO(wxScrollBar)) ) { wxScrollBar* pControl = (wxScrollBar*) m_validatorWindow; if (m_pInt) @@ -131,9 +142,11 @@ bool wxGenericValidator::TransferToWindow(void) pControl->SetThumbPosition(*m_pInt) ; return TRUE; } - } + } else +#endif +#if wxUSE_SPINBTN #ifndef __WIN16__ - else if (m_validatorWindow->IsKindOf(CLASSINFO(wxSpinButton)) ) + if (m_validatorWindow->IsKindOf(CLASSINFO(wxSpinButton)) ) { wxSpinButton* pControl = (wxSpinButton*) m_validatorWindow; if (m_pInt) @@ -141,10 +154,11 @@ bool wxGenericValidator::TransferToWindow(void) pControl->SetValue(*m_pInt) ; return TRUE; } - } + } else +#endif #endif // string controls - else if (m_validatorWindow->IsKindOf(CLASSINFO(wxButton)) ) + if (m_validatorWindow->IsKindOf(CLASSINFO(wxButton)) ) { wxButton* pControl = (wxButton*) m_validatorWindow; if (m_pString) @@ -152,8 +166,9 @@ bool wxGenericValidator::TransferToWindow(void) pControl->SetLabel(*m_pString) ; return TRUE; } - } - else if (m_validatorWindow->IsKindOf(CLASSINFO(wxComboBox)) ) + } else +#if wxUSE_COMBOBOX + if (m_validatorWindow->IsKindOf(CLASSINFO(wxComboBox)) ) { wxComboBox* pControl = (wxComboBox*) m_validatorWindow; if (m_pString) @@ -162,6 +177,7 @@ bool wxGenericValidator::TransferToWindow(void) return TRUE; } } +#endif else if (m_validatorWindow->IsKindOf(CLASSINFO(wxChoice)) ) { wxChoice* pControl = (wxChoice*) m_validatorWindow; @@ -188,12 +204,13 @@ bool wxGenericValidator::TransferToWindow(void) pControl->SetValue(*m_pString) ; return TRUE; } - } + } else +#if wxUSE_CHECKLISTBOX #ifndef __WIN16__ // array controls // NOTE: wxCheckListBox isa wxListBox, so wxCheckListBox // MUST come first: - else if (m_validatorWindow->IsKindOf(CLASSINFO(wxCheckListBox)) ) + if (m_validatorWindow->IsKindOf(CLASSINFO(wxCheckListBox)) ) { wxCheckListBox* pControl = (wxCheckListBox*) m_validatorWindow; if (m_pArrayInt) @@ -210,9 +227,11 @@ bool wxGenericValidator::TransferToWindow(void) } else return FALSE; - } + } else #endif - else if (m_validatorWindow->IsKindOf(CLASSINFO(wxListBox)) ) +#endif +#if wxUSE_LISTBOX + if (m_validatorWindow->IsKindOf(CLASSINFO(wxListBox)) ) { wxListBox* pControl = (wxListBox*) m_validatorWindow; if (m_pArrayInt) @@ -227,9 +246,11 @@ bool wxGenericValidator::TransferToWindow(void) pControl->SetSelection(m_pArrayInt->Item(u)); return TRUE; } - } + } else +#endif // unrecognized control, or bad pointer + return FALSE; return FALSE; } @@ -240,6 +261,7 @@ bool wxGenericValidator::TransferFromWindow(void) return FALSE; // bool controls +#if wxUSE_CHECKBOX if (m_validatorWindow->IsKindOf(CLASSINFO(wxCheckBox)) ) { wxCheckBox* pControl = (wxCheckBox*) m_validatorWindow; @@ -248,8 +270,10 @@ bool wxGenericValidator::TransferFromWindow(void) *m_pBool = pControl->GetValue() ; return TRUE; } - } - else if (m_validatorWindow->IsKindOf(CLASSINFO(wxRadioButton)) ) + } else +#endif +#if wxUSE_RADIOBTN + if (m_validatorWindow->IsKindOf(CLASSINFO(wxRadioButton)) ) { wxRadioButton* pControl = (wxRadioButton*) m_validatorWindow; if (m_pBool) @@ -257,9 +281,11 @@ bool wxGenericValidator::TransferFromWindow(void) *m_pBool = pControl->GetValue() ; return TRUE; } - } + } else +#endif // int controls - else if (m_validatorWindow->IsKindOf(CLASSINFO(wxGauge)) ) +#if wxUSE_GAUGE + if (m_validatorWindow->IsKindOf(CLASSINFO(wxGauge)) ) { wxGauge* pControl = (wxGauge*) m_validatorWindow; if (m_pInt) @@ -267,8 +293,10 @@ bool wxGenericValidator::TransferFromWindow(void) *m_pInt = pControl->GetValue() ; return TRUE; } - } - else if (m_validatorWindow->IsKindOf(CLASSINFO(wxRadioBox)) ) + } else +#endif +#if wxUSE_RADIOBOX + if (m_validatorWindow->IsKindOf(CLASSINFO(wxRadioBox)) ) { wxRadioBox* pControl = (wxRadioBox*) m_validatorWindow; if (m_pInt) @@ -276,8 +304,10 @@ bool wxGenericValidator::TransferFromWindow(void) *m_pInt = pControl->GetSelection() ; return TRUE; } - } - else if (m_validatorWindow->IsKindOf(CLASSINFO(wxScrollBar)) ) + } else +#endif +#if wxUSE_SCROLLBAR + if (m_validatorWindow->IsKindOf(CLASSINFO(wxScrollBar)) ) { wxScrollBar* pControl = (wxScrollBar*) m_validatorWindow; if (m_pInt) @@ -285,9 +315,11 @@ bool wxGenericValidator::TransferFromWindow(void) *m_pInt = pControl->GetThumbPosition() ; return TRUE; } - } + } else +#endif +#if wxUSE_SPINBTN #ifndef __WIN16__ - else if (m_validatorWindow->IsKindOf(CLASSINFO(wxSpinButton)) ) + if (m_validatorWindow->IsKindOf(CLASSINFO(wxSpinButton)) ) { wxSpinButton* pControl = (wxSpinButton*) m_validatorWindow; if (m_pInt) @@ -295,10 +327,11 @@ bool wxGenericValidator::TransferFromWindow(void) *m_pInt = pControl->GetValue() ; return TRUE; } - } + } else +#endif #endif // string controls - else if (m_validatorWindow->IsKindOf(CLASSINFO(wxButton)) ) + if (m_validatorWindow->IsKindOf(CLASSINFO(wxButton)) ) { wxButton* pControl = (wxButton*) m_validatorWindow; if (m_pString) @@ -307,7 +340,9 @@ bool wxGenericValidator::TransferFromWindow(void) return TRUE; } } - else if (m_validatorWindow->IsKindOf(CLASSINFO(wxComboBox)) ) + else +#if wxUSE_COMBOBOX + if (m_validatorWindow->IsKindOf(CLASSINFO(wxComboBox)) ) { wxComboBox* pControl = (wxComboBox*) m_validatorWindow; if (m_pString) @@ -315,8 +350,9 @@ bool wxGenericValidator::TransferFromWindow(void) *m_pString = pControl->GetValue() ; return TRUE; } - } - else if (m_validatorWindow->IsKindOf(CLASSINFO(wxChoice)) ) + } else +#endif + if (m_validatorWindow->IsKindOf(CLASSINFO(wxChoice)) ) { wxChoice* pControl = (wxChoice*) m_validatorWindow; if (m_pInt) @@ -324,8 +360,8 @@ bool wxGenericValidator::TransferFromWindow(void) *m_pInt = pControl->GetSelection() ; return TRUE; } - } - else if (m_validatorWindow->IsKindOf(CLASSINFO(wxStaticText)) ) + } else + if (m_validatorWindow->IsKindOf(CLASSINFO(wxStaticText)) ) { wxStaticText* pControl = (wxStaticText*) m_validatorWindow; if (m_pString) @@ -333,8 +369,8 @@ bool wxGenericValidator::TransferFromWindow(void) *m_pString = pControl->GetLabel() ; return TRUE; } - } - else if (m_validatorWindow->IsKindOf(CLASSINFO(wxTextCtrl)) ) + } else + if (m_validatorWindow->IsKindOf(CLASSINFO(wxTextCtrl)) ) { wxTextCtrl* pControl = (wxTextCtrl*) m_validatorWindow; if (m_pString) @@ -342,12 +378,13 @@ bool wxGenericValidator::TransferFromWindow(void) *m_pString = pControl->GetValue() ; return TRUE; } - } + } else +#if wxUSE_LISTBOX #ifndef __WIN16__ // array controls // NOTE: wxCheckListBox isa wxListBox, so wxCheckListBox // MUST come first: - else if (m_validatorWindow->IsKindOf(CLASSINFO(wxCheckListBox)) ) + if (m_validatorWindow->IsKindOf(CLASSINFO(wxCheckListBox)) ) { wxCheckListBox* pControl = (wxCheckListBox*) m_validatorWindow; if (m_pArrayInt) @@ -363,9 +400,11 @@ bool wxGenericValidator::TransferFromWindow(void) } else return FALSE; - } + } else +#endif #endif - else if (m_validatorWindow->IsKindOf(CLASSINFO(wxListBox)) ) +#if wxUSE_LISTBOX + if (m_validatorWindow->IsKindOf(CLASSINFO(wxListBox)) ) { wxListBox* pControl = (wxListBox*) m_validatorWindow; if (m_pArrayInt) @@ -379,9 +418,11 @@ bool wxGenericValidator::TransferFromWindow(void) m_pArrayInt->Add(i); return TRUE; } - } + } else +#endif // unrecognized control, or bad pointer + return FALSE; return FALSE; } diff --git a/src/common/wxchar.cpp b/src/common/wxchar.cpp index 90ec19c7b6..72d7acb196 100644 --- a/src/common/wxchar.cpp +++ b/src/common/wxchar.cpp @@ -190,7 +190,7 @@ WXDLLEXPORT wxChar * wxStrtok(wxChar *psz, const wxChar *delim, wxChar **save_pt #ifndef wxSetlocale wxChar * WXDLLEXPORT wxSetlocale(int category, const wxChar *locale) { - setlocale(category, wxConv_libc.cWX2MB(locale)); + setlocale(category, wxConvLibc.cWX2MB(locale)); // FIXME return (wxChar *)NULL; } @@ -272,7 +272,7 @@ int WXDLLEXPORT wxVsscanf(const wxChar *buf, const wxChar *fmt, va_list argptr) int ret; // this will work only for numeric conversion! Strings will not be converted correctly // hopefully this is all we'll need - ret = vsscanf(wxConv_libc.cWX2MB(buf), wxConv_libc.cWX2MB(fmt), argptr); + ret = vsscanf(wxConvLibc.cWX2MB(buf), wxConvLibc.cWX2MB(fmt), argptr); return ret; } #endif @@ -280,19 +280,19 @@ int WXDLLEXPORT wxVsscanf(const wxChar *buf, const wxChar *fmt, va_list argptr) #ifndef wxAtof double WXDLLEXPORT wxAtof(const wxChar *psz) { - return atof(wxConv_libc.cWX2MB(psz)); + return atof(wxConvLibc.cWX2MB(psz)); } #endif #ifdef wxNEED_WX_STDLIB_H int WXDLLEXPORT wxAtoi(const wxChar *psz) { - return atoi(wxConv_libc.cWX2MB(psz)); + return atoi(wxConvLibc.cWX2MB(psz)); } long WXDLLEXPORT wxAtol(const wxChar *psz) { - return atol(wxConv_libc.cWX2MB(psz)); + return atol(wxConvLibc.cWX2MB(psz)); } wxChar * WXDLLEXPORT wxGetenv(const wxChar *name) @@ -302,7 +302,7 @@ wxChar * WXDLLEXPORT wxGetenv(const wxChar *name) wxObject *data = env.Get(name); if (!data) { // nope, retrieve it, - const char *val = getenv(wxConv_libc.cWX2MB(name)); + const char *val = getenv(wxConvLibc.cWX2MB(name)); if (!val) return (wxChar *)NULL; // convert it, data = (wxObject *)new wxString(val); @@ -315,7 +315,7 @@ wxChar * WXDLLEXPORT wxGetenv(const wxChar *name) int WXDLLEXPORT wxSystem(const wxChar *psz) { - return system(wxConv_libc.cWX2MB(psz)); + return system(wxConvLibc.cWX2MB(psz)); } #endif diff --git a/src/common/wxexpr.cpp b/src/common/wxexpr.cpp index 227efb2850..41e4132e59 100644 --- a/src/common/wxexpr.cpp +++ b/src/common/wxexpr.cpp @@ -733,7 +733,7 @@ void wxExpr::WriteExpr(ostream& stream) // Write as any other subexpression { stream << "\""; int i; - const wxWX2MBbuf val = wxConv_libc.cWX2MB(value.string); + const wxWX2MBbuf val = wxConvLibc.cWX2MB(value.string); int len = strlen(val); for (i = 0; i < len; i++) { @@ -749,7 +749,7 @@ void wxExpr::WriteExpr(ostream& stream) // Write as any other subexpression case wxExprWord: { bool quote_it = FALSE; - const wxWX2MBbuf val = wxConv_libc.cWX2MB(value.word); + const wxWX2MBbuf val = wxConvLibc.cWX2MB(value.word); int len = strlen(val); if ((len == 0) || (len > 0 && (val[0] > 64 && val[0] < 91))) quote_it = TRUE; @@ -1195,7 +1195,7 @@ char *wxmake_string(char *str) { wxChar *s, *t; int len, i; - const wxMB2WXbuf sbuf = wxConv_libc.cMB2WX(str); + const wxMB2WXbuf sbuf = wxConvLibc.cMB2WX(str); // str++; /* skip leading quote */ len = wxStrlen(sbuf) - 1; /* ignore trailing quote */ diff --git a/src/generic/choicdgg.cpp b/src/generic/choicdgg.cpp index efe516c05d..9195ffc2d1 100644 --- a/src/generic/choicdgg.cpp +++ b/src/generic/choicdgg.cpp @@ -20,54 +20,60 @@ #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/button.h" + #include "wx/listbox.h" + #include "wx/stattext.h" + #include "wx/intl.h" +#endif + +#if wxUSE_STATLINE + #include "wx/statline.h" #endif #include "wx/generic/choicdgg.h" -// Split message, using constraints to position controls -static void wxSplitMessage2(const wxChar *message, wxList *messageList, wxWindow *parent, wxRowColSizer *sizer) +/* Split message, using constraints to position controls */ +static wxSize wxSplitMessage2( const wxString &message, wxWindow *parent ) { - wxChar *copyMessage = copystring(message); - size_t i = 0; - size_t len = wxStrlen(copyMessage); - wxChar *currentMessage = copyMessage; - -// wxWindow *lastWindow = parent; - - while (i < len) { - while ((i < len) && (copyMessage[i] != _T('\n'))) i++; - if (i < len) copyMessage[i] = 0; - wxStaticText *mess = new wxStaticText(parent, -1, currentMessage); - -/* - wxLayoutConstraints *c = new wxLayoutConstraints; - c->left.SameAs (parent, wxLeft, 10); - c->top.SameAs (lastWindow, wxBottom, 5); - c->right.AsIs (); - c->height.AsIs (); - - mess->SetConstraints(c); -*/ - sizer->AddSizerChild(mess); - - messageList->Append(mess); - - currentMessage = copyMessage + i + 1; - } - delete[] copyMessage; + int y = 10; + int w = 50; + wxString line( _T("") ); + for (uint pos = 0; pos < message.Len(); pos++) + { + if (message[pos] == _T('\n')) + { + if (!line.IsEmpty()) + { + wxStaticText *s1 = new wxStaticText( parent, -1, line, wxPoint(15,y) ); + wxSize size1( s1->GetSize() ); + if (size1.x > w) w = size1.x; + line = _T(""); + } + y += 18; + } + else + { + line += message[pos]; + } + } + + if (!line.IsEmpty()) + { + wxStaticText *s2 = new wxStaticText( parent, -1, line, wxPoint(15,y) ); + wxSize size2( s2->GetSize() ); + if (size2.x > w) w = size2.x; + } + + y += 18; + + return wxSize(w+30,y); } + wxString wxGetSingleChoice( const wxString& message, const wxString& caption, int n, const wxString *choices, wxWindow *parent, int WXUNUSED(x), int WXUNUSED(y), bool WXUNUSED(centre), @@ -75,11 +81,9 @@ wxString wxGetSingleChoice( const wxString& message, const wxString& caption, in { wxSingleChoiceDialog dialog(parent, message, caption, n, choices); if ( dialog.ShowModal() == wxID_OK ) - { return dialog.GetStringSelection(); - } else - return ""; + return _T(""); } // Overloaded for backward compatibility @@ -107,9 +111,7 @@ int wxGetSingleChoiceIndex( const wxString& message, const wxString& caption, in { wxSingleChoiceDialog dialog(parent, message, caption, n, choices); if ( dialog.ShowModal() == wxID_OK ) - { return dialog.GetSelection(); - } else return -1; } @@ -121,11 +123,8 @@ int wxGetSingleChoiceIndex( const wxString& message, const wxString& caption, in int width, int height ) { wxString *strings = new wxString[n]; - int i; - for ( i = 0; i < n; i++) - { + for ( int 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; @@ -139,9 +138,7 @@ wxChar *wxGetSingleChoiceData( const wxString& message, const wxString& caption, { wxSingleChoiceDialog dialog(parent, message, caption, n, choices, client_data); if ( dialog.ShowModal() == wxID_OK ) - { return dialog.GetSelectionClientData(); - } else return NULL; } @@ -242,71 +239,38 @@ bool wxSingleChoiceDialog::Create( wxWindow *WXUNUSED(parent), const wxString& m m_clientData = NULL; wxBeginBusyCursor(); - - wxSizer *topSizer = new wxSizer(this, wxSizerShrink); - topSizer->SetBorder(10, 10); - - wxRowColSizer *messageSizer = new wxRowColSizer(topSizer, wxSIZER_COLS, 100); - messageSizer->SetName(_T("messageSizer")); - - // bool centre = ((style & wxCENTRE) == wxCENTRE); - - wxList messageList; - wxSplitMessage2(message, &messageList, this, messageSizer); - - // 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); - listBox->SetSelection(m_selection); - if ( clientData ) + + wxSize message_size( wxSplitMessage2( message, this ) ); + + wxButton *ok = (wxButton *) NULL; + wxButton *cancel = (wxButton *) NULL; + wxList m_buttons; + + int y = message_size.y + 15; + + int listbox_height = wxMin( 160, n*20 ); + + wxListBox *listBox = new wxListBox( this, wxID_LISTBOX, wxPoint(10, y), wxSize(240, listbox_height), + n, choices, wxLB_ALWAYS_SB ); + listBox->SetSelection( m_selection ); + if (clientData) { - int i; - for ( i = 0; i < n; i++) - { + for (int i = 0; i < n; i++) listBox->SetClientData(i, clientData[i]); - } } + + y += listbox_height + 35; - 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; - - 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"), wxPoint(-1,y), wxSize(80,-1) ); + m_buttons.Append( 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"), wxPoint(-1,y), wxSize(80,-1) ); + m_buttons.Append( cancel ); } if (ok) @@ -315,8 +279,30 @@ bool wxSingleChoiceDialog::Create( wxWindow *WXUNUSED(parent), const wxString& m ok->SetFocus(); } - Layout(); - Centre(wxBOTH); + int w = m_buttons.GetCount() * 100; + if (message_size.x > w) w = message_size.x; + int space = w / (m_buttons.GetCount()*2); + + listBox->SetSize( 20, -1, w-10, listbox_height ); + + int m = 0; + wxNode *node = m_buttons.First(); + while (node) + { + wxWindow *win = (wxWindow*)node->Data(); + int x = (m*2+1)*space - 40 + 15; + win->Move( x, -1 ); + node = node->Next(); + m++; + } + +#if wxUSE_STATLINE + (void) new wxStaticLine( this, -1, wxPoint(0,y-20), wxSize(w+30, 5) ); +#endif + + SetSize( w+30, y+40 ); + + Centre( wxBOTH ); wxEndBusyCursor(); @@ -360,5 +346,3 @@ void wxSingleChoiceDialog::OnListBoxDClick(wxCommandEvent& WXUNUSED(event)) EndModal(wxID_OK); } -#endif // wxUSE_CONSTRAINTS - diff --git a/src/generic/dcpsg.cpp b/src/generic/dcpsg.cpp index f21c2e82a9..291946a96e 100644 --- a/src/generic/dcpsg.cpp +++ b/src/generic/dcpsg.cpp @@ -1332,7 +1332,7 @@ void wxPostScriptDC::EndDoc () wxChar *header_file = wxGetTempFileName("ps"); - m_pstream = new ofstream( wxConv_file.cWX2MB(header_file) ); + m_pstream = new ofstream( wxConvCurrent->cWX2MB(header_file) ); *m_pstream << "%!PS-Adobe-2.0\n"; /* PostScript magic strings */ *m_pstream << "%%Title: " << m_title.mb_str() << "\n"; @@ -1342,15 +1342,15 @@ void wxPostScriptDC::EndDoc () wxChar userID[256]; if ( wxGetEmailAddress(userID, sizeof(userID)) ) { - *m_pstream << "%%For: " << MBSTRINGCAST wxConv_libc.cWX2MB(userID); + *m_pstream << "%%For: " << MBSTRINGCAST wxConvCurrent->cWX2MB(userID); wxChar userName[245]; if (wxGetUserName(userName, sizeof(userName))) - *m_pstream << " (" << MBSTRINGCAST wxConv_libc.cWX2MB(userName) << ")"; + *m_pstream << " (" << MBSTRINGCAST wxConvCurrent->cWX2MB(userName) << ")"; *m_pstream << "\n"; } else if ( wxGetUserName(userID, sizeof(userID)) ) { - *m_pstream << "%%For: " << MBSTRINGCAST wxConv_libc.cWX2MB(userID) << "\n"; + *m_pstream << "%%For: " << MBSTRINGCAST wxConvCurrent->cWX2MB(userID) << "\n"; } // THE FOLLOWING HAS BEEN CONTRIBUTED BY Andy Fyfe diff --git a/src/generic/msgdlgg.cpp b/src/generic/msgdlgg.cpp index 996646d915..2f4aeb5425 100644 --- a/src/generic/msgdlgg.cpp +++ b/src/generic/msgdlgg.cpp @@ -21,13 +21,11 @@ #endif #ifndef WX_PRECOMP -#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 "wx/utils.h" + #include "wx/dialog.h" + #include "wx/button.h" + #include "wx/stattext.h" + #include "wx/intl.h" #endif #include @@ -35,15 +33,12 @@ #include "wx/generic/msgdlgg.h" -#ifdef __WXGTK__ -#include "wx/statline.h" +#if wxUSE_STATLINE + #include "wx/statline.h" #endif -/////////////////////////////////////////////////////////////////// -// New dialog box implementations - -// Split message, using constraints to position controls -wxSize wxSplitMessage2( const wxString &message, wxWindow *parent ) +/* Split message, using constraints to position controls */ +static wxSize wxSplitMessage2( const wxString &message, wxWindow *parent ) { int y = 10; int w = 50; @@ -95,6 +90,8 @@ wxGenericMessageDialog::wxGenericMessageDialog( wxWindow *parent, const wxString { m_dialogStyle = style; + wxBeginBusyCursor(); + wxSize message_size( wxSplitMessage2( message, this ) ); wxButton *ok = (wxButton *) NULL; @@ -158,13 +155,15 @@ wxGenericMessageDialog::wxGenericMessageDialog( wxWindow *parent, const wxString n++; } -#if wxUSE_STATICLINE +#if wxUSE_STATLINE (void) new wxStaticLine( this, -1, wxPoint(0,y-20), wxSize(w+30, 5) ); #endif SetSize( w+30, y+40 ); Centre( wxBOTH ); + + wxEndBusyCursor(); } void wxGenericMessageDialog::OnYes(wxCommandEvent& WXUNUSED(event)) diff --git a/src/generic/prntdlgg.cpp b/src/generic/prntdlgg.cpp index 526a4df7a6..e420201628 100644 --- a/src/generic/prntdlgg.cpp +++ b/src/generic/prntdlgg.cpp @@ -173,8 +173,8 @@ void wxGenericPrintDialog::Init(wxWindow * WXUNUSED(parent)) m_noCopiesText = new wxTextCtrl(this, wxPRINTID_COPIES, "", wxPoint(252, 130), wxSize(40, -1)); - wxButton *okButton = new wxButton(this, wxID_OK, _("OK"), wxPoint(40, 180), wxSize(100, -1)); - (void) new wxButton(this, wxID_CANCEL, _("Cancel"), wxPoint(180, 180), wxSize(100, -1)); + wxButton *okButton = new wxButton(this, wxID_OK, _("OK"), wxPoint(40, 180), wxSize(80, -1)); + (void) new wxButton(this, wxID_CANCEL, _("Cancel"), wxPoint(180, 180), wxSize(80, -1)); okButton->SetDefault(); okButton->SetFocus(); @@ -431,8 +431,8 @@ void wxGenericPrintSetupDialog::Init(wxPrintData* data) m_printerOptionsText = new wxTextCtrl(this, wxPRINTID_OPTIONS, "", wxPoint(360, 135), wxSize(150, -1)); - wxButton *okButton = new wxButton(this, wxID_OK, _("OK"), wxPoint(130, 200), wxSize(100, -1)); - (void) new wxButton(this, wxID_CANCEL, _("Cancel"), wxPoint(320, 200), wxSize(100, -1)); + wxButton *okButton = new wxButton(this, wxID_OK, _("OK"), wxPoint(130, 200), wxSize(80, -1)); + (void) new wxButton(this, wxID_CANCEL, _("Cancel"), wxPoint(320, 200), wxSize(80, -1)); okButton->SetDefault(); okButton->SetFocus(); diff --git a/src/generic/prop.cpp b/src/generic/prop.cpp index 6fa86ca2b1..11214bbb97 100644 --- a/src/generic/prop.cpp +++ b/src/generic/prop.cpp @@ -535,7 +535,7 @@ void wxPropertyValue::WritePropertyType(ostream& stream) // Write as any othe { // stream << "\""; int i; - const wxWX2MBbuf strbuf = wxConv_libc.cWX2MB(m_value.string); + const wxWX2MBbuf strbuf = wxConvCurrent->cWX2MB(m_value.string); int len = strlen(strbuf); for (i = 0; i < len; i++) { diff --git a/src/generic/textdlgg.cpp b/src/generic/textdlgg.cpp index cec7c36217..d2137b4e0b 100644 --- a/src/generic/textdlgg.cpp +++ b/src/generic/textdlgg.cpp @@ -21,19 +21,58 @@ #endif #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/textctrl.h" -#include "wx/layout.h" -#include "wx/intl.h" + #include + #include "wx/utils.h" + #include "wx/dialog.h" + #include "wx/button.h" + #include "wx/stattext.h" + #include "wx/textctrl.h" + #include "wx/intl.h" +#endif + +#if wxUSE_STATLINE + #include "wx/statline.h" #endif #include "wx/generic/textdlgg.h" +/* Split message, using constraints to position controls */ +static wxSize wxSplitMessage2( const wxString &message, wxWindow *parent ) +{ + int y = 10; + int w = 50; + wxString line( _T("") ); + for (uint pos = 0; pos < message.Len(); pos++) + { + if (message[pos] == _T('\n')) + { + if (!line.IsEmpty()) + { + wxStaticText *s1 = new wxStaticText( parent, -1, line, wxPoint(15,y) ); + wxSize size1( s1->GetSize() ); + if (size1.x > w) w = size1.x; + line = _T(""); + } + y += 18; + } + else + { + line += message[pos]; + } + } + + if (!line.IsEmpty()) + { + wxStaticText *s2 = new wxStaticText( parent, -1, line, wxPoint(15,y) ); + wxSize size2( s2->GetSize() ); + if (size2.x > w) w = size2.x; + } + + y += 18; + + return wxSize(w+30,y); +} + // wxTextEntryDialog #if !USE_SHARED_LIBRARY @@ -44,109 +83,70 @@ END_EVENT_TABLE() IMPLEMENT_CLASS(wxTextEntryDialog, wxDialog) #endif -// Split message, using constraints to position controls -static void wxSplitMessage2(const wxChar *message, wxList *messageList, wxWindow *parent, wxRowColSizer *sizer) -{ - wxChar *copyMessage = copystring(message); - size_t i = 0; - size_t len = wxStrlen(copyMessage); - wxChar *currentMessage = copyMessage; - -// wxWindow *lastWindow = parent; - - while (i < len) { - while ((i < len) && (copyMessage[i] != _T('\n'))) i++; - if (i < len) copyMessage[i] = 0; - wxStaticText *mess = new wxStaticText(parent, -1, currentMessage); - -/* - wxLayoutConstraints *c = new wxLayoutConstraints; - c->left.SameAs (parent, wxLeft, 10); - c->top.SameAs (lastWindow, wxBottom, 5); - c->right.AsIs (); - c->height.AsIs (); - - mess->SetConstraints(c); -*/ - sizer->AddSizerChild(mess); - - messageList->Append(mess); - - currentMessage = copyMessage + i + 1; - } - delete[] copyMessage; -} - wxTextEntryDialog::wxTextEntryDialog(wxWindow *parent, const wxString& message, const wxString& caption, const wxString& value, long style, const wxPoint& pos): wxDialog(parent, -1, caption, pos, wxDefaultSize, wxDEFAULT_DIALOG_STYLE|wxDIALOG_MODAL|wxTAB_TRAVERSAL) { - m_dialogStyle = style; - m_value = value; - - wxBeginBusyCursor(); - - wxSizer *topSizer = new wxSizer(this, wxSizerShrink); - topSizer->SetBorder(10, 10); - - wxRowColSizer *messageSizer = new wxRowColSizer(topSizer, wxSIZER_COLS, 100); - messageSizer->SetName("messageSizer"); - -// bool centre = ((style & wxCENTRE) == wxCENTRE); - - wxList messageList; - wxSplitMessage2(message, &messageList, this, messageSizer); - - // Insert a spacer - wxSpacingSizer *spacingSizer = new wxSpacingSizer(topSizer, wxBelow, messageSizer, 10); - - wxTextCtrl *textCtrl = new wxTextCtrl(this, wxID_TEXT, value, wxPoint(-1, -1), wxSize(350, -1)); - - wxRowColSizer *textSizer = new wxRowColSizer(topSizer, wxSIZER_ROWS); - textSizer->AddSizerChild(textCtrl); - textSizer->SetName("textSizer"); - - // Create constraints for the text sizer - wxLayoutConstraints *textC = new wxLayoutConstraints; - textC->left.SameAs (messageSizer, wxLeft); - textC->top.Below (spacingSizer); - textSizer->SetConstraints(textC); - - // Insert another spacer - wxSpacingSizer *spacingSizer2 = new wxSpacingSizer(topSizer, wxBelow, textSizer, 10); - spacingSizer->SetName("spacingSizer2"); - - // Insert a sizer for the buttons - wxRowColSizer *buttonSizer = new wxRowColSizer(topSizer, wxSIZER_ROWS); - buttonSizer->SetName("buttonSizer"); - - // Specify constraints for the button sizer - wxLayoutConstraints *c = new wxLayoutConstraints; - c->width.AsIs (); - c->height.AsIs (); - c->top.Below (spacingSizer2); - c->centreX.SameAs (textSizer, wxCentreX); - buttonSizer->SetConstraints(c); - buttonSizer->SetSpacing(12,0); - - wxButton *ok = NULL; - wxButton *cancel = NULL; - - 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); - } + m_dialogStyle = style; + m_value = value; + + wxBeginBusyCursor(); + + wxSize message_size( wxSplitMessage2( message, this ) ); + + wxButton *ok = (wxButton *) NULL; + wxButton *cancel = (wxButton *) NULL; + wxList m_buttons; + + int y = message_size.y + 15; + + wxTextCtrl *textCtrl = new wxTextCtrl(this, wxID_TEXT, value, wxPoint(-1, y), wxSize(350, -1)); + + y += 65; + + if (style & wxOK) + { + ok = new wxButton( this, wxID_OK, _("OK"), wxPoint(-1,y), wxSize(80,-1) ); + m_buttons.Append( ok ); + } + + if (style & wxCANCEL) + { + cancel = new wxButton( this, wxID_CANCEL, _("Cancel"), wxPoint(-1,y), wxSize(80,-1) ); + m_buttons.Append( cancel ); + } + + if (ok) + { + ok->SetDefault(); + ok->SetFocus(); + } + + int w = wxMax( 350, m_buttons.GetCount() * 100 ); + w = wxMax( w, message_size.x ); + int space = w / (m_buttons.GetCount()*2); + + textCtrl->SetSize( 20, -1, w-10, -1 ); + + int m = 0; + wxNode *node = m_buttons.First(); + while (node) + { + wxWindow *win = (wxWindow*)node->Data(); + int x = (m*2+1)*space - 40 + 15; + win->Move( x, -1 ); + node = node->Next(); + m++; + } + +#if wxUSE_STATLINE + (void) new wxStaticLine( this, -1, wxPoint(0,y-20), wxSize(w+30, 5) ); +#endif + + SetSize( w+30, y+40 ); - if (ok) - ok->SetDefault(); + Centre( wxBOTH ); - Layout(); - Centre(wxBOTH); wxEndBusyCursor(); } diff --git a/src/gtk/accel.cpp b/src/gtk/accel.cpp index b15ece7379..3d161f1c31 100644 --- a/src/gtk/accel.cpp +++ b/src/gtk/accel.cpp @@ -2,7 +2,7 @@ // Name: accel.cpp // Purpose: // Author: Robert Roebling -// Id: $id$ +// Id: $id:$ // Copyright: (c) 1998 Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -13,14 +13,9 @@ #include "wx/accel.h" -#include +#if wxUSE_ACCEL -#ifdef __WXDEBUG__ -#ifdef NULL -#undef NULL -#endif -#define NULL ((void*)0L) -#endif +#include //----------------------------------------------------------------------------- // wxAcceleratorTable @@ -94,3 +89,4 @@ int wxAcceleratorTable::GetCommand( wxKeyEvent &event ) return -1; } +#endif diff --git a/src/gtk/app.cpp b/src/gtk/app.cpp index 7f95b4c3ac..1dd8ad95af 100644 --- a/src/gtk/app.cpp +++ b/src/gtk/app.cpp @@ -662,7 +662,7 @@ int wxEntry( int argc, char *argv[] ) { gtk_set_locale(); - if (!wxOKlibc()) wxConv_current = &wxConv_local; + if (!wxOKlibc()) wxConvCurrent = &wxConvLocal; gtk_init( &argc, &argv ); diff --git a/src/gtk/bitmap.cpp b/src/gtk/bitmap.cpp index 5af0c4c336..832600e1a2 100644 --- a/src/gtk/bitmap.cpp +++ b/src/gtk/bitmap.cpp @@ -59,7 +59,7 @@ bool wxMask::Create( const wxBitmap& bitmap, const wxColour& colour ) m_bitmap = (GdkBitmap*) NULL; } - wxFAIL_MSG( "TODO" ); + wxFAIL_MSG( _T("TODO") ); return FALSE; } @@ -72,7 +72,7 @@ bool wxMask::Create( const wxBitmap& WXUNUSED(bitmap), int WXUNUSED(paletteIndex m_bitmap = (GdkBitmap*) NULL; } - wxFAIL_MSG( "not implemented" ); + wxFAIL_MSG( _T("not implemented") ); return FALSE; } @@ -87,7 +87,7 @@ bool wxMask::Create( const wxBitmap& bitmap ) if (!bitmap.Ok()) return FALSE; - wxCHECK_MSG( bitmap.GetBitmap(), FALSE, "Cannot create mask from colour bitmap" ); + wxCHECK_MSG( bitmap.GetBitmap(), FALSE, _T("Cannot create mask from colour bitmap") ); m_bitmap = gdk_pixmap_new( (GdkWindow*) &gdk_root_parent, bitmap.GetWidth(), bitmap.GetHeight(), 1 ); diff --git a/src/gtk/bmpbuttn.cpp b/src/gtk/bmpbuttn.cpp index 7ede0d75a7..71e20e97f2 100644 --- a/src/gtk/bmpbuttn.cpp +++ b/src/gtk/bmpbuttn.cpp @@ -13,6 +13,8 @@ #include "wx/bmpbuttn.h" +#if wxUSE_BMPBUTTON + #include "gdk/gdk.h" #include "gtk/gtk.h" @@ -309,3 +311,5 @@ void wxBitmapButton::EndSelect() m_isSelected = FALSE; SetBitmap(); } + +#endif \ No newline at end of file diff --git a/src/gtk/checkbox.cpp b/src/gtk/checkbox.cpp index 09cdd98387..f7d4fa4840 100644 --- a/src/gtk/checkbox.cpp +++ b/src/gtk/checkbox.cpp @@ -14,6 +14,8 @@ #include "wx/checkbox.h" +#if wxUSE_CHECKBOX + #include "gdk/gdk.h" #include "gtk/gtk.h" @@ -184,3 +186,4 @@ void wxCheckBox::ApplyWidgetStyle() gtk_widget_set_style( m_widgetLabel, m_widgetStyle ); } +#endif diff --git a/src/gtk/checklst.cpp b/src/gtk/checklst.cpp index 046020c6e0..6c08581ae6 100644 --- a/src/gtk/checklst.cpp +++ b/src/gtk/checklst.cpp @@ -13,6 +13,8 @@ #include "wx/checklst.h" +#if wxUSE_CHECKLISTBOX + #include "gdk/gdk.h" #include "gtk/gtk.h" @@ -69,7 +71,7 @@ void wxCheckListBox::Check( int index, bool check ) GtkBin *bin = GTK_BIN( child->data ); GtkLabel *label = GTK_LABEL( bin->child ); - wxString str = wxString(label->label,*wxConv_current); + wxString str = wxString(label->label,*wxConvCurrent); if (check == (str[1] == _T('X'))) return; @@ -91,3 +93,5 @@ int wxCheckListBox::GetItemHeight() const // FIXME return 22; } + +#endif diff --git a/src/gtk/choice.cpp b/src/gtk/choice.cpp index 742c29ecb7..9b9be9c0b0 100644 --- a/src/gtk/choice.cpp +++ b/src/gtk/choice.cpp @@ -251,7 +251,7 @@ int wxChoice::FindString( const wxString &string ) const wxASSERT_MSG( label != NULL , _T("wxChoice: invalid label") ); - if (string == wxString(label->label,*wxConv_current)) + if (string == wxString(label->label,*wxConvCurrent)) return count; child = child->next; @@ -304,7 +304,7 @@ wxString wxChoice::GetString( int n ) const wxASSERT_MSG( label != NULL , _T("wxChoice: invalid label") ); - return wxString(label->label,*wxConv_current); + return wxString(label->label,*wxConvCurrent); } child = child->next; count++; @@ -323,7 +323,7 @@ wxString wxChoice::GetStringSelection() const wxASSERT_MSG( label != NULL , _T("wxChoice: invalid label") ); - return wxString(label->label,*wxConv_current); + return wxString(label->label,*wxConvCurrent); } int wxChoice::Number() const diff --git a/src/gtk/combobox.cpp b/src/gtk/combobox.cpp index bec8f16668..3a8ee3af6a 100644 --- a/src/gtk/combobox.cpp +++ b/src/gtk/combobox.cpp @@ -12,6 +12,9 @@ #endif #include "wx/combobox.h" + +#if wxUSE_COMBOBOX + #include "wx/settings.h" #include @@ -625,3 +628,4 @@ bool wxComboBox::IsOwnGtkWindow( GdkWindow *window ) (window == GTK_COMBO(m_widget)->button->window ) ); } +#endif diff --git a/src/gtk/filedlg.cpp b/src/gtk/filedlg.cpp index 528bba04b3..7513762b20 100644 --- a/src/gtk/filedlg.cpp +++ b/src/gtk/filedlg.cpp @@ -145,13 +145,13 @@ wxFileDialog::wxFileDialog( wxWindow *parent, const wxString& message, GTK_SIGNAL_FUNC(gtk_filedialog_ok_callback), (gpointer*)this ); // strange way to internationalize - gtk_label_set( GTK_LABEL( GTK_BUTTON(sel->ok_button)->child ), wxConv_current->cWX2MB(_("OK")) ); + gtk_label_set( GTK_LABEL( GTK_BUTTON(sel->ok_button)->child ), wxConvCurrent->cWX2MB(_("OK")) ); gtk_signal_connect( GTK_OBJECT(sel->cancel_button), "clicked", GTK_SIGNAL_FUNC(gtk_filedialog_cancel_callback), (gpointer*)this ); // strange way to internationalize - gtk_label_set( GTK_LABEL( GTK_BUTTON(sel->cancel_button)->child ), wxConv_current->cWX2MB(_("Cancel")) ); + gtk_label_set( GTK_LABEL( GTK_BUTTON(sel->cancel_button)->child ), wxConvCurrent->cWX2MB(_("Cancel")) ); gtk_signal_connect( GTK_OBJECT(m_widget), "delete_event", GTK_SIGNAL_FUNC(gtk_filedialog_delete_callback), (gpointer)this ); diff --git a/src/gtk/font.cpp b/src/gtk/font.cpp index 842c716587..ceb1255ac4 100644 --- a/src/gtk/font.cpp +++ b/src/gtk/font.cpp @@ -401,7 +401,7 @@ static GdkFont*wxLoadQueryFont( int pointSize, int family, int style, int weight if (!facename.IsEmpty()) { wxSprintf( wxBuffer, _T("-*-%s-*-*-normal-*-*-*-*-*-*-*-*-*"), facename.c_str() ); - GdkFont *test = gdk_font_load( wxConv_libc.cWX2MB(wxBuffer) ); + GdkFont *test = gdk_font_load( wxConvCurrent->cWX2MB(wxBuffer) ); if (test) { gdk_font_unref( test ); @@ -427,7 +427,7 @@ static GdkFont*wxLoadQueryFont( int pointSize, int family, int style, int weight wxSprintf( wxBuffer, _T("-*-%s-%s-%s-normal-*-*-%d-*-*-*-*-*-*"), xfamily, xweight, xstyle, pointSize); - return gdk_font_load( wxConv_libc.cWX2MB(wxBuffer) ); + return gdk_font_load( wxConvCurrent->cWX2MB(wxBuffer) ); } static GdkFont *wxLoadQueryNearestFont( int point_size, int family, int style, int weight, diff --git a/src/gtk/frame.cpp b/src/gtk/frame.cpp index c33bf7f0cf..0963513426 100644 --- a/src/gtk/frame.cpp +++ b/src/gtk/frame.cpp @@ -16,8 +16,12 @@ #include "wx/control.h" #include "wx/app.h" #include "wx/menu.h" +#if wxUSE_TOOLBAR #include "wx/toolbar.h" +#endif +#if wxUSE_STATUSBAR #include "wx/statusbr.h" +#endif #include "wx/dcclient.h" #include "glib.h" @@ -560,9 +564,12 @@ void wxFrame::DoGetClientSize( int *width, int *height ) const (*height) -= wxPLACE_HOLDER; } +#if wxUSE_STATUSBAR /* status bar */ if (m_frameStatusBar) (*height) -= wxSTATUS_HEIGHT; +#endif +#if wxUSE_TOOLBAR /* tool bar */ if (m_frameToolBar) { @@ -575,6 +582,7 @@ void wxFrame::DoGetClientSize( int *width, int *height ) const else (*height) -= wxPLACE_HOLDER; } +#endif /* mini edge */ (*height) -= m_miniEdge*2 + m_miniTitle; @@ -598,9 +606,12 @@ void wxFrame::DoSetClientSize( int width, int height ) height += wxPLACE_HOLDER; } +#if wxUSE_STATUSBAR /* status bar */ if (m_frameStatusBar) height += wxSTATUS_HEIGHT; +#endif +#if wxUSE_TOOLBAR /* tool bar */ if (m_frameToolBar) { @@ -613,6 +624,7 @@ void wxFrame::DoSetClientSize( int width, int height ) else height += wxPLACE_HOLDER; } +#endif wxWindow::DoSetClientSize( width + m_miniEdge*2, height + m_miniEdge*2 + m_miniTitle ); } @@ -674,6 +686,7 @@ void wxFrame::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), int width, int height client_area_y_offset += hh; } +#if wxUSE_TOOLBAR if (m_frameToolBar) { int xx = m_miniEdge; @@ -697,6 +710,7 @@ void wxFrame::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), int width, int height xx, yy, ww, hh ); client_area_y_offset += hh; } +#endif int client_x = m_miniEdge; int client_y = client_area_y_offset + m_miniEdge + m_miniTitle; @@ -712,6 +726,7 @@ void wxFrame::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), int width, int height is no need to set the size or position of m_wxwindow. */ } +#if wxUSE_STATUSBAR if (m_frameStatusBar) { int xx = 0 + m_miniEdge; @@ -726,6 +741,7 @@ void wxFrame::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), int width, int height m_frameStatusBar->m_widget, xx, yy, ww, hh ); } +#endif /* we actually set the size of a frame here and no-where else */ gtk_widget_set_usize( m_widget, m_width, m_height ); @@ -764,8 +780,12 @@ void wxFrame::OnInternalIdle() DoMenuUpdates(); if (m_frameMenuBar) m_frameMenuBar->OnInternalIdle(); +#if wxUSE_TOOLBAR if (m_frameToolBar) m_frameToolBar->OnInternalIdle(); +#endif +#if wxUSE_STATUSBAR if (m_frameStatusBar) m_frameStatusBar->OnInternalIdle(); +#endif } void wxFrame::OnCloseWindow( wxCloseEvent& WXUNUSED(event) ) diff --git a/src/gtk/gauge.cpp b/src/gtk/gauge.cpp index ff974edef9..3c64b9d500 100644 --- a/src/gtk/gauge.cpp +++ b/src/gtk/gauge.cpp @@ -12,6 +12,9 @@ #endif #include "wx/gauge.h" + +#if wxUSE_GAUGE + #include "gdk/gdk.h" #include "gtk/gtk.h" @@ -78,3 +81,4 @@ void wxGauge::ApplyWidgetStyle() gtk_widget_set_style( m_widget, m_widgetStyle ); } +#endif diff --git a/src/gtk/listbox.cpp b/src/gtk/listbox.cpp index 5fa2491aee..8639e859fb 100644 --- a/src/gtk/listbox.cpp +++ b/src/gtk/listbox.cpp @@ -12,8 +12,11 @@ #pragma implementation "listbox.h" #endif -#include "wx/dynarray.h" #include "wx/listbox.h" + +#if wxUSE_LISTBOX + +#include "wx/dynarray.h" #include "wx/utils.h" #include "wx/intl.h" #include "wx/checklst.h" @@ -159,6 +162,7 @@ gtk_listbox_button_press_callback( GtkWidget *widget, GdkEventButton *gdk_event, // "key_press_event" //----------------------------------------------------------------------------- +#if wxUSE_CHECKLISTBOX static gint gtk_listbox_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_event, wxListBox *listbox ) { @@ -170,7 +174,6 @@ gtk_listbox_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_event, wxLis if (gdk_event->keyval != ' ') return FALSE; -#if wxUSE_CHECKLISTBOX int sel = listbox->GetIndex( widget ); wxCheckListBox *clb = (wxCheckListBox *)listbox; @@ -181,10 +184,10 @@ gtk_listbox_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_event, wxLis event.SetEventObject( listbox ); event.SetInt( sel ); listbox->GetEventHandler()->ProcessEvent( event ); -#endif // wxUSE_CHECKLISTBOX return FALSE; } +#endif // wxUSE_CHECKLISTBOX //----------------------------------------------------------------------------- // "select" and "deselect" @@ -854,7 +857,7 @@ void wxListBox::ApplyToolTip( GtkTooltips *tips, const wxChar *tip ) GList *child = m_list->children; while (child) { - gtk_tooltips_set_tip( tips, GTK_WIDGET( child->data ), wxConv_local.cWX2MB(tip), (gchar*) NULL ); + gtk_tooltips_set_tip( tips, GTK_WIDGET( child->data ), wxConvLocal.cWX2MB(tip), (gchar*) NULL ); child = child->next; } } @@ -940,3 +943,5 @@ void wxListBox::ApplyWidgetStyle() child = child->next; } } + +#endif \ No newline at end of file diff --git a/src/gtk/mdi.cpp b/src/gtk/mdi.cpp index e9acbdf01a..13c558712a 100644 --- a/src/gtk/mdi.cpp +++ b/src/gtk/mdi.cpp @@ -12,6 +12,9 @@ #endif #include "wx/mdi.h" + +#if wxUSE_MDI_ARCHITECTURE + #include "wx/dialog.h" #include "wx/menu.h" #include @@ -421,3 +424,4 @@ bool wxMDIClientWindow::CreateClient( wxMDIParentFrame *parent, long style ) return TRUE; } +#endif diff --git a/src/gtk/minifram.cpp b/src/gtk/minifram.cpp index a749f18a83..ee93f8546c 100644 --- a/src/gtk/minifram.cpp +++ b/src/gtk/minifram.cpp @@ -12,6 +12,9 @@ #endif #include "wx/minifram.h" + +#if wxUSE_MINIFRAME + #include "wx/dcscreen.h" #include "gtk/gtk.h" @@ -318,3 +321,5 @@ bool wxMiniFrame::Create( wxWindow *parent, wxWindowID id, const wxString &title return TRUE; } + +#endif diff --git a/src/gtk/notebook.cpp b/src/gtk/notebook.cpp index 6523a5a5cb..3bb33c9e2e 100644 --- a/src/gtk/notebook.cpp +++ b/src/gtk/notebook.cpp @@ -12,6 +12,9 @@ #endif #include "wx/notebook.h" + +#if wxUSE_NOTEBOOK + #include "wx/panel.h" #include "wx/utils.h" #include "wx/imaglist.h" @@ -623,3 +626,4 @@ bool wxNotebook::IsOwnGtkWindow( GdkWindow *window ) IMPLEMENT_DYNAMIC_CLASS(wxNotebookEvent, wxNotifyEvent) +#endif \ No newline at end of file diff --git a/src/gtk/radiobox.cpp b/src/gtk/radiobox.cpp index 432496cd91..e677deb968 100644 --- a/src/gtk/radiobox.cpp +++ b/src/gtk/radiobox.cpp @@ -12,6 +12,9 @@ #endif #include "wx/radiobox.h" + +#if wxUSE_RADIOBOX + #include "wx/dialog.h" #include "wx/frame.h" @@ -180,7 +183,7 @@ wxSize wxRadioBox::LayoutItems() if (len > max_len) max_len = len; gtk_myfixed_move( GTK_MYFIXED(m_parent->m_wxwindow), button, m_x+x, m_y+y ); - y += 20; + y += 22; node = node->Next(); if (!node) break; @@ -516,3 +519,5 @@ bool wxRadioBox::IsOwnGtkWindow( GdkWindow *window ) return FALSE; } + +#endif diff --git a/src/gtk/radiobut.cpp b/src/gtk/radiobut.cpp index 8ccd9ef3c0..5957092695 100644 --- a/src/gtk/radiobut.cpp +++ b/src/gtk/radiobut.cpp @@ -13,6 +13,9 @@ #endif #include "wx/radiobut.h" + +#if wxUSE_RADIOBOX + #include "gdk/gdk.h" #include "gtk/gtk.h" @@ -152,3 +155,5 @@ void wxRadioButton::ApplyWidgetStyle() gtk_widget_set_style( m_widget, m_widgetStyle ); gtk_widget_set_style( GTK_BUTTON(m_widget)->child, m_widgetStyle ); } + +#endif diff --git a/src/gtk/scrolbar.cpp b/src/gtk/scrolbar.cpp index 84a46924ef..038d908e20 100644 --- a/src/gtk/scrolbar.cpp +++ b/src/gtk/scrolbar.cpp @@ -13,6 +13,9 @@ #endif #include "wx/scrolbar.h" + +#if wxUSE_SCROLLBAR + #include "wx/utils.h" #include @@ -307,3 +310,4 @@ void wxScrollBar::ApplyWidgetStyle() gtk_widget_set_style( m_widget, m_widgetStyle ); } +#endif diff --git a/src/gtk/slider.cpp b/src/gtk/slider.cpp index c28fc43e1b..504b1cfb5a 100644 --- a/src/gtk/slider.cpp +++ b/src/gtk/slider.cpp @@ -12,6 +12,9 @@ #endif #include "wx/slider.h" + +#if wxUSE_SLIDER + #include "wx/utils.h" #include @@ -289,3 +292,5 @@ void wxSlider::ApplyWidgetStyle() SetWidgetStyle(); gtk_widget_set_style( m_widget, m_widgetStyle ); } + +#endif diff --git a/src/gtk/spinbutt.cpp b/src/gtk/spinbutt.cpp index 7b3b204283..66f5af6bc3 100644 --- a/src/gtk/spinbutt.cpp +++ b/src/gtk/spinbutt.cpp @@ -13,6 +13,9 @@ #endif #include "wx/spinbutt.h" + +#ifdef wxUSE_SPINBTN + #include "wx/utils.h" #include @@ -208,3 +211,5 @@ wxSpinEvent::wxSpinEvent(wxEventType commandType, int id): wxScrollEvent(commandType, id) { } + +#endif \ No newline at end of file diff --git a/src/gtk/statbmp.cpp b/src/gtk/statbmp.cpp index ff7fc98b4f..30431837bf 100644 --- a/src/gtk/statbmp.cpp +++ b/src/gtk/statbmp.cpp @@ -13,6 +13,8 @@ #include "wx/statbmp.h" +#if wxUSE_STATBMP + #include "gdk/gdk.h" #include "gtk/gtk.h" @@ -80,3 +82,5 @@ void wxStaticBitmap::SetBitmap( const wxBitmap &bitmap ) gtk_pixmap_set( GTK_PIXMAP(m_widget), m_bitmap.GetPixmap(), mask ); } } + +#endif diff --git a/src/gtk/statbox.cpp b/src/gtk/statbox.cpp index d1c978b2ef..84fd9673ff 100644 --- a/src/gtk/statbox.cpp +++ b/src/gtk/statbox.cpp @@ -13,6 +13,8 @@ #include "wx/statbox.h" +#if wxUSE_STATBOX + #include "gdk/gdk.h" #include "gtk/gtk.h" @@ -72,3 +74,5 @@ void wxStaticBox::ApplyWidgetStyle() SetWidgetStyle(); gtk_widget_set_style( m_widget, m_widgetStyle ); } + +#endif diff --git a/src/gtk/statline.cpp b/src/gtk/statline.cpp index 572edb0b1d..eb9374713c 100644 --- a/src/gtk/statline.cpp +++ b/src/gtk/statline.cpp @@ -13,6 +13,8 @@ #include "wx/statline.h" +#if wxUSE_STATLINE + #include "gdk/gdk.h" #include "gtk/gtk.h" @@ -55,3 +57,4 @@ bool wxStaticLine::Create( wxWindow *parent, wxWindowID id, return TRUE; } +#endif \ No newline at end of file diff --git a/src/gtk/tbargtk.cpp b/src/gtk/tbargtk.cpp index de244c82b1..651c6ba081 100644 --- a/src/gtk/tbargtk.cpp +++ b/src/gtk/tbargtk.cpp @@ -12,6 +12,9 @@ #endif #include "wx/toolbar.h" + +#if wxUSE_TOOLBAR + #include "wx/frame.h" #include "glib.h" @@ -584,3 +587,4 @@ void wxToolBar::OnIdle( wxIdleEvent &WXUNUSED(ievent) ) } } +#endif diff --git a/src/gtk/textctrl.cpp b/src/gtk/textctrl.cpp index 51169aaa60..fb10ca0a24 100644 --- a/src/gtk/textctrl.cpp +++ b/src/gtk/textctrl.cpp @@ -301,12 +301,12 @@ wxString wxTextCtrl::GetValue() const { gint len = gtk_text_get_length( GTK_TEXT(m_text) ); char *text = gtk_editable_get_chars( GTK_EDITABLE(m_text), 0, len ); - tmp = wxString(text,*wxConv_current); + tmp = wxString(text,*wxConvCurrent); g_free( text ); } else { - tmp = wxString(gtk_entry_get_text( GTK_ENTRY(m_text) ),*wxConv_current); + tmp = wxString(gtk_entry_get_text( GTK_ENTRY(m_text) ),*wxConvCurrent); } return tmp; } diff --git a/src/gtk/tooltip.cpp b/src/gtk/tooltip.cpp index 2e400fe04d..403880e328 100644 --- a/src/gtk/tooltip.cpp +++ b/src/gtk/tooltip.cpp @@ -103,5 +103,6 @@ void wxToolTip::SetDelay( long msecs ) gtk_tooltips_set_delay( ss_tooltips, msecs ); } + #endif diff --git a/src/gtk/utilsres.cpp b/src/gtk/utilsres.cpp index 4dc2843925..783d2087a2 100644 --- a/src/gtk/utilsres.cpp +++ b/src/gtk/utilsres.cpp @@ -74,7 +74,7 @@ static wxChar *GetResourcePath(wxChar *buf, wxChar *name, bool create) if (create) { // Touch the file to create it - FILE *fd = fopen(wxConv_file.cWX2MB(buf), "w"); + FILE *fd = fopen(wxConvCurrent->cWX2MB(buf), "w"); if (fd) fclose(fd); } return buf; @@ -139,7 +139,7 @@ static void wxXMergeDatabases() else { (void)GetIniFile(filename, (wxChar *) NULL); - serverDB = XrmGetFileDatabase(wxConv_file.cWX2MB(filename)); + serverDB = XrmGetFileDatabase(wxConvCurrent->cWX2MB(filename)); } if (serverDB) XrmMergeDatabases(serverDB, &wxResourceDatabase); @@ -169,10 +169,10 @@ static void wxXMergeDatabases() #endif #endif #if wxUSE_UNICODE - wxStrcat(environment, wxConv_libc.cMB2WX(hostbuf)); + wxStrcat(environment, wxConvCurrent->cMB2WX(hostbuf)); #endif } - if ((homeDB = XrmGetFileDatabase(wxConv_file.cWX2MB(environment)))) + if ((homeDB = XrmGetFileDatabase(wxConvCurrent->cWX2MB(environment)))) XrmMergeDatabases(homeDB, &wxResourceDatabase); } @@ -192,7 +192,7 @@ void wxFlushResources() (void)GetResourcePath(nameBuffer, file, TRUE); XrmDatabase database = (XrmDatabase)node->Data(); - XrmPutFileDatabase(database, wxConv_file.cWX2MB(nameBuffer)); + XrmPutFileDatabase(database, wxConvCurrent->cWX2MB(nameBuffer)); XrmDestroyDatabase(database); wxNode *next = node->Next(); // delete node; @@ -231,7 +231,7 @@ bool wxWriteResource(const wxString& section, const wxString& entry, const wxStr if (node) database = (XrmDatabase)node->Data(); else { - database = XrmGetFileDatabase(wxConv_file.cWX2MB(buffer)); + database = XrmGetFileDatabase(wxConvCurrent->cWX2MB(buffer)); wxLogTrace(wxTraceResAlloc, _T("Write: Number = %d"), wxTheResourceCache->Number()); wxTheResourceCache->Append(buffer, (wxObject *)database); } @@ -285,7 +285,7 @@ bool wxGetResource(const wxString& section, const wxString& entry, char **value, } else { - database = XrmGetFileDatabase(wxConv_file.cWX2MB(buffer)); + database = XrmGetFileDatabase(wxConvCurrent->cWX2MB(buffer)); wxLogTrace(wxTraceResAlloc, _T("Get: Number = %d"), wxTheResourceCache->Number()); wxTheResourceCache->Append(buffer, (wxObject *)database); } diff --git a/src/gtk/window.cpp b/src/gtk/window.cpp index cc3d1edb16..6ac1773a14 100644 --- a/src/gtk/window.cpp +++ b/src/gtk/window.cpp @@ -2545,7 +2545,7 @@ void wxWindow::DoSetToolTip( wxToolTip *tip ) void wxWindow::ApplyToolTip( GtkTooltips *tips, const wxChar *tip ) { - gtk_tooltips_set_tip( tips, GetConnectWidget(), wxConv_current->cWX2MB(tip), (gchar*) NULL ); + gtk_tooltips_set_tip( tips, GetConnectWidget(), wxConvCurrent->cWX2MB(tip), (gchar*) NULL ); } #endif // wxUSE_TOOLTIPS diff --git a/src/gtk1/accel.cpp b/src/gtk1/accel.cpp index b15ece7379..3d161f1c31 100644 --- a/src/gtk1/accel.cpp +++ b/src/gtk1/accel.cpp @@ -2,7 +2,7 @@ // Name: accel.cpp // Purpose: // Author: Robert Roebling -// Id: $id$ +// Id: $id:$ // Copyright: (c) 1998 Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -13,14 +13,9 @@ #include "wx/accel.h" -#include +#if wxUSE_ACCEL -#ifdef __WXDEBUG__ -#ifdef NULL -#undef NULL -#endif -#define NULL ((void*)0L) -#endif +#include //----------------------------------------------------------------------------- // wxAcceleratorTable @@ -94,3 +89,4 @@ int wxAcceleratorTable::GetCommand( wxKeyEvent &event ) return -1; } +#endif diff --git a/src/gtk1/app.cpp b/src/gtk1/app.cpp index 7f95b4c3ac..1dd8ad95af 100644 --- a/src/gtk1/app.cpp +++ b/src/gtk1/app.cpp @@ -662,7 +662,7 @@ int wxEntry( int argc, char *argv[] ) { gtk_set_locale(); - if (!wxOKlibc()) wxConv_current = &wxConv_local; + if (!wxOKlibc()) wxConvCurrent = &wxConvLocal; gtk_init( &argc, &argv ); diff --git a/src/gtk1/bitmap.cpp b/src/gtk1/bitmap.cpp index 5af0c4c336..832600e1a2 100644 --- a/src/gtk1/bitmap.cpp +++ b/src/gtk1/bitmap.cpp @@ -59,7 +59,7 @@ bool wxMask::Create( const wxBitmap& bitmap, const wxColour& colour ) m_bitmap = (GdkBitmap*) NULL; } - wxFAIL_MSG( "TODO" ); + wxFAIL_MSG( _T("TODO") ); return FALSE; } @@ -72,7 +72,7 @@ bool wxMask::Create( const wxBitmap& WXUNUSED(bitmap), int WXUNUSED(paletteIndex m_bitmap = (GdkBitmap*) NULL; } - wxFAIL_MSG( "not implemented" ); + wxFAIL_MSG( _T("not implemented") ); return FALSE; } @@ -87,7 +87,7 @@ bool wxMask::Create( const wxBitmap& bitmap ) if (!bitmap.Ok()) return FALSE; - wxCHECK_MSG( bitmap.GetBitmap(), FALSE, "Cannot create mask from colour bitmap" ); + wxCHECK_MSG( bitmap.GetBitmap(), FALSE, _T("Cannot create mask from colour bitmap") ); m_bitmap = gdk_pixmap_new( (GdkWindow*) &gdk_root_parent, bitmap.GetWidth(), bitmap.GetHeight(), 1 ); diff --git a/src/gtk1/bmpbuttn.cpp b/src/gtk1/bmpbuttn.cpp index 7ede0d75a7..71e20e97f2 100644 --- a/src/gtk1/bmpbuttn.cpp +++ b/src/gtk1/bmpbuttn.cpp @@ -13,6 +13,8 @@ #include "wx/bmpbuttn.h" +#if wxUSE_BMPBUTTON + #include "gdk/gdk.h" #include "gtk/gtk.h" @@ -309,3 +311,5 @@ void wxBitmapButton::EndSelect() m_isSelected = FALSE; SetBitmap(); } + +#endif \ No newline at end of file diff --git a/src/gtk1/checkbox.cpp b/src/gtk1/checkbox.cpp index 09cdd98387..f7d4fa4840 100644 --- a/src/gtk1/checkbox.cpp +++ b/src/gtk1/checkbox.cpp @@ -14,6 +14,8 @@ #include "wx/checkbox.h" +#if wxUSE_CHECKBOX + #include "gdk/gdk.h" #include "gtk/gtk.h" @@ -184,3 +186,4 @@ void wxCheckBox::ApplyWidgetStyle() gtk_widget_set_style( m_widgetLabel, m_widgetStyle ); } +#endif diff --git a/src/gtk1/checklst.cpp b/src/gtk1/checklst.cpp index 046020c6e0..6c08581ae6 100644 --- a/src/gtk1/checklst.cpp +++ b/src/gtk1/checklst.cpp @@ -13,6 +13,8 @@ #include "wx/checklst.h" +#if wxUSE_CHECKLISTBOX + #include "gdk/gdk.h" #include "gtk/gtk.h" @@ -69,7 +71,7 @@ void wxCheckListBox::Check( int index, bool check ) GtkBin *bin = GTK_BIN( child->data ); GtkLabel *label = GTK_LABEL( bin->child ); - wxString str = wxString(label->label,*wxConv_current); + wxString str = wxString(label->label,*wxConvCurrent); if (check == (str[1] == _T('X'))) return; @@ -91,3 +93,5 @@ int wxCheckListBox::GetItemHeight() const // FIXME return 22; } + +#endif diff --git a/src/gtk1/choice.cpp b/src/gtk1/choice.cpp index 742c29ecb7..9b9be9c0b0 100644 --- a/src/gtk1/choice.cpp +++ b/src/gtk1/choice.cpp @@ -251,7 +251,7 @@ int wxChoice::FindString( const wxString &string ) const wxASSERT_MSG( label != NULL , _T("wxChoice: invalid label") ); - if (string == wxString(label->label,*wxConv_current)) + if (string == wxString(label->label,*wxConvCurrent)) return count; child = child->next; @@ -304,7 +304,7 @@ wxString wxChoice::GetString( int n ) const wxASSERT_MSG( label != NULL , _T("wxChoice: invalid label") ); - return wxString(label->label,*wxConv_current); + return wxString(label->label,*wxConvCurrent); } child = child->next; count++; @@ -323,7 +323,7 @@ wxString wxChoice::GetStringSelection() const wxASSERT_MSG( label != NULL , _T("wxChoice: invalid label") ); - return wxString(label->label,*wxConv_current); + return wxString(label->label,*wxConvCurrent); } int wxChoice::Number() const diff --git a/src/gtk1/combobox.cpp b/src/gtk1/combobox.cpp index bec8f16668..3a8ee3af6a 100644 --- a/src/gtk1/combobox.cpp +++ b/src/gtk1/combobox.cpp @@ -12,6 +12,9 @@ #endif #include "wx/combobox.h" + +#if wxUSE_COMBOBOX + #include "wx/settings.h" #include @@ -625,3 +628,4 @@ bool wxComboBox::IsOwnGtkWindow( GdkWindow *window ) (window == GTK_COMBO(m_widget)->button->window ) ); } +#endif diff --git a/src/gtk1/filedlg.cpp b/src/gtk1/filedlg.cpp index 528bba04b3..7513762b20 100644 --- a/src/gtk1/filedlg.cpp +++ b/src/gtk1/filedlg.cpp @@ -145,13 +145,13 @@ wxFileDialog::wxFileDialog( wxWindow *parent, const wxString& message, GTK_SIGNAL_FUNC(gtk_filedialog_ok_callback), (gpointer*)this ); // strange way to internationalize - gtk_label_set( GTK_LABEL( GTK_BUTTON(sel->ok_button)->child ), wxConv_current->cWX2MB(_("OK")) ); + gtk_label_set( GTK_LABEL( GTK_BUTTON(sel->ok_button)->child ), wxConvCurrent->cWX2MB(_("OK")) ); gtk_signal_connect( GTK_OBJECT(sel->cancel_button), "clicked", GTK_SIGNAL_FUNC(gtk_filedialog_cancel_callback), (gpointer*)this ); // strange way to internationalize - gtk_label_set( GTK_LABEL( GTK_BUTTON(sel->cancel_button)->child ), wxConv_current->cWX2MB(_("Cancel")) ); + gtk_label_set( GTK_LABEL( GTK_BUTTON(sel->cancel_button)->child ), wxConvCurrent->cWX2MB(_("Cancel")) ); gtk_signal_connect( GTK_OBJECT(m_widget), "delete_event", GTK_SIGNAL_FUNC(gtk_filedialog_delete_callback), (gpointer)this ); diff --git a/src/gtk1/font.cpp b/src/gtk1/font.cpp index 842c716587..ceb1255ac4 100644 --- a/src/gtk1/font.cpp +++ b/src/gtk1/font.cpp @@ -401,7 +401,7 @@ static GdkFont*wxLoadQueryFont( int pointSize, int family, int style, int weight if (!facename.IsEmpty()) { wxSprintf( wxBuffer, _T("-*-%s-*-*-normal-*-*-*-*-*-*-*-*-*"), facename.c_str() ); - GdkFont *test = gdk_font_load( wxConv_libc.cWX2MB(wxBuffer) ); + GdkFont *test = gdk_font_load( wxConvCurrent->cWX2MB(wxBuffer) ); if (test) { gdk_font_unref( test ); @@ -427,7 +427,7 @@ static GdkFont*wxLoadQueryFont( int pointSize, int family, int style, int weight wxSprintf( wxBuffer, _T("-*-%s-%s-%s-normal-*-*-%d-*-*-*-*-*-*"), xfamily, xweight, xstyle, pointSize); - return gdk_font_load( wxConv_libc.cWX2MB(wxBuffer) ); + return gdk_font_load( wxConvCurrent->cWX2MB(wxBuffer) ); } static GdkFont *wxLoadQueryNearestFont( int point_size, int family, int style, int weight, diff --git a/src/gtk1/frame.cpp b/src/gtk1/frame.cpp index c33bf7f0cf..0963513426 100644 --- a/src/gtk1/frame.cpp +++ b/src/gtk1/frame.cpp @@ -16,8 +16,12 @@ #include "wx/control.h" #include "wx/app.h" #include "wx/menu.h" +#if wxUSE_TOOLBAR #include "wx/toolbar.h" +#endif +#if wxUSE_STATUSBAR #include "wx/statusbr.h" +#endif #include "wx/dcclient.h" #include "glib.h" @@ -560,9 +564,12 @@ void wxFrame::DoGetClientSize( int *width, int *height ) const (*height) -= wxPLACE_HOLDER; } +#if wxUSE_STATUSBAR /* status bar */ if (m_frameStatusBar) (*height) -= wxSTATUS_HEIGHT; +#endif +#if wxUSE_TOOLBAR /* tool bar */ if (m_frameToolBar) { @@ -575,6 +582,7 @@ void wxFrame::DoGetClientSize( int *width, int *height ) const else (*height) -= wxPLACE_HOLDER; } +#endif /* mini edge */ (*height) -= m_miniEdge*2 + m_miniTitle; @@ -598,9 +606,12 @@ void wxFrame::DoSetClientSize( int width, int height ) height += wxPLACE_HOLDER; } +#if wxUSE_STATUSBAR /* status bar */ if (m_frameStatusBar) height += wxSTATUS_HEIGHT; +#endif +#if wxUSE_TOOLBAR /* tool bar */ if (m_frameToolBar) { @@ -613,6 +624,7 @@ void wxFrame::DoSetClientSize( int width, int height ) else height += wxPLACE_HOLDER; } +#endif wxWindow::DoSetClientSize( width + m_miniEdge*2, height + m_miniEdge*2 + m_miniTitle ); } @@ -674,6 +686,7 @@ void wxFrame::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), int width, int height client_area_y_offset += hh; } +#if wxUSE_TOOLBAR if (m_frameToolBar) { int xx = m_miniEdge; @@ -697,6 +710,7 @@ void wxFrame::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), int width, int height xx, yy, ww, hh ); client_area_y_offset += hh; } +#endif int client_x = m_miniEdge; int client_y = client_area_y_offset + m_miniEdge + m_miniTitle; @@ -712,6 +726,7 @@ void wxFrame::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), int width, int height is no need to set the size or position of m_wxwindow. */ } +#if wxUSE_STATUSBAR if (m_frameStatusBar) { int xx = 0 + m_miniEdge; @@ -726,6 +741,7 @@ void wxFrame::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), int width, int height m_frameStatusBar->m_widget, xx, yy, ww, hh ); } +#endif /* we actually set the size of a frame here and no-where else */ gtk_widget_set_usize( m_widget, m_width, m_height ); @@ -764,8 +780,12 @@ void wxFrame::OnInternalIdle() DoMenuUpdates(); if (m_frameMenuBar) m_frameMenuBar->OnInternalIdle(); +#if wxUSE_TOOLBAR if (m_frameToolBar) m_frameToolBar->OnInternalIdle(); +#endif +#if wxUSE_STATUSBAR if (m_frameStatusBar) m_frameStatusBar->OnInternalIdle(); +#endif } void wxFrame::OnCloseWindow( wxCloseEvent& WXUNUSED(event) ) diff --git a/src/gtk1/gauge.cpp b/src/gtk1/gauge.cpp index ff974edef9..3c64b9d500 100644 --- a/src/gtk1/gauge.cpp +++ b/src/gtk1/gauge.cpp @@ -12,6 +12,9 @@ #endif #include "wx/gauge.h" + +#if wxUSE_GAUGE + #include "gdk/gdk.h" #include "gtk/gtk.h" @@ -78,3 +81,4 @@ void wxGauge::ApplyWidgetStyle() gtk_widget_set_style( m_widget, m_widgetStyle ); } +#endif diff --git a/src/gtk1/listbox.cpp b/src/gtk1/listbox.cpp index 5fa2491aee..8639e859fb 100644 --- a/src/gtk1/listbox.cpp +++ b/src/gtk1/listbox.cpp @@ -12,8 +12,11 @@ #pragma implementation "listbox.h" #endif -#include "wx/dynarray.h" #include "wx/listbox.h" + +#if wxUSE_LISTBOX + +#include "wx/dynarray.h" #include "wx/utils.h" #include "wx/intl.h" #include "wx/checklst.h" @@ -159,6 +162,7 @@ gtk_listbox_button_press_callback( GtkWidget *widget, GdkEventButton *gdk_event, // "key_press_event" //----------------------------------------------------------------------------- +#if wxUSE_CHECKLISTBOX static gint gtk_listbox_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_event, wxListBox *listbox ) { @@ -170,7 +174,6 @@ gtk_listbox_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_event, wxLis if (gdk_event->keyval != ' ') return FALSE; -#if wxUSE_CHECKLISTBOX int sel = listbox->GetIndex( widget ); wxCheckListBox *clb = (wxCheckListBox *)listbox; @@ -181,10 +184,10 @@ gtk_listbox_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_event, wxLis event.SetEventObject( listbox ); event.SetInt( sel ); listbox->GetEventHandler()->ProcessEvent( event ); -#endif // wxUSE_CHECKLISTBOX return FALSE; } +#endif // wxUSE_CHECKLISTBOX //----------------------------------------------------------------------------- // "select" and "deselect" @@ -854,7 +857,7 @@ void wxListBox::ApplyToolTip( GtkTooltips *tips, const wxChar *tip ) GList *child = m_list->children; while (child) { - gtk_tooltips_set_tip( tips, GTK_WIDGET( child->data ), wxConv_local.cWX2MB(tip), (gchar*) NULL ); + gtk_tooltips_set_tip( tips, GTK_WIDGET( child->data ), wxConvLocal.cWX2MB(tip), (gchar*) NULL ); child = child->next; } } @@ -940,3 +943,5 @@ void wxListBox::ApplyWidgetStyle() child = child->next; } } + +#endif \ No newline at end of file diff --git a/src/gtk1/mdi.cpp b/src/gtk1/mdi.cpp index e9acbdf01a..13c558712a 100644 --- a/src/gtk1/mdi.cpp +++ b/src/gtk1/mdi.cpp @@ -12,6 +12,9 @@ #endif #include "wx/mdi.h" + +#if wxUSE_MDI_ARCHITECTURE + #include "wx/dialog.h" #include "wx/menu.h" #include @@ -421,3 +424,4 @@ bool wxMDIClientWindow::CreateClient( wxMDIParentFrame *parent, long style ) return TRUE; } +#endif diff --git a/src/gtk1/minifram.cpp b/src/gtk1/minifram.cpp index a749f18a83..ee93f8546c 100644 --- a/src/gtk1/minifram.cpp +++ b/src/gtk1/minifram.cpp @@ -12,6 +12,9 @@ #endif #include "wx/minifram.h" + +#if wxUSE_MINIFRAME + #include "wx/dcscreen.h" #include "gtk/gtk.h" @@ -318,3 +321,5 @@ bool wxMiniFrame::Create( wxWindow *parent, wxWindowID id, const wxString &title return TRUE; } + +#endif diff --git a/src/gtk1/notebook.cpp b/src/gtk1/notebook.cpp index 6523a5a5cb..3bb33c9e2e 100644 --- a/src/gtk1/notebook.cpp +++ b/src/gtk1/notebook.cpp @@ -12,6 +12,9 @@ #endif #include "wx/notebook.h" + +#if wxUSE_NOTEBOOK + #include "wx/panel.h" #include "wx/utils.h" #include "wx/imaglist.h" @@ -623,3 +626,4 @@ bool wxNotebook::IsOwnGtkWindow( GdkWindow *window ) IMPLEMENT_DYNAMIC_CLASS(wxNotebookEvent, wxNotifyEvent) +#endif \ No newline at end of file diff --git a/src/gtk1/radiobox.cpp b/src/gtk1/radiobox.cpp index 432496cd91..e677deb968 100644 --- a/src/gtk1/radiobox.cpp +++ b/src/gtk1/radiobox.cpp @@ -12,6 +12,9 @@ #endif #include "wx/radiobox.h" + +#if wxUSE_RADIOBOX + #include "wx/dialog.h" #include "wx/frame.h" @@ -180,7 +183,7 @@ wxSize wxRadioBox::LayoutItems() if (len > max_len) max_len = len; gtk_myfixed_move( GTK_MYFIXED(m_parent->m_wxwindow), button, m_x+x, m_y+y ); - y += 20; + y += 22; node = node->Next(); if (!node) break; @@ -516,3 +519,5 @@ bool wxRadioBox::IsOwnGtkWindow( GdkWindow *window ) return FALSE; } + +#endif diff --git a/src/gtk1/radiobut.cpp b/src/gtk1/radiobut.cpp index 8ccd9ef3c0..5957092695 100644 --- a/src/gtk1/radiobut.cpp +++ b/src/gtk1/radiobut.cpp @@ -13,6 +13,9 @@ #endif #include "wx/radiobut.h" + +#if wxUSE_RADIOBOX + #include "gdk/gdk.h" #include "gtk/gtk.h" @@ -152,3 +155,5 @@ void wxRadioButton::ApplyWidgetStyle() gtk_widget_set_style( m_widget, m_widgetStyle ); gtk_widget_set_style( GTK_BUTTON(m_widget)->child, m_widgetStyle ); } + +#endif diff --git a/src/gtk1/scrolbar.cpp b/src/gtk1/scrolbar.cpp index 84a46924ef..038d908e20 100644 --- a/src/gtk1/scrolbar.cpp +++ b/src/gtk1/scrolbar.cpp @@ -13,6 +13,9 @@ #endif #include "wx/scrolbar.h" + +#if wxUSE_SCROLLBAR + #include "wx/utils.h" #include @@ -307,3 +310,4 @@ void wxScrollBar::ApplyWidgetStyle() gtk_widget_set_style( m_widget, m_widgetStyle ); } +#endif diff --git a/src/gtk1/slider.cpp b/src/gtk1/slider.cpp index c28fc43e1b..504b1cfb5a 100644 --- a/src/gtk1/slider.cpp +++ b/src/gtk1/slider.cpp @@ -12,6 +12,9 @@ #endif #include "wx/slider.h" + +#if wxUSE_SLIDER + #include "wx/utils.h" #include @@ -289,3 +292,5 @@ void wxSlider::ApplyWidgetStyle() SetWidgetStyle(); gtk_widget_set_style( m_widget, m_widgetStyle ); } + +#endif diff --git a/src/gtk1/spinbutt.cpp b/src/gtk1/spinbutt.cpp index 7b3b204283..66f5af6bc3 100644 --- a/src/gtk1/spinbutt.cpp +++ b/src/gtk1/spinbutt.cpp @@ -13,6 +13,9 @@ #endif #include "wx/spinbutt.h" + +#ifdef wxUSE_SPINBTN + #include "wx/utils.h" #include @@ -208,3 +211,5 @@ wxSpinEvent::wxSpinEvent(wxEventType commandType, int id): wxScrollEvent(commandType, id) { } + +#endif \ No newline at end of file diff --git a/src/gtk1/statbmp.cpp b/src/gtk1/statbmp.cpp index ff7fc98b4f..30431837bf 100644 --- a/src/gtk1/statbmp.cpp +++ b/src/gtk1/statbmp.cpp @@ -13,6 +13,8 @@ #include "wx/statbmp.h" +#if wxUSE_STATBMP + #include "gdk/gdk.h" #include "gtk/gtk.h" @@ -80,3 +82,5 @@ void wxStaticBitmap::SetBitmap( const wxBitmap &bitmap ) gtk_pixmap_set( GTK_PIXMAP(m_widget), m_bitmap.GetPixmap(), mask ); } } + +#endif diff --git a/src/gtk1/statbox.cpp b/src/gtk1/statbox.cpp index d1c978b2ef..84fd9673ff 100644 --- a/src/gtk1/statbox.cpp +++ b/src/gtk1/statbox.cpp @@ -13,6 +13,8 @@ #include "wx/statbox.h" +#if wxUSE_STATBOX + #include "gdk/gdk.h" #include "gtk/gtk.h" @@ -72,3 +74,5 @@ void wxStaticBox::ApplyWidgetStyle() SetWidgetStyle(); gtk_widget_set_style( m_widget, m_widgetStyle ); } + +#endif diff --git a/src/gtk1/statline.cpp b/src/gtk1/statline.cpp index 572edb0b1d..eb9374713c 100644 --- a/src/gtk1/statline.cpp +++ b/src/gtk1/statline.cpp @@ -13,6 +13,8 @@ #include "wx/statline.h" +#if wxUSE_STATLINE + #include "gdk/gdk.h" #include "gtk/gtk.h" @@ -55,3 +57,4 @@ bool wxStaticLine::Create( wxWindow *parent, wxWindowID id, return TRUE; } +#endif \ No newline at end of file diff --git a/src/gtk1/tbargtk.cpp b/src/gtk1/tbargtk.cpp index de244c82b1..651c6ba081 100644 --- a/src/gtk1/tbargtk.cpp +++ b/src/gtk1/tbargtk.cpp @@ -12,6 +12,9 @@ #endif #include "wx/toolbar.h" + +#if wxUSE_TOOLBAR + #include "wx/frame.h" #include "glib.h" @@ -584,3 +587,4 @@ void wxToolBar::OnIdle( wxIdleEvent &WXUNUSED(ievent) ) } } +#endif diff --git a/src/gtk1/textctrl.cpp b/src/gtk1/textctrl.cpp index 51169aaa60..fb10ca0a24 100644 --- a/src/gtk1/textctrl.cpp +++ b/src/gtk1/textctrl.cpp @@ -301,12 +301,12 @@ wxString wxTextCtrl::GetValue() const { gint len = gtk_text_get_length( GTK_TEXT(m_text) ); char *text = gtk_editable_get_chars( GTK_EDITABLE(m_text), 0, len ); - tmp = wxString(text,*wxConv_current); + tmp = wxString(text,*wxConvCurrent); g_free( text ); } else { - tmp = wxString(gtk_entry_get_text( GTK_ENTRY(m_text) ),*wxConv_current); + tmp = wxString(gtk_entry_get_text( GTK_ENTRY(m_text) ),*wxConvCurrent); } return tmp; } diff --git a/src/gtk1/tooltip.cpp b/src/gtk1/tooltip.cpp index 2e400fe04d..403880e328 100644 --- a/src/gtk1/tooltip.cpp +++ b/src/gtk1/tooltip.cpp @@ -103,5 +103,6 @@ void wxToolTip::SetDelay( long msecs ) gtk_tooltips_set_delay( ss_tooltips, msecs ); } + #endif diff --git a/src/gtk1/utilsres.cpp b/src/gtk1/utilsres.cpp index 4dc2843925..783d2087a2 100644 --- a/src/gtk1/utilsres.cpp +++ b/src/gtk1/utilsres.cpp @@ -74,7 +74,7 @@ static wxChar *GetResourcePath(wxChar *buf, wxChar *name, bool create) if (create) { // Touch the file to create it - FILE *fd = fopen(wxConv_file.cWX2MB(buf), "w"); + FILE *fd = fopen(wxConvCurrent->cWX2MB(buf), "w"); if (fd) fclose(fd); } return buf; @@ -139,7 +139,7 @@ static void wxXMergeDatabases() else { (void)GetIniFile(filename, (wxChar *) NULL); - serverDB = XrmGetFileDatabase(wxConv_file.cWX2MB(filename)); + serverDB = XrmGetFileDatabase(wxConvCurrent->cWX2MB(filename)); } if (serverDB) XrmMergeDatabases(serverDB, &wxResourceDatabase); @@ -169,10 +169,10 @@ static void wxXMergeDatabases() #endif #endif #if wxUSE_UNICODE - wxStrcat(environment, wxConv_libc.cMB2WX(hostbuf)); + wxStrcat(environment, wxConvCurrent->cMB2WX(hostbuf)); #endif } - if ((homeDB = XrmGetFileDatabase(wxConv_file.cWX2MB(environment)))) + if ((homeDB = XrmGetFileDatabase(wxConvCurrent->cWX2MB(environment)))) XrmMergeDatabases(homeDB, &wxResourceDatabase); } @@ -192,7 +192,7 @@ void wxFlushResources() (void)GetResourcePath(nameBuffer, file, TRUE); XrmDatabase database = (XrmDatabase)node->Data(); - XrmPutFileDatabase(database, wxConv_file.cWX2MB(nameBuffer)); + XrmPutFileDatabase(database, wxConvCurrent->cWX2MB(nameBuffer)); XrmDestroyDatabase(database); wxNode *next = node->Next(); // delete node; @@ -231,7 +231,7 @@ bool wxWriteResource(const wxString& section, const wxString& entry, const wxStr if (node) database = (XrmDatabase)node->Data(); else { - database = XrmGetFileDatabase(wxConv_file.cWX2MB(buffer)); + database = XrmGetFileDatabase(wxConvCurrent->cWX2MB(buffer)); wxLogTrace(wxTraceResAlloc, _T("Write: Number = %d"), wxTheResourceCache->Number()); wxTheResourceCache->Append(buffer, (wxObject *)database); } @@ -285,7 +285,7 @@ bool wxGetResource(const wxString& section, const wxString& entry, char **value, } else { - database = XrmGetFileDatabase(wxConv_file.cWX2MB(buffer)); + database = XrmGetFileDatabase(wxConvCurrent->cWX2MB(buffer)); wxLogTrace(wxTraceResAlloc, _T("Get: Number = %d"), wxTheResourceCache->Number()); wxTheResourceCache->Append(buffer, (wxObject *)database); } diff --git a/src/gtk1/window.cpp b/src/gtk1/window.cpp index cc3d1edb16..6ac1773a14 100644 --- a/src/gtk1/window.cpp +++ b/src/gtk1/window.cpp @@ -2545,7 +2545,7 @@ void wxWindow::DoSetToolTip( wxToolTip *tip ) void wxWindow::ApplyToolTip( GtkTooltips *tips, const wxChar *tip ) { - gtk_tooltips_set_tip( tips, GetConnectWidget(), wxConv_current->cWX2MB(tip), (gchar*) NULL ); + gtk_tooltips_set_tip( tips, GetConnectWidget(), wxConvCurrent->cWX2MB(tip), (gchar*) NULL ); } #endif // wxUSE_TOOLTIPS diff --git a/src/unix/utilsunx.cpp b/src/unix/utilsunx.cpp index f0f3439033..69b8cea1a0 100644 --- a/src/unix/utilsunx.cpp +++ b/src/unix/utilsunx.cpp @@ -255,7 +255,7 @@ long wxExecute( wxChar **argv, bool sync, wxProcess *process ) char *mb_argv[WXEXECUTE_NARGS]; while (argv[mb_argc]) { - wxWX2MBbuf mb_arg = wxConv_libc.cWX2MB(argv[mb_argc]); + wxWX2MBbuf mb_arg = wxConvCurrent->cWX2MB(argv[mb_argc]); mb_argv[mb_argc] = strdup(mb_arg); mb_argc++; } @@ -404,7 +404,7 @@ char *wxGetUserHome( const wxString &user ) } if ((ptr = wxGetenv(_T("USER"))) != NULL || (ptr = wxGetenv(_T("LOGNAME"))) != NULL) { - who = getpwnam(wxConv_libc.cWX2MB(ptr)); + who = getpwnam(wxConvCurrent->cWX2MB(ptr)); } // We now make sure the the user exists! @@ -419,7 +419,7 @@ char *wxGetUserHome( const wxString &user ) } #if wxUSE_UNICODE - return who ? wxConv_libc.cMB2WX(who->pw_dir) : (wxMB2WXbuf)((wxChar*)NULL); + return who ? wxConvCurrent->cMB2WX(who->pw_dir) : (wxMB2WXbuf)((wxChar*)NULL); #else return who ? who->pw_dir : ((char*)NULL); #endif @@ -444,7 +444,7 @@ static bool wxGetHostNameInternal(wxChar *buf, int sz) bool ok = uname(&uts) != -1; if ( ok ) { - wxStrncpy(buf, wxConv_libc.cMB2WX(uts.nodename), sz - 1); + wxStrncpy(buf, wxConvCurrent->cMB2WX(uts.nodename), sz - 1); buf[sz] = _T('\0'); } #elif defined(HAVE_GETHOSTNAME) @@ -490,7 +490,7 @@ bool wxGetFullHostName(wxChar *buf, int sz) { if ( !wxStrchr(buf, _T('.')) ) { - struct hostent *host = gethostbyname(wxConv_libc.cWX2MB(buf)); + struct hostent *host = gethostbyname(wxConvCurrent->cWX2MB(buf)); if ( !host ) { wxLogSysError(_("Cannot get the official hostname")); @@ -500,7 +500,7 @@ bool wxGetFullHostName(wxChar *buf, int sz) else { // the canonical name - wxStrncpy(buf, wxConv_libc.cMB2WX(host->h_name), sz); + wxStrncpy(buf, wxConvCurrent->cMB2WX(host->h_name), sz); } } //else: it's already a FQDN (BSD behaves this way) @@ -516,7 +516,7 @@ bool wxGetUserId(wxChar *buf, int sz) *buf = _T('\0'); if ((who = getpwuid(getuid ())) != NULL) { - wxStrncpy (buf, wxConv_libc.cMB2WX(who->pw_name), sz - 1); + wxStrncpy (buf, wxConvCurrent->cMB2WX(who->pw_name), sz - 1); return TRUE; } @@ -533,7 +533,7 @@ bool wxGetUserName(wxChar *buf, int sz) comma = strchr(who->pw_gecos, ','); if (comma) *comma = '\0'; // cut off non-name comment fields - wxStrncpy (buf, wxConv_libc.cMB2WX(who->pw_gecos), sz - 1); + wxStrncpy (buf, wxConvCurrent->cMB2WX(who->pw_gecos), sz - 1); return TRUE; } -- 2.45.2