From c50f1fb9226d9260454ccb9c8a67d0be23c2827f Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 28 Jun 1999 21:39:49 +0000 Subject: [PATCH] 1. wxStaticLine implemented (generic (ugly) and MSW versions) 2. wxTextDialog looks fine under MSW again 3. startup tips added: code, sample, docs 4. read-only text controls don't participate in TAB traversal git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@2919 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- docs/latex/wx/function.tex | 48 + docs/latex/wx/text.tex | 12 +- docs/latex/wx/tipprov.tex | 52 + docs/latex/wx/topics.tex | 1 + docs/latex/wx/ttips.tex | 42 + include/wx/dialog.h | 53 +- include/wx/generic/choicdgg.h | 3 +- include/wx/generic/statline.h | 53 + include/wx/generic/textdlgg.h | 48 +- include/wx/gtk/dialog.h | 2 +- include/wx/gtk/statline.h | 36 +- include/wx/gtk1/dialog.h | 2 +- include/wx/gtk1/statline.h | 36 +- include/wx/msw/accel.h | 58 +- include/wx/msw/dialog.h | 2 +- include/wx/msw/private.h | 17 +- include/wx/msw/setup0.h | 6 + include/wx/msw/statline.h | 50 + include/wx/msw/textctrl.h | 2 + include/wx/msw/tip.ico | Bin 0 -> 766 bytes include/wx/msw/wx.rc | 1 + include/wx/statline.h | 75 +- samples/controls/controls.cpp | 1 - samples/dialogs/dialogs.cpp | 118 +- samples/dialogs/dialogs.h | 2 + samples/dialogs/tips.txt | 5 + samples/dnd/dnd.cpp | 423 ++++--- samples/listctrl/listtest.cpp | 1 + samples/minimal/minimal.cpp | 37 +- samples/richedit/wxLayout.cpp | 2 +- src/generic/choicdgg.cpp | 140 +-- src/generic/msgdlgg.cpp | 57 +- src/generic/progdlgg.cpp | 22 +- src/generic/statline.cpp | 61 + src/generic/textdlgg.cpp | 189 ++- src/generic/tipdlg.cpp | 260 ++++ src/gtk/Makefile.am | 2 + src/gtk/statline.cpp | 30 +- src/gtk/window.cpp | 408 +++---- src/gtk1/Makefile.am | 2 + src/gtk1/statline.cpp | 30 +- src/gtk1/window.cpp | 408 +++---- src/msw/Makefile.am | 2 + src/msw/accel.cpp | 16 +- src/msw/frame.cpp | 9 +- src/msw/makefile.b32 | 9 + src/msw/makefile.bcc | 9 + src/msw/makefile.dos | 18 + src/msw/makefile.g95 | 3 + src/msw/makefile.sc | 5 +- src/msw/makefile.vc | 5 +- src/msw/makefile.wat | 14 +- src/msw/mdi.cpp | 15 +- src/msw/menu.cpp | 43 +- src/msw/statline.cpp | 82 ++ src/msw/textctrl.cpp | 5 + src/msw/window.cpp | 87 +- utils/wxPython/src/makefile.nt | 339 ++++++ utils/wxPython/src/wxp.cpp | 2049 ++++++++++++++++++++++++++++++++ utils/wxPython/tests/test1.py | 68 +- utils/wxprop/src/prop.cpp | 1119 +++++++++++++++++ 61 files changed, 5599 insertions(+), 1095 deletions(-) create mode 100644 docs/latex/wx/tipprov.tex create mode 100644 docs/latex/wx/ttips.tex create mode 100644 include/wx/generic/statline.h create mode 100644 include/wx/msw/statline.h create mode 100644 include/wx/msw/tip.ico create mode 100644 samples/dialogs/tips.txt create mode 100644 src/generic/statline.cpp create mode 100644 src/generic/tipdlg.cpp create mode 100644 src/msw/statline.cpp create mode 100644 utils/wxPython/src/makefile.nt create mode 100644 utils/wxPython/src/wxp.cpp create mode 100644 utils/wxprop/src/prop.cpp diff --git a/docs/latex/wx/function.tex b/docs/latex/wx/function.tex index 28ebd10b29..3ea9eb34d3 100644 --- a/docs/latex/wx/function.tex +++ b/docs/latex/wx/function.tex @@ -405,6 +405,27 @@ parameters are optional. However, it is recommended to pass a parent frame parameter, or (in MS Windows or Motif) the wrong window frame may be brought to the front when the dialog box is popped up. +\membersection{::wxCreateFileTipProvider}\label{wxcreatefiletipprovider} + +\func{wxTipProvider *}{wxCreateFileTipProvider}{ + \param{const wxString\& }{filename}, + \param{size\_t }{currentTip}} + +This function creates a \helpref{wxTipProvider}{wxtipprovider} which may be +used with \helpref{wxShowTip}{wxshowtip}. + +\docparam{filename}{The name of the file containing the tips, one per line} +\docparam{currentTip}{The index of the first tip to show - normally this index + is remembered between the 2 program runs.} + +\wxheading{See also:} + +\helpref{Tips overview}{tipsoverview} + +\wxheading{Include files} + + + \membersection{::wxFileSelector}\label{wxfileselector} \func{wxString}{wxFileSelector}{\param{const wxString\& }{message}, \param{const wxString\& }{default\_path = ""},\\ @@ -585,6 +606,33 @@ The symbols are not shown when the generic function is used. +\membersection{::wxShowTip}\label{wxshowtip} + +\func{bool}{wxShowTip}{ + \param{wxWindow *}{parent}, + \parent{wxTipProvider *}{tipProvider}, + \param{bool }{showAtStartup = TRUE}} + +This function shows a "startup tip" to the user. + +\docparam{parent}{The parent window for the modal dialog} + +\docparam{tipProvider}{An object which is used to get the text of the tips. + It may be created with + \helpref{wxCreateFileTipProvider}{wxcreatefiletipprovider} function.} + +\docparam{showAtStartup}{Should be TRUE if startup tips are shown, FALSE + otherwise. This is used as the initial value for "Show tips at startup" + checkbox which is shown in the tips dialog.} + +\wxheading{See also:} + +\helpref{Tips overview}{tipsoverview} + +\wxheading{Include files} + + + \section{GDI functions}\label{gdifunctions} The following are relevant to the GDI (Graphics Device Interface). diff --git a/docs/latex/wx/text.tex b/docs/latex/wx/text.tex index bc246b2bca..d0324945c5 100644 --- a/docs/latex/wx/text.tex +++ b/docs/latex/wx/text.tex @@ -19,10 +19,14 @@ streambuf\\ \twocolwidtha{5cm} \begin{twocollist}\itemsep=0pt -\twocolitem{\windowstyle{wxTE\_PROCESS\_ENTER}}{The callback function will -receive the message wxEVENT\_TYPE\_TEXT\_ENTER\_COMMAND. Note -that this will break tab traversal for this panel item under -Windows.} +\twocolitem{\windowstyle{wxTE\_PROCESS\_ENTER}}{The control will generate +the message wxEVENT\_TYPE\_TEXT\_ENTER\_COMMAND (otherwise pressing is +either processed internally by the control or used for navigation between +dialog controls).} +\twocolitem{\windowstyle{wxTE\_PROCESS\_TAB}}{The control will receieve +EVT\_CHAR messages for TAB pressed - normally, TAB is used for passing to the +next control in a dialog instead. For the control created with this style, +you can still use Ctrl-Enter to pass to the next control from the keyboard.} \twocolitem{\windowstyle{wxTE\_MULTILINE}}{The text control allows multiple lines.} \twocolitem{\windowstyle{wxTE\_PASSWORD}}{The text will be echoed as asterisks.} \twocolitem{\windowstyle{wxTE\_READONLY}}{The text will not be user-editable.} diff --git a/docs/latex/wx/tipprov.tex b/docs/latex/wx/tipprov.tex new file mode 100644 index 0000000000..dcc3336c5e --- /dev/null +++ b/docs/latex/wx/tipprov.tex @@ -0,0 +1,52 @@ +\section{\class{wxTipProvider}}\label{wxtipprovider} + +This is the class used together with \helpref{wxShowTip}{wxshowtip} function. +It must implement \helpref{GetTip}{wxtipprovidergettip} function and return the +current tip from it (different tip each time it is called). + +You will never use this class yourself, but you need it to show startup tips +with wxShowTip. Also, if you want to get the tips text from elsewhere than a +simple text file, you will want to derive a new class from wxTipProvider and +use it instead of the one returned by +\helpref{wxCreateFileTipProvider}{wxcreatefiletipprovider}. + +\wxheading{Derived from} + +None. + +\wxheading{Include files} + + + +\wxheading{See also} + +\helpref{Startup tips overview}{tipsoverview}, \helpref{::wxShowTip}{wxshowtip} + +\latexignore{\rtfignore{\wxheading{Members}}} + +\membersection{wxTipProvider::wxTipProvider}\label{wxtipproviderctor} + +\func{}{wxTipProvider}{\param{size\_t }{currentTip}} + +Constructor. + +\docparam{currentTip}{The starting tip index.} + +\membersection{wxTipProvider::GetTip}{wxtipprovidergettip} + +\func{wxString}{GetTip}{\void} + +Return the text of the current tip and pass to the next one. This function is +pure virtual, it should be implemented in the derived classes. + +\membersection{wxCurrentTipProvider::GetCurrentTip}{wxtipprovidergetcurrenttip} + +\constfunc{size\_t}{GetCurrentTip}{\void} + +Returns the index of the current tip (i.e. the one which would be returned by +GetTip). + +The program usually remembers the value returned by this function after calling +\helpref{wxShowTip}{wxshowtip}. Note that it is not the same as the value which +was passed to wxShowTip $+ 1$ because the user might have pressed the "Next" +button in the tip dialog. diff --git a/docs/latex/wx/topics.tex b/docs/latex/wx/topics.tex index 3445cca3a8..e0b00f1976 100644 --- a/docs/latex/wx/topics.tex +++ b/docs/latex/wx/topics.tex @@ -42,3 +42,4 @@ This chapter contains a selection of topic overviews. \input ti18n.tex \input tstream.tex \input tusage.tex +\input ttips.tex diff --git a/docs/latex/wx/ttips.tex b/docs/latex/wx/ttips.tex new file mode 100644 index 0000000000..e3d74a0ba2 --- /dev/null +++ b/docs/latex/wx/ttips.tex @@ -0,0 +1,42 @@ +\section{Startup tips overview}\label{tipsoverview} + +Many "modern" Windows programs have a feature (some would say annoyance) of +presenting the user tips at program startup. While this is probably useless to +the advanced users of the program, the experience shows that the tips may be +quite helpful for the novices and so more and more programs now do this. + +For a wxWindows programmer, implementing this feature is extremely easy. To +show a tip, it's enough to just call \helpref{wxShowTip}{wxshowtip} function +like this: + +\begin{verbatim} + if ( ...show tips at startup?... ) + { + wxTipProvider *tipProvider = wxCreateFileTipProvider("tips.txt", 0); + wxShowTip(windowParent, tipProvider); + delete tipProvider; + } +\end{verbatim} + +Of course, you need to get the text of the tips from somewhere - in the example +above, the text is supposed to be in the file tips.txt from where it's read by +the {\it tip provider}. The tip provider is just an object of a class deriving +from \helpref{wxTipProvider}{wxtipprovider}. It has to implement one pure +virtual function of the base class: \helpref{GetTip}{wxtipprovidergettip}. +In the case of the tip provider created by +\helpref{wxCreateFileTipProvider}{wxcreatefiletipprovider}, the tips are just +the lines of the text file. + +If you want to implement your own tip provider (for example, if you wish to +hardcode the tips inside your program), you just have to derive another class +from wxTipProvider and pass a pointer to the object of this class to wxShowTip +- then you don't need wxCreateFileTipProvider at all. + +Finally, you will probably want to save somewhere the index of the tip last +shown - so that the program doesn't always show the same tip on startup. As you +also need to remember whether to show tips or not (you shouldn't do it if the +user unchecked "Show tips on startup" checkbox in the dialog), you will +probably want to store both the index of the +last shown tip (as returned by +\helpref{wxTipProvider::GetCurrentTip}{wxtipprovidergetcurrenttip} and the flag +telling whether to show the tips at startup at all. diff --git a/include/wx/dialog.h b/include/wx/dialog.h index 823d2d4573..e74ffcdeff 100644 --- a/include/wx/dialog.h +++ b/include/wx/dialog.h @@ -1,18 +1,59 @@ #ifndef _WX_DIALOG_H_BASE_ #define _WX_DIALOG_H_BASE_ +class WXDLLEXPORT wxDialogBase : public wxPanel +{ +protected: + // functions to help with dialog layout + // ------------------------------------ + + // constants used in dialog layout + static const long LAYOUT_X_MARGIN; + static const long LAYOUT_Y_MARGIN; + static const long MARGIN_BETWEEN_BUTTONS; + + // Split the message in lines putting them into the array and calculating + // the maximum line width/height which is returned as wxSize. + wxSize SplitTextMessage(const wxString& message, wxArrayString *lines); + + // Creates the (possibly multiline) message, assuming each line has the + // size sizeText (which can be retrieved from SplitTextMessage). Returns + // the bottom border of the multiline text zone. + long CreateTextMessage(const wxArrayString& lines, + const wxPoint& posText, + const wxSize& sizeText); + + // Returns the preferred size for the buttons in the dialog + wxSize GetStandardButtonSize(bool hasCancel = TRUE); + + // Create the standard [Ok] and [Cancel] (if hasCancel) buttons centering + // them with respect to the dialog width wDialog at vertical position y. + // wButton and hButton is the size of the button (which can be retrieved + // from GetStandardButtonSize) + void CreateStandardButtons(long wDialog, + long y, + long wButton, + long hButton, + bool hasCancel = TRUE); + + // Returns the standard height of single line text ctrl (it's not the same + // as the height of just text which may be retrieved from + // wxGetCharHeight()) + long GetStandardTextHeight(); +}; + #if defined(__WXMSW__) -#include "wx/msw/dialog.h" + #include "wx/msw/dialog.h" #elif defined(__WXMOTIF__) -#include "wx/motif/dialog.h" + #include "wx/motif/dialog.h" #elif defined(__WXGTK__) -#include "wx/gtk/dialog.h" + #include "wx/gtk/dialog.h" #elif defined(__WXQT__) -#include "wx/qt/dialog.h" + #include "wx/qt/dialog.h" #elif defined(__WXMAC__) -#include "wx/mac/dialog.h" + #include "wx/mac/dialog.h" #elif defined(__WXSTUBS__) -#include "wx/stubs/dialog.h" + #include "wx/stubs/dialog.h" #endif #endif diff --git a/include/wx/generic/choicdgg.h b/include/wx/generic/choicdgg.h index 991ea54bb2..b796f68aba 100644 --- a/include/wx/generic/choicdgg.h +++ b/include/wx/generic/choicdgg.h @@ -6,7 +6,7 @@ // Created: 01/02/97 // RCS-ID: $Id$ // Copyright: (c) -// Licence: wxWindows licence +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #ifndef __CHOICEDLGH_G__ @@ -79,7 +79,6 @@ public: void OnListBoxDClick(wxCommandEvent& event); protected: - long m_dialogStyle; int m_selection; wxString m_stringSelection; void *m_clientData; diff --git a/include/wx/generic/statline.h b/include/wx/generic/statline.h new file mode 100644 index 0000000000..0058ddede8 --- /dev/null +++ b/include/wx/generic/statline.h @@ -0,0 +1,53 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: generic/statline.h +// Purpose: a generic wxStaticLine class +// Author: Vadim Zeitlin +// Created: 28.06.99 +// Version: $Id$ +// Copyright: (c) 1998 Vadim Zeitlin +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GENERIC_STATLINE_H_ +#define _WX_GENERIC_STATLINE_H_ + +#ifdef __GNUG__ + #pragma interface +#endif + +// ---------------------------------------------------------------------------- +// wxStaticLine +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxStaticLine : public wxStaticLineBase +{ + DECLARE_DYNAMIC_CLASS(wxStaticLine) + +public: + // constructors and pseudo-constructors + wxStaticLine() { } + + wxStaticLine( wxWindow *parent, + wxWindowID id, + const wxPoint &pos = wxDefaultPosition, + const wxSize &size = wxDefaultSize, + long style = wxLI_HORIZONTAL, + const wxString &name = wxStaticTextNameStr ) + { + Create(parent, id, pos, size, style, name); + } + + bool Create( wxWindow *parent, + wxWindowID id, + const wxPoint &pos = wxDefaultPosition, + const wxSize &size = wxDefaultSize, + long style = wxLI_HORIZONTAL, + const wxString &name = wxStaticTextNameStr ); + +protected: + // we implement the static line using a static box + wxStaticBox *m_statbox; +}; + +#endif // _WX_GENERIC_STATLINE_H_ + diff --git a/include/wx/generic/textdlgg.h b/include/wx/generic/textdlgg.h index e93dd84f5b..5b0e013ccb 100644 --- a/include/wx/generic/textdlgg.h +++ b/include/wx/generic/textdlgg.h @@ -6,46 +6,58 @@ // Created: 01/02/97 // RCS-ID: $Id$ // Copyright: (c) Julian Smart and Markus Holzem -// Licence: wxWindows license +// Licence: wxWindows license ///////////////////////////////////////////////////////////////////////////// #ifndef __TEXTDLGH_G__ #define __TEXTDLGH_G__ #ifdef __GNUG__ -#pragma interface "textdlgg.h" + #pragma interface "textdlgg.h" #endif -#include "wx/setup.h" +#include "wx/defs.h" + #include "wx/dialog.h" // Handy dialog functions (will be converted into classes at some point) WXDLLEXPORT_DATA(extern const wxChar*) wxGetTextFromUserPromptStr; WXDLLEXPORT_DATA(extern const wxChar*) wxEmptyString; -#define wxID_TEXT 3000 - -class WXDLLEXPORT wxTextEntryDialog: public wxDialog +class WXDLLEXPORT wxTextEntryDialog : public wxDialog { -DECLARE_DYNAMIC_CLASS(wxTextEntryDialog) -protected: - long m_dialogStyle; - wxString m_value; + DECLARE_DYNAMIC_CLASS(wxTextEntryDialog) + public: - wxTextEntryDialog(wxWindow *parent, const wxString& message, const wxString& caption = wxGetTextFromUserPromptStr, - const wxString& value = wxEmptyString, long style = wxOK|wxCANCEL|wxCENTRE, const wxPoint& pos = wxDefaultPosition); + wxTextEntryDialog(wxWindow *parent, + const wxString& message, + const wxString& caption = wxGetTextFromUserPromptStr, + const wxString& value = wxEmptyString, + long style = wxOK | wxCANCEL | wxCENTRE, + const wxPoint& pos = wxDefaultPosition); - inline void SetValue(const wxString& val) { m_value = val; } - inline wxString GetValue(void) const { return m_value; } + void SetValue(const wxString& val) { m_value = val; } + wxString GetValue() const { return m_value; } + // implementation only void OnOK(wxCommandEvent& event); -DECLARE_EVENT_TABLE() +protected: + wxTextCtrl *m_textctrl; + wxString m_value; + +private: + DECLARE_EVENT_TABLE() }; -wxString WXDLLEXPORT wxGetTextFromUser(const wxString& message, const wxString& caption = wxGetTextFromUserPromptStr, - const wxString& default_value = wxEmptyString, wxWindow *parent = (wxWindow *) NULL, - int x = -1, int y = -1, bool centre = TRUE); +wxString WXDLLEXPORT +wxGetTextFromUser(const wxString& message, + const wxString& caption = wxGetTextFromUserPromptStr, + const wxString& default_value = wxEmptyString, + wxWindow *parent = (wxWindow *) NULL, + int x = -1, + int y = -1, + bool centre = TRUE); #endif // __TEXTDLGH_G__ diff --git a/include/wx/gtk/dialog.h b/include/wx/gtk/dialog.h index 82334eb479..ac1f0db9a0 100644 --- a/include/wx/gtk/dialog.h +++ b/include/wx/gtk/dialog.h @@ -35,7 +35,7 @@ extern const wxChar *wxDialogNameStr; // wxDialog //----------------------------------------------------------------------------- -class wxDialog: public wxPanel +class wxDialog: public wxDialogBase { DECLARE_DYNAMIC_CLASS(wxDialog) diff --git a/include/wx/gtk/statline.h b/include/wx/gtk/statline.h index 2d31725292..8cbce8a565 100644 --- a/include/wx/gtk/statline.h +++ b/include/wx/gtk/statline.h @@ -4,7 +4,7 @@ // Author: Robert Roebling // Id: $Id$ // Copyright: (c) 1998 Robert Roebling -// Licence: wxWindows licence +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -12,12 +12,12 @@ #define __GTKSTATICLINEH__ #ifdef __GNUG__ -#pragma interface + #pragma interface #endif -#include "wx/defs.h" - -#if wxUSE_STATLINE +#if !wxUSE_STATLINE + #error "This file should only be included if wxUSE_STATLINE == 1" +#endif #include "wx/object.h" #include "wx/list.h" @@ -29,32 +29,24 @@ class wxStaticLine; -//----------------------------------------------------------------------------- -// global data -//----------------------------------------------------------------------------- - -extern const char *wxStaticTextNameStr; - //----------------------------------------------------------------------------- // wxStaticLine //----------------------------------------------------------------------------- -class wxStaticLine: public wxControl +class wxStaticLine : public wxStaticLineBase { - DECLARE_DYNAMIC_CLASS(wxStaticLine) + DECLARE_DYNAMIC_CLASS(wxStaticLine) - public: - - wxStaticLine(void); +public: + wxStaticLine(); wxStaticLine( wxWindow *parent, wxWindowID id, - const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, - long style = wxLI_HORIZONTAL, const wxString &name = wxStaticTextNameStr ); + const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, + long style = wxLI_HORIZONTAL, const wxString &name = wxStaticTextNameStr ); bool Create( wxWindow *parent, wxWindowID id, - const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, - long style = wxLI_HORIZONTAL, const wxString &name = wxStaticTextNameStr ); - + const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, + long style = wxLI_HORIZONTAL, const wxString &name = wxStaticTextNameStr ); }; -#endif +#endif // wxUSE_STATLINE #endif // __GTKSTATICLINEH__ diff --git a/include/wx/gtk1/dialog.h b/include/wx/gtk1/dialog.h index 82334eb479..ac1f0db9a0 100644 --- a/include/wx/gtk1/dialog.h +++ b/include/wx/gtk1/dialog.h @@ -35,7 +35,7 @@ extern const wxChar *wxDialogNameStr; // wxDialog //----------------------------------------------------------------------------- -class wxDialog: public wxPanel +class wxDialog: public wxDialogBase { DECLARE_DYNAMIC_CLASS(wxDialog) diff --git a/include/wx/gtk1/statline.h b/include/wx/gtk1/statline.h index 2d31725292..8cbce8a565 100644 --- a/include/wx/gtk1/statline.h +++ b/include/wx/gtk1/statline.h @@ -4,7 +4,7 @@ // Author: Robert Roebling // Id: $Id$ // Copyright: (c) 1998 Robert Roebling -// Licence: wxWindows licence +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -12,12 +12,12 @@ #define __GTKSTATICLINEH__ #ifdef __GNUG__ -#pragma interface + #pragma interface #endif -#include "wx/defs.h" - -#if wxUSE_STATLINE +#if !wxUSE_STATLINE + #error "This file should only be included if wxUSE_STATLINE == 1" +#endif #include "wx/object.h" #include "wx/list.h" @@ -29,32 +29,24 @@ class wxStaticLine; -//----------------------------------------------------------------------------- -// global data -//----------------------------------------------------------------------------- - -extern const char *wxStaticTextNameStr; - //----------------------------------------------------------------------------- // wxStaticLine //----------------------------------------------------------------------------- -class wxStaticLine: public wxControl +class wxStaticLine : public wxStaticLineBase { - DECLARE_DYNAMIC_CLASS(wxStaticLine) + DECLARE_DYNAMIC_CLASS(wxStaticLine) - public: - - wxStaticLine(void); +public: + wxStaticLine(); wxStaticLine( wxWindow *parent, wxWindowID id, - const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, - long style = wxLI_HORIZONTAL, const wxString &name = wxStaticTextNameStr ); + const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, + long style = wxLI_HORIZONTAL, const wxString &name = wxStaticTextNameStr ); bool Create( wxWindow *parent, wxWindowID id, - const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, - long style = wxLI_HORIZONTAL, const wxString &name = wxStaticTextNameStr ); - + const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, + long style = wxLI_HORIZONTAL, const wxString &name = wxStaticTextNameStr ); }; -#endif +#endif // wxUSE_STATLINE #endif // __GTKSTATICLINEH__ diff --git a/include/wx/msw/accel.h b/include/wx/msw/accel.h index af0a7ca0e7..d985b652ff 100644 --- a/include/wx/msw/accel.h +++ b/include/wx/msw/accel.h @@ -6,20 +6,24 @@ // Created: 31/7/98 // RCS-ID: $Id$ // Copyright: (c) Julian Smart -// Licence: wxWindows licence +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #ifndef _WX_ACCEL_H_ #define _WX_ACCEL_H_ #ifdef __GNUG__ -#pragma interface "accel.h" + #pragma interface "accel.h" #endif #include "wx/object.h" class WXDLLEXPORT wxAcceleratorTable; +// ---------------------------------------------------------------------------- +// constants +// ---------------------------------------------------------------------------- + // Hold Ctrl key down #define wxACCEL_ALT 0x01 @@ -32,27 +36,38 @@ class WXDLLEXPORT wxAcceleratorTable; // Hold no other key #define wxACCEL_NORMAL 0x00 +// ---------------------------------------------------------------------------- +// an entry in wxAcceleratorTable corresponds to one accelerator +// ---------------------------------------------------------------------------- + class WXDLLEXPORT wxAcceleratorEntry { public: wxAcceleratorEntry(int flags = 0, int keyCode = 0, int cmd = 0) { - m_flags = flags; m_keyCode = keyCode; m_command = cmd; + Set(flags, keyCode, cmd); } - inline void Set(int flags, int keyCode, int cmd) - { m_flags = flags; m_keyCode = keyCode; m_command = cmd; } + void Set(int flags, int keyCode, int cmd) + { + m_flags = flags; m_keyCode = keyCode; m_command = cmd; + } - inline int GetFlags() const { return m_flags; } - inline int GetKeyCode() const { return m_keyCode; } - inline int GetCommand() const { return m_command; } + int GetFlags() const { return m_flags; } + int GetKeyCode() const { return m_keyCode; } + int GetCommand() const { return m_command; } - int m_flags; - int m_keyCode; // ASCII or virtual keycode - int m_command; // Command id to generate +//private: + int m_flags; + int m_keyCode; // ASCII or virtual keycode + int m_command; // Command id to generate }; -class WXDLLEXPORT wxAcceleratorTable: public wxObject +// ---------------------------------------------------------------------------- +// the accel table has all accelerators for a given window or menu +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxAcceleratorTable : public wxObject { DECLARE_DYNAMIC_CLASS(wxAcceleratorTable) public: @@ -61,18 +76,25 @@ public: wxAcceleratorTable(int n, const wxAcceleratorEntry entries[]); // Load from array // Copy constructors - inline wxAcceleratorTable(const wxAcceleratorTable& accel) { Ref(accel); } - inline wxAcceleratorTable(const wxAcceleratorTable* accel) { if (accel) Ref(*accel); } + wxAcceleratorTable(const wxAcceleratorTable& accel) + { Ref(accel); } ~wxAcceleratorTable(); - inline wxAcceleratorTable& operator = (const wxAcceleratorTable& accel) { if (*this == accel) return (*this); Ref(accel); return *this; } - inline bool operator == (const wxAcceleratorTable& accel) { return m_refData == accel.m_refData; } - inline bool operator != (const wxAcceleratorTable& accel) { return m_refData != accel.m_refData; } + wxAcceleratorTable& operator = (const wxAcceleratorTable& accel) + { if ( *this != accel ) Ref(accel); return *this; } - bool Ok(void) const; + bool operator == (const wxAcceleratorTable& accel) const + { return m_refData == accel.m_refData; } + bool operator != (const wxAcceleratorTable& accel) const + { return m_refData != accel.m_refData; } + + bool Ok() const; void SetHACCEL(WXHACCEL hAccel); WXHACCEL GetHACCEL() const; + + // translate the accelerator, return TRUE if done + bool Translate(wxWindow *window, WXMSG *msg) const; }; WXDLLEXPORT_DATA(extern wxAcceleratorTable) wxNullAcceleratorTable; diff --git a/include/wx/msw/dialog.h b/include/wx/msw/dialog.h index 74a07e5685..ccc130f2ac 100644 --- a/include/wx/msw/dialog.h +++ b/include/wx/msw/dialog.h @@ -21,7 +21,7 @@ WXDLLEXPORT_DATA(extern const wxChar*) wxDialogNameStr; // Dialog boxes -class WXDLLEXPORT wxDialog : public wxPanel +class WXDLLEXPORT wxDialog : public wxDialogBase { DECLARE_DYNAMIC_CLASS(wxDialog) diff --git a/include/wx/msw/private.h b/include/wx/msw/private.h index 02b9577313..ea234b7964 100644 --- a/include/wx/msw/private.h +++ b/include/wx/msw/private.h @@ -207,20 +207,27 @@ extern LONG APIENTRY _EXPORT // --------------------------------------------------------------------------- // macros to make casting between WXFOO and FOO a bit easier: the GetFoo() -// returns Foo cast to the Windows type for oruselves, while GetFoosFoo() takes -// an argument which should be a pointer to wxFoo (is this really clear?) +// returns Foo cast to the Windows type for oruselves, while GetFooOf() takes +// an argument which should be a pointer or reference to the object of the +// corresponding class (this depends on the macro) // --------------------------------------------------------------------------- #define GetHwnd() ((HWND)GetHWND()) -#define GetWinHwnd(win) ((HWND)((win)->GetHWND())) +#define GetHwndOf(win) ((HWND)((win)->GetHWND())) +// old name +#define GetWinHwnd GetHwndOf #define GetHdc() ((HDC)GetHDC()) +#define GetHdcOf(dc) ((HDC)(dc).GetHDC()) #define GetHicon() ((HICON)GetHICON()) -#define GetIconHicon(icon) ((HICON)(icon).GetHICON()) +#define GetHiconOf(icon) ((HICON)(icon).GetHICON()) #define GetHaccel() ((HACCEL)GetHACCEL()) -#define GetTableHaccel(table) ((HACCEL)((table).GetHACCEL())) +#define GetHaccelOf(table) ((HACCEL)((table).GetHACCEL())) + +#define GetHmenu() ((HMENU)GetHMenu()) +#define GetHmenuOf(menu) ((HMENU)menu->GetHMenu()) // --------------------------------------------------------------------------- // global data diff --git a/include/wx/msw/setup0.h b/include/wx/msw/setup0.h index 30fde9a653..d7a89dba0a 100644 --- a/include/wx/msw/setup0.h +++ b/include/wx/msw/setup0.h @@ -86,6 +86,9 @@ #define wxUSE_SPINBTN 1 // Define 1 to compile spin button +// use wxStaticLine class (separator line in the dialog)? +#define wxUSE_STATLINE 1 + #define wxUSE_CHECKLISTBOX 1 // Define 1 to compile check listbox @@ -104,6 +107,9 @@ #define wxUSE_WX_RESOURCES 1 // Use .wxr resource mechanism (requires PrologIO library) +// support for startup tips (wxShowTip &c) +#define wxUSE_STARTUP_TIPS 1 + // BC++/Win16 can't cope with the amount of data in resource.cpp #if defined(__WIN16__) && defined(__BORLANDC__) #undef wxUSE_WX_RESOURCES diff --git a/include/wx/msw/statline.h b/include/wx/msw/statline.h new file mode 100644 index 0000000000..0b4b2d8341 --- /dev/null +++ b/include/wx/msw/statline.h @@ -0,0 +1,50 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: msw/statline.h +// Purpose: MSW version of wxStaticLine class +// Author: Vadim Zeitlin +// Created: 28.06.99 +// Version: $Id$ +// Copyright: (c) 1998 Vadim Zeitlin +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_STATLINE_H_ +#define _WX_MSW_STATLINE_H_ + +#ifdef __GNUG__ + #pragma interface +#endif + +// ---------------------------------------------------------------------------- +// wxStaticLine +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxStaticLine : public wxStaticLineBase +{ + DECLARE_DYNAMIC_CLASS(wxStaticLine) + +public: + // constructors and pseudo-constructors + wxStaticLine() { } + + wxStaticLine( wxWindow *parent, + wxWindowID id, + const wxPoint &pos = wxDefaultPosition, + const wxSize &size = wxDefaultSize, + long style = wxLI_HORIZONTAL, + const wxString &name = wxStaticTextNameStr ) + { + Create(parent, id, pos, size, style, name); + } + + bool Create( wxWindow *parent, + wxWindowID id, + const wxPoint &pos = wxDefaultPosition, + const wxSize &size = wxDefaultSize, + long style = wxLI_HORIZONTAL, + const wxString &name = wxStaticTextNameStr ); +}; + +#endif // _WX_MSW_STATLINE_H_ + + diff --git a/include/wx/msw/textctrl.h b/include/wx/msw/textctrl.h index 6461338618..40dbcad9e4 100644 --- a/include/wx/msw/textctrl.h +++ b/include/wx/msw/textctrl.h @@ -182,6 +182,8 @@ public: virtual void AdoptAttributesFromHWND(); virtual void SetupColours(); + virtual bool AcceptsFocus() const; + protected: #if wxUSE_RICHEDIT bool m_isRich; // Are we using rich text edit to implement this? diff --git a/include/wx/msw/tip.ico b/include/wx/msw/tip.ico new file mode 100644 index 0000000000000000000000000000000000000000..4cdaba021c56f556ee116acb7792bd5617d277ee GIT binary patch literal 766 zcmbtSF>b>!3_Q05RKP&Jb&bdV!hMoA4IQj8&&ke3Ps!M+@zxB1*rQ}SO4F^9k0NzP zik1yDoPGZU8=nurE7v!oC*Fw$g#)?2M*#RBgtE}mB?4lMBs4!zHILx5Ei-vIzc|a{ z{a9}}e=G3gTnn7F4O9eMt+j}-Ym!?T4XGy2h zGHHF@2in;-y04AT0%v?H2iotPFtNOdyrffkX9`*Y1%(DC(h%v^D{&=uz>% literal 0 HcmV?d00001 diff --git a/include/wx/msw/wx.rc b/include/wx/msw/wx.rc index 253038559a..34ee12e83a 100644 --- a/include/wx/msw/wx.rc +++ b/include/wx/msw/wx.rc @@ -114,6 +114,7 @@ wxICON_QUESTION ICON "wx/msw/question.ico" wxICON_WARNING ICON "wx/msw/warning.ico" wxICON_ERROR ICON "wx/msw/error.ico" wxICON_INFO ICON "wx/msw/info.ico" +wxICON_TIP ICON "wx/msw/tip.ico" ////////////////////////////////////////////////////////////////////////////// // diff --git a/include/wx/statline.h b/include/wx/statline.h index d7e2de31b4..9c7fe86788 100644 --- a/include/wx/statline.h +++ b/include/wx/statline.h @@ -1,19 +1,74 @@ #ifndef _WX_STATLINE_H_BASE_ #define _WX_STATLINE_H_BASE_ +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +// this defines wxUSE_STATLINE +#include "wx/defs.h" + +#if wxUSE_STATLINE + +// the base class declaration +#include "wx/control.h" + +// ---------------------------------------------------------------------------- +// global variables +// ---------------------------------------------------------------------------- + +// the default name for objects of class wxStaticLine +WXDLLEXPORT_DATA(extern const wxChar*) wxStaticTextNameStr; + +// ---------------------------------------------------------------------------- +// wxStaticLine - a line in a dialog +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxStaticLineBase : public wxControl +{ +public: + // constructor + wxStaticLineBase() { } + + // is the line vertical? + bool IsVertical() const { return (GetWindowStyle() & wxLI_VERTICAL) != 0; } + + // get the default size for the "lesser" dimension of the static line + static int GetDefaultSize() { return 2; } + +protected: + // set the right size for the right dimension + wxSize AdjustSize(const wxSize& size) + { + wxSize sizeReal(size); + if ( IsVertical() ) + { + if ( size.x == -1 ) + sizeReal.x = GetDefaultSize(); + } + else + { + if ( size.y == -1 ) + sizeReal.y = GetDefaultSize(); + } + + return sizeReal; + } +}; + +// ---------------------------------------------------------------------------- +// now include the actual class declaration +// ---------------------------------------------------------------------------- + #if defined(__WXMSW__) -#include "wx/msw/statline.h" -#elif defined(__WXMOTIF__) -#include "wx/motif/statline.h" + #include "wx/msw/statline.h" #elif defined(__WXGTK__) -#include "wx/gtk/statline.h" -#elif defined(__WXQT__) -#include "wx/qt/statline.h" -#elif defined(__WXMAC__) -#include "wx/mac/statline.h" -#elif defined(__WXSTUBS__) -#include "wx/stubs/statline.h" + #include "wx/gtk/statline.h" +#else // use generic implementation for all other platforms + #include "wx/generic/statline.h" #endif +#endif // wxUSE_STATLINE + #endif // _WX_STATLINE_H_BASE_ diff --git a/samples/controls/controls.cpp b/samples/controls/controls.cpp index 6f06969923..ebd18e12cc 100644 --- a/samples/controls/controls.cpp +++ b/samples/controls/controls.cpp @@ -769,7 +769,6 @@ void MyPanel::OnShowProgress( wxCommandEvent& WXUNUSED(event) ) { cont = dialog.Update(i); } - wxYield(); } if ( !cont ) diff --git a/samples/dialogs/dialogs.cpp b/samples/dialogs/dialogs.cpp index 75fb99d93d..70715bb075 100644 --- a/samples/dialogs/dialogs.cpp +++ b/samples/dialogs/dialogs.cpp @@ -6,7 +6,7 @@ // Created: 04/01/98 // RCS-ID: $Id$ // Copyright: (c) Julian Smart and Markus Holzem -// Licence: wxWindows license +// Licence: wxWindows license ///////////////////////////////////////////////////////////////////////////// #ifdef __GNUG__ @@ -30,6 +30,7 @@ #include #include #include +#include #define wxTEST_GENERIC_DIALOGS_IN_MSW 0 @@ -78,6 +79,8 @@ bool MyApp::OnInit(void) file_menu->Append(DIALOGS_TEXT_ENTRY, "Text &entry"); file_menu->Append(DIALOGS_SINGLE_CHOICE, "&Single choice"); file_menu->AppendSeparator(); + file_menu->Append(DIALOGS_TIP, "&Tip of the day"); + file_menu->AppendSeparator(); file_menu->Append(DIALOGS_FILE_OPEN, "&Open file"); file_menu->Append(DIALOGS_FILE_SAVE, "Sa&ve file"); file_menu->Append(DIALOGS_DIR_CHOOSE, "&Choose a directory"); @@ -190,23 +193,20 @@ void MyFrame::ChooseFontGeneric(wxCommandEvent& WXUNUSED(event) ) void MyFrame::MessageBox(wxCommandEvent& WXUNUSED(event) ) { wxMessageDialog dialog(NULL, "This is a message box\nA long, long string to test out the message box properly", - "Message box text", wxYES_NO|wxCANCEL); + "Message box text", wxYES_NO|wxCANCEL|wxICON_INFORMATION); dialog.ShowModal(); - - ::wxMessageBox("MsgBox with a really long long string", - "this is the text", wxYES_NO|wxICON_EXCLAMATION); } void MyFrame::TextEntry(wxCommandEvent& WXUNUSED(event) ) { wxTextEntryDialog dialog(this, "This is a small sample\nA long, long string to test out the text entrybox", - "Please enter a string", "Default value", wxOK|wxCANCEL); + "Please enter a string", "Default value", wxOK|wxCANCEL); if (dialog.ShowModal() == wxID_OK) { - wxMessageDialog dialog2(this, dialog.GetValue(), "Got string"); - dialog2.ShowModal(); + wxMessageDialog dialog2(this, dialog.GetValue(), "Got string"); + dialog2.ShowModal(); } } @@ -229,10 +229,10 @@ void MyFrame::SingleChoice(wxCommandEvent& WXUNUSED(event) ) void MyFrame::FileOpen(wxCommandEvent& WXUNUSED(event) ) { - wxFileDialog dialog(this, "Testing open file dialog", "", "", "*.txt", 0); + wxFileDialog dialog(this, "Testing open file dialog", "", "", "*.txt", 0); - if (dialog.ShowModal() == wxID_OK) - { + if (dialog.ShowModal() == wxID_OK) + { wxString info; info.Printf(_T("Full file name: %s\n") _T("Path: %s\n") @@ -240,45 +240,72 @@ void MyFrame::FileOpen(wxCommandEvent& WXUNUSED(event) ) dialog.GetPath().c_str(), dialog.GetDirectory().c_str(), dialog.GetFilename().c_str()); - wxMessageDialog dialog2(this, info, "Selected file"); - dialog2.ShowModal(); - } + wxMessageDialog dialog2(this, info, "Selected file"); + dialog2.ShowModal(); + } } void MyFrame::FileSave(wxCommandEvent& WXUNUSED(event) ) { - wxFileDialog dialog(this, "Testing save file dialog", "", "", - "Text files (*.txt)|*.txt|Document files (*.doc)|*.doc", - wxSAVE|wxOVERWRITE_PROMPT); - - if (dialog.ShowModal() == wxID_OK) - { - wxChar buf[400]; - wxSprintf(buf, _T("%s, filter %d"), (const wxChar*)dialog.GetPath(), dialog.GetFilterIndex()); - wxMessageDialog dialog2(this, wxString(buf), "Selected path"); - dialog2.ShowModal(); - } + wxFileDialog dialog(this, "Testing save file dialog", "", "", + "Text files (*.txt)|*.txt|Document files (*.doc)|*.doc", + wxSAVE|wxOVERWRITE_PROMPT); + + if (dialog.ShowModal() == wxID_OK) + { + wxChar buf[400]; + wxSprintf(buf, _T("%s, filter %d"), (const wxChar*)dialog.GetPath(), dialog.GetFilterIndex()); + wxMessageDialog dialog2(this, wxString(buf), "Selected path"); + dialog2.ShowModal(); + } } void MyFrame::DirChoose(wxCommandEvent& WXUNUSED(event) ) { - wxDirDialog dialog(this, "Testing directory picker", ""); + wxDirDialog dialog(this, "Testing directory picker", ""); + + if (dialog.ShowModal() == wxID_OK) + { + wxMessageDialog dialog2(this, dialog.GetPath(), "Selected path"); + dialog2.ShowModal(); + } +} + +void MyFrame::ShowTip(wxCommandEvent& event) +{ + static size_t s_index = (size_t)-1; + + if ( s_index == (size_t)-1 ) + { + srand(time(NULL)); + + // this is completely bogus, we don't know how many lines are there + // in the file, but who cares, it's a demo only... + s_index = rand() % 5; + } + + wxTipProvider *tipProvider = wxCreateFileTipProvider("tips.txt", s_index); + + bool showAtStartup = wxShowTip(this, tipProvider); + + if ( showAtStartup ) + { + wxMessageBox("Will show tips on startup", "Tips dialog", + wxOK | wxICON_INFORMATION, this); + } - if (dialog.ShowModal() == wxID_OK) - { - wxMessageDialog dialog2(this, dialog.GetPath(), "Selected path"); - dialog2.ShowModal(); - } + s_index = tipProvider->GetCurrentTip(); + delete tipProvider; } void MyFrame::OnExit(wxCommandEvent& WXUNUSED(event) ) { - Close(TRUE); + Close(TRUE); } void MyCanvas::OnPaint(wxPaintEvent& WXUNUSED(event) ) { - wxPaintDC dc(this); + wxPaintDC dc(this); dc.SetFont(wxGetApp().m_canvasFont); dc.SetTextForeground(wxGetApp().m_canvasTextColour); dc.SetBackgroundMode(wxTRANSPARENT); @@ -286,22 +313,23 @@ void MyCanvas::OnPaint(wxPaintEvent& WXUNUSED(event) ) } BEGIN_EVENT_TABLE(MyCanvas, wxScrolledWindow) - EVT_PAINT(MyCanvas::OnPaint) + EVT_PAINT(MyCanvas::OnPaint) END_EVENT_TABLE() BEGIN_EVENT_TABLE(MyFrame, wxFrame) - EVT_MENU(DIALOGS_CHOOSE_COLOUR, MyFrame::ChooseColour) - EVT_MENU(DIALOGS_CHOOSE_FONT, MyFrame::ChooseFont) - EVT_MENU(DIALOGS_MESSAGE_BOX, MyFrame::MessageBox) - EVT_MENU(DIALOGS_TEXT_ENTRY, MyFrame::TextEntry) - EVT_MENU(DIALOGS_SINGLE_CHOICE, MyFrame::SingleChoice) - EVT_MENU(DIALOGS_FILE_OPEN, MyFrame::FileOpen) - EVT_MENU(DIALOGS_FILE_SAVE, MyFrame::FileSave) - EVT_MENU(DIALOGS_DIR_CHOOSE, MyFrame::DirChoose) + EVT_MENU(DIALOGS_CHOOSE_COLOUR, MyFrame::ChooseColour) + EVT_MENU(DIALOGS_CHOOSE_FONT, MyFrame::ChooseFont) + EVT_MENU(DIALOGS_MESSAGE_BOX, MyFrame::MessageBox) + EVT_MENU(DIALOGS_TEXT_ENTRY, MyFrame::TextEntry) + EVT_MENU(DIALOGS_SINGLE_CHOICE, MyFrame::SingleChoice) + EVT_MENU(DIALOGS_FILE_OPEN, MyFrame::FileOpen) + EVT_MENU(DIALOGS_FILE_SAVE, MyFrame::FileSave) + EVT_MENU(DIALOGS_DIR_CHOOSE, MyFrame::DirChoose) + EVT_MENU(DIALOGS_TIP, MyFrame::ShowTip) #if defined(__WXMSW__) && wxTEST_GENERIC_DIALOGS_IN_MSW - EVT_MENU(DIALOGS_CHOOSE_COLOUR_GENERIC, MyFrame::ChooseColourGeneric) - EVT_MENU(DIALOGS_CHOOSE_FONT_GENERIC, MyFrame::ChooseFontGeneric) + EVT_MENU(DIALOGS_CHOOSE_COLOUR_GENERIC, MyFrame::ChooseColourGeneric) + EVT_MENU(DIALOGS_CHOOSE_FONT_GENERIC, MyFrame::ChooseFontGeneric) #endif - EVT_MENU(wxID_EXIT, MyFrame::OnExit) + EVT_MENU(wxID_EXIT, MyFrame::OnExit) END_EVENT_TABLE() diff --git a/samples/dialogs/dialogs.h b/samples/dialogs/dialogs.h index 3141b2fd4b..228fd9a5cb 100644 --- a/samples/dialogs/dialogs.h +++ b/samples/dialogs/dialogs.h @@ -35,6 +35,7 @@ class MyFrame: public wxFrame void FileOpen(wxCommandEvent& event); void FileSave(wxCommandEvent& event); void DirChoose(wxCommandEvent& event); + void ShowTip(wxCommandEvent& event); #if !defined(__WXMSW__) || wxTEST_GENERIC_DIALOGS_IN_MSW void ChooseColourGeneric(wxCommandEvent& event); @@ -67,6 +68,7 @@ DECLARE_EVENT_TABLE() #define DIALOGS_FILE_OPEN 8 #define DIALOGS_FILE_SAVE 9 #define DIALOGS_DIR_CHOOSE 10 +#define DIALOGS_TIP 11 #endif diff --git a/samples/dialogs/tips.txt b/samples/dialogs/tips.txt new file mode 100644 index 0000000000..3a019d90e4 --- /dev/null +++ b/samples/dialogs/tips.txt @@ -0,0 +1,5 @@ +Startup tips are documented in "Startup tips overview" section of wxWindows documentation. +This is the first tip! +And this is another great tip... +And here is a very very very very very very very very very very very long one. +If you have something useful to add to this file, please do. diff --git a/samples/dnd/dnd.cpp b/samples/dnd/dnd.cpp index 6a42410921..0b3e1c894f 100644 --- a/samples/dnd/dnd.cpp +++ b/samples/dnd/dnd.cpp @@ -9,29 +9,31 @@ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// -#include +#include "wx/wxprec.h" #ifdef __BORLANDC__ #pragma hdrstop #endif #ifndef WX_PRECOMP -#include +#include "wx/wx.h" #endif -#include -#include +#include "wx/intl.h" +#include "wx/log.h" -#include +#include "wx/dnd.h" #ifdef __WXMOTIF__ -#error Sorry, drag and drop is not yet implemented on wxMotif. + #error Sorry, drag and drop is not yet implemented on wxMotif. #endif #if defined(__WXGTK__) || defined(__WXMOTIF__) -#include "mondrian.xpm" + #include "mondrian.xpm" #endif +#include "wx/clipbrd.h" + // ---------------------------------------------------------------------------- // Derive two simple classes which just put in the listbox the strings (text or // file names) we drop on them @@ -47,24 +49,25 @@ class DnDText : public wxTextDropTarget { public: - DnDText(wxListBox *pOwner) { m_pOwner = pOwner; } + DnDText(wxListBox *pOwner) { m_pOwner = pOwner; } - virtual bool OnDropText(wxDropPointCoord x, wxDropPointCoord y, const wxChar* psz ); + virtual bool OnDropText(wxDropPointCoord x, wxDropPointCoord y, + const wxChar* psz); private: - wxListBox *m_pOwner; + wxListBox *m_pOwner; }; class DnDFile : public wxFileDropTarget { public: - DnDFile(wxListBox *pOwner) { m_pOwner = pOwner; } + DnDFile(wxListBox *pOwner) { m_pOwner = pOwner; } virtual bool OnDropFiles(wxDropPointCoord x, wxDropPointCoord y, size_t nFiles, const wxChar* const aszFiles[] ); private: - wxListBox *m_pOwner; + wxListBox *m_pOwner; }; // ---------------------------------------------------------------------------- @@ -74,7 +77,7 @@ private: class DnDApp : public wxApp { public: - bool OnInit(); + bool OnInit(); }; IMPLEMENT_APP(DnDApp); @@ -85,29 +88,31 @@ IMPLEMENT_APP(DnDApp); class DnDFrame : public wxFrame { public: - DnDFrame(wxFrame *frame, char *title, int x, int y, int w, int h); - ~DnDFrame(); + DnDFrame(wxFrame *frame, char *title, int x, int y, int w, int h); + ~DnDFrame(); - void OnPaint(wxPaintEvent& event); - void OnQuit (wxCommandEvent& event); - void OnAbout(wxCommandEvent& event); - void OnDrag (wxCommandEvent& event); - void OnHelp (wxCommandEvent& event); - void OnLogClear(wxCommandEvent& event); + void OnPaint(wxPaintEvent& event); + void OnQuit (wxCommandEvent& event); + void OnAbout(wxCommandEvent& event); + void OnDrag (wxCommandEvent& event); + void OnHelp (wxCommandEvent& event); + void OnLogClear(wxCommandEvent& event); + void OnCopy(wxCommandEvent& event); + void OnPaste(wxCommandEvent& event); - void OnLeftDown(wxMouseEvent& event); - void OnRightDown(wxMouseEvent& event); + void OnLeftDown(wxMouseEvent& event); + void OnRightDown(wxMouseEvent& event); - DECLARE_EVENT_TABLE() + DECLARE_EVENT_TABLE() private: - wxListBox *m_ctrlFile, - *m_ctrlText; - wxTextCtrl *m_ctrlLog; + wxListBox *m_ctrlFile, + *m_ctrlText; + wxTextCtrl *m_ctrlLog; - wxLog *m_pLog, *m_pLogPrev; + wxLog *m_pLog, *m_pLogPrev; - wxString m_strText; + wxString m_strText; }; // ---------------------------------------------------------------------------- @@ -116,37 +121,43 @@ private: enum { - Menu_Quit = 1, - Menu_Drag, - Menu_About = 101, - Menu_Help, - Menu_Clear, + Menu_Quit = 1, + Menu_Drag, + Menu_About = 101, + Menu_Help, + Menu_Clear, + Menu_Copy, + Menu_Paste }; BEGIN_EVENT_TABLE(DnDFrame, wxFrame) - EVT_MENU(Menu_Quit, DnDFrame::OnQuit) - EVT_MENU(Menu_About, DnDFrame::OnAbout) - EVT_MENU(Menu_Drag, DnDFrame::OnDrag) - EVT_MENU(Menu_Help, DnDFrame::OnHelp) - EVT_MENU(Menu_Clear, DnDFrame::OnLogClear) - EVT_LEFT_DOWN( DnDFrame::OnLeftDown) - EVT_RIGHT_DOWN( DnDFrame::OnRightDown) - EVT_PAINT( DnDFrame::OnPaint) + EVT_MENU(Menu_Quit, DnDFrame::OnQuit) + EVT_MENU(Menu_About, DnDFrame::OnAbout) + EVT_MENU(Menu_Drag, DnDFrame::OnDrag) + EVT_MENU(Menu_Help, DnDFrame::OnHelp) + EVT_MENU(Menu_Clear, DnDFrame::OnLogClear) + EVT_MENU(Menu_Copy, DnDFrame::OnCopy) + EVT_MENU(Menu_Paste, DnDFrame::OnPaste) + + EVT_LEFT_DOWN( DnDFrame::OnLeftDown) + EVT_RIGHT_DOWN( DnDFrame::OnRightDown) + EVT_PAINT( DnDFrame::OnPaint) END_EVENT_TABLE() -// `Main program' equivalent, creating windows and returning main app frame + // `Main program' equivalent, creating windows and returning main app frame bool DnDApp::OnInit() { - // create the main frame window - DnDFrame *frame = new DnDFrame((wxFrame *) NULL, "Drag & Drop wxWindows App", - 50, 50, 450, 340); + // create the main frame window + DnDFrame *frame = new DnDFrame((wxFrame *) NULL, + "Drag-and-Drop/Clipboard wxWindows Sample", + 50, 50, 450, 340); - // activate it - frame->Show(TRUE); + // activate it + frame->Show(TRUE); - SetTopWindow(frame); + SetTopWindow(frame); - return TRUE; + return TRUE; } DnDFrame::DnDFrame(wxFrame *frame, char *title, int x, int y, int w, int h) @@ -154,13 +165,83 @@ DnDFrame::DnDFrame(wxFrame *frame, char *title, int x, int y, int w, int h) m_strText("wxWindows drag & drop works :-)") { -// SetBackgroundColour(* wxWHITE); - - // frame icon and status bar - SetIcon(wxICON(mondrian)); - -// const int widths[] = { -1 }; - CreateStatusBar(); + // frame icon and status bar + SetIcon(wxICON(mondrian)); + + CreateStatusBar(); + + // construct menu + wxMenu *file_menu = new wxMenu; + file_menu->Append(Menu_Drag, "&Test drag..."); + file_menu->AppendSeparator(); + file_menu->Append(Menu_Quit, "E&xit"); + + wxMenu *log_menu = new wxMenu; + log_menu->Append(Menu_Clear, "Clear"); + + wxMenu *help_menu = new wxMenu; + help_menu->Append(Menu_Help, "&Help..."); + help_menu->AppendSeparator(); + help_menu->Append(Menu_About, "&About"); + + wxMenu *clip_menu = new wxMenu; + clip_menu->Append(Menu_Copy, "&Copy\tCtrl+C"); + clip_menu->Append(Menu_Paste, "&Paste\tCtrl+V"); + + wxMenuBar *menu_bar = new wxMenuBar; + menu_bar->Append(file_menu, "&File"); + menu_bar->Append(log_menu, "&Log"); + menu_bar->Append(clip_menu, "&Clipboard"); + menu_bar->Append(help_menu, "&Help"); + + SetMenuBar(menu_bar); + + // make a panel with 3 subwindows + wxPoint pos(0, 0); + wxSize size(400, 200); + + wxString strFile("Drop files here!"), strText("Drop text on me"); + + m_ctrlFile = new wxListBox(this, -1, pos, size, 1, &strFile, wxLB_HSCROLL); + m_ctrlText = new wxListBox(this, -1, pos, size, 1, &strText, wxLB_HSCROLL); + + m_ctrlLog = new wxTextCtrl(this, -1, "", pos, size, + wxTE_MULTILINE | wxTE_READONLY | + wxSUNKEN_BORDER ); + + // redirect log messages to the text window (don't forget to delete it!) + m_pLog = new wxLogTextCtrl(m_ctrlLog); + m_pLogPrev = wxLog::SetActiveTarget(m_pLog); + + // associate drop targets with 2 text controls + m_ctrlFile->SetDropTarget(new DnDFile(m_ctrlFile)); + m_ctrlText->SetDropTarget( new DnDText(m_ctrlText) ); + + wxLayoutConstraints *c; + + // Top-left listbox + c = new wxLayoutConstraints; + c->left.SameAs(this, wxLeft); + c->top.SameAs(this, wxTop); + c->right.PercentOf(this, wxRight, 50); + c->height.PercentOf(this, wxHeight, 40); + m_ctrlFile->SetConstraints(c); + + // Top-right listbox + c = new wxLayoutConstraints; + c->left.SameAs (m_ctrlFile, wxRight); + c->top.SameAs (this, wxTop); + c->right.SameAs (this, wxRight); + c->height.PercentOf(this, wxHeight, 40); + m_ctrlText->SetConstraints(c); + + // Lower text control + c = new wxLayoutConstraints; + c->left.SameAs (this, wxLeft); + c->right.SameAs (this, wxRight); + c->height.PercentOf(this, wxHeight, 40); + c->top.SameAs(m_ctrlText, wxBottom); + m_ctrlLog->SetConstraints(c); // construct menu wxMenu *file_menu = new wxMenu; @@ -235,122 +316,176 @@ DnDFrame::DnDFrame(wxFrame *frame, char *title, int x, int y, int w, int h) void DnDFrame::OnQuit(wxCommandEvent& /* event */) { - Close(TRUE); + Close(TRUE); } void DnDFrame::OnPaint(wxPaintEvent& /*event*/) { - int w = 0; - int h = 0; - GetClientSize( &w, &h ); + int w = 0; + int h = 0; + GetClientSize( &w, &h ); - wxPaintDC dc(this); - dc.SetFont( wxFont( 24, wxDECORATIVE, wxNORMAL, wxNORMAL, FALSE, "charter" ) ); - dc.DrawText( "Drag text from here!", 20, h-35 ); + wxPaintDC dc(this); + dc.SetFont( wxFont( 24, wxDECORATIVE, wxNORMAL, wxNORMAL, FALSE, "charter" ) ); + dc.DrawText( "Drag text from here!", 20, h-35 ); } void DnDFrame::OnDrag(wxCommandEvent& /* event */) { - wxString strText = wxGetTextFromUser - ( - "After you enter text in this dialog, press any mouse\n" - "button in the bottom (empty) part of the frame and \n" - "drag it anywhere - you will be in fact dragging the\n" - "text object containing this text", - "Please enter some text", m_strText, this - ); - - m_strText = strText; + wxString strText = wxGetTextFromUser + ( + "After you enter text in this dialog, press any mouse\n" + "button in the bottom (empty) part of the frame and \n" + "drag it anywhere - you will be in fact dragging the\n" + "text object containing this text", + "Please enter some text", m_strText, this + ); + + m_strText = strText; } void DnDFrame::OnAbout(wxCommandEvent& /* event */) { - wxMessageDialog dialog(this, - "Drag-&-Drop Demo\n" - "Please see \"Help|Help...\" for details\n" - "Copyright (c) 1998 Vadim Zeitlin", - "About wxDnD"); - - dialog.ShowModal(); + wxMessageBox("Drag-&-Drop Demo\n" + "Please see \"Help|Help...\" for details\n" + "Copyright (c) 1998 Vadim Zeitlin", + "About wxDnD", + wxICON_INFORMATION | wxOK, + this); } void DnDFrame::OnHelp(wxCommandEvent& /* event */) { - wxMessageDialog dialog(this, -"This small program demonstrates drag & drop support in wxWindows. The program window\n" -"consists of 3 parts: the bottom pane is for debug messages, so that you can see what's\n" -"going on inside. The top part is split into 2 listboxes, the left one accepts files\n" -"and the right one accepts text.\n" -"\n" -"To test wxDropTarget: open wordpad (write.exe), select some text in it and drag it to\n" -"the right listbox (you'll notice the usual visual feedback, i.e. the cursor will change).\n" -"Also, try dragging some files (you can select several at once) from Windows Explorer (or \n" -"File Manager) to the left pane. Hold down Ctrl/Shift keys when you drop text (doesn't \n" -"work with files) and see what changes.\n" -"\n" -"To test wxDropSource: just press any mouse button on the empty zone of the window and drag\n" -"it to wordpad or any other droptarget accepting text (and of course you can just drag it\n" -"to the right pane). Due to a lot of trace messages, the cursor might take some time to \n" -"change, don't release the mouse button until it does. You can change the string being\n" -"dragged in in \"File|Test drag...\" dialog.\n" -"\n" -"\n" -"Please send all questions/bug reports/suggestions &c to \n" -"Vadim Zeitlin ", - "wxDnD Help"); - - dialog.ShowModal(); + wxMessageDialog dialog(this, + "This small program demonstrates drag & drop support in wxWindows. The program window\n" + "consists of 3 parts: the bottom pane is for debug messages, so that you can see what's\n" + "going on inside. The top part is split into 2 listboxes, the left one accepts files\n" + "and the right one accepts text.\n" + "\n" + "To test wxDropTarget: open wordpad (write.exe), select some text in it and drag it to\n" + "the right listbox (you'll notice the usual visual feedback, i.e. the cursor will change).\n" + "Also, try dragging some files (you can select several at once) from Windows Explorer (or \n" + "File Manager) to the left pane. Hold down Ctrl/Shift keys when you drop text (doesn't \n" + "work with files) and see what changes.\n" + "\n" + "To test wxDropSource: just press any mouse button on the empty zone of the window and drag\n" + "it to wordpad or any other droptarget accepting text (and of course you can just drag it\n" + "to the right pane). Due to a lot of trace messages, the cursor might take some time to \n" + "change, don't release the mouse button until it does. You can change the string being\n" + "dragged in in \"File|Test drag...\" dialog.\n" + "\n" + "\n" + "Please send all questions/bug reports/suggestions &c to \n" + "Vadim Zeitlin ", + "wxDnD Help"); + + dialog.ShowModal(); } void DnDFrame::OnLogClear(wxCommandEvent& /* event */ ) { - m_ctrlLog->Clear(); + m_ctrlLog->Clear(); } void DnDFrame::OnLeftDown(wxMouseEvent &WXUNUSED(event) ) { - if ( !m_strText.IsEmpty() ) - { - // start drag operation + if ( !m_strText.IsEmpty() ) + { + // start drag operation #ifdef __WXMSW__ - wxTextDataObject textData(m_strText); - wxDropSource dragSource( textData, this ); + wxTextDataObject textData(m_strText); + wxDropSource dragSource( textData, this ); #else - wxDropSource dragSource( new wxTextDataObject (m_strText), this, wxIcon(mondrian_xpm) ); + wxDropSource dragSource( new wxTextDataObject (m_strText), this, wxIcon(mondrian_xpm) ); #endif - const char *pc; - - switch ( dragSource.DoDragDrop(TRUE) ) - { - case wxDragError: pc = "Error!"; break; - case wxDragNone: pc = "Nothing"; break; - case wxDragCopy: pc = "Copied"; break; - case wxDragMove: pc = "Moved"; break; - case wxDragCancel: pc = "Cancelled"; break; - default: pc = "Huh?"; break; + const char *pc; + + switch ( dragSource.DoDragDrop(TRUE) ) + { + case wxDragError: pc = "Error!"; break; + case wxDragNone: pc = "Nothing"; break; + case wxDragCopy: pc = "Copied"; break; + case wxDragMove: pc = "Moved"; break; + case wxDragCancel: pc = "Cancelled"; break; + default: pc = "Huh?"; break; + } + + SetStatusText(wxString("Drag result: ") + pc); } - - SetStatusText(wxString("Drag result: ") + pc); - } } void DnDFrame::OnRightDown(wxMouseEvent &event ) { - wxMenu *menu = new wxMenu; + wxMenu *menu = new wxMenu; - menu->Append(Menu_Drag, "&Test drag..."); - menu->Append(Menu_About, "&About"); - menu->Append(Menu_Quit, "E&xit"); + menu->Append(Menu_Drag, "&Test drag..."); + menu->Append(Menu_About, "&About"); + menu->Append(Menu_Quit, "E&xit"); - PopupMenu( menu, event.GetX(), event.GetY() ); + PopupMenu( menu, event.GetX(), event.GetY() ); } DnDFrame::~DnDFrame() { - if ( m_pLog != NULL ) { - if ( wxLog::SetActiveTarget(m_pLogPrev) == m_pLog ) - delete m_pLog; - } + if ( m_pLog != NULL ) { + if ( wxLog::SetActiveTarget(m_pLogPrev) == m_pLog ) + delete m_pLog; + } +} + +// --------------------------------------------------------------------------- +// clipboard +// --------------------------------------------------------------------------- + +void DnDFrame::OnCopy(wxCommandEvent& WXUNUSED(event)) +{ + if ( !wxTheClipboard->Open() ) + { + wxLogError("Can't open clipboard."); + + return; + } + + if ( !wxTheClipboard->AddData(new wxTextDataObject(m_strText)) ) + { + wxLogError("Can't copy data to the clipboard"); + } + else + { + wxLogMessage("Text '%s' put on the clipboard", m_strText.c_str()); + } + + wxTheClipboard->Close(); +} + +void DnDFrame::OnPaste(wxCommandEvent& WXUNUSED(event)) +{ + if ( !wxTheClipboard->Open() ) + { + wxLogError("Can't open clipboard."); + + return; + } + + if ( !wxTheClipboard->IsSupported(wxDF_TEXT) ) + { + wxLogWarning("No text data on clipboard"); + + return; + } + + wxTextDataObject text; + if ( !wxTheClipboard->GetData(&text) ) + { + wxLogError("Can't paste data from the clipboard"); + } + else + { + wxLogMessage("Text '%s' pasted from the clipboard", + text.GetText().c_str()); + } + + wxTheClipboard->Close(); } // ---------------------------------------------------------------------------- @@ -358,20 +493,20 @@ DnDFrame::~DnDFrame() // ---------------------------------------------------------------------------- bool DnDText::OnDropText( wxDropPointCoord, wxDropPointCoord, const wxChar *psz ) { - m_pOwner->Append(psz); + m_pOwner->Append(psz); - return TRUE; + return TRUE; } bool DnDFile::OnDropFiles( wxDropPointCoord, wxDropPointCoord, size_t nFiles, const wxChar* const aszFiles[]) { - wxString str; - str.Printf( _T("%d files dropped"), nFiles); - m_pOwner->Append(str); - for ( size_t n = 0; n < nFiles; n++ ) { - m_pOwner->Append(aszFiles[n]); - } - - return TRUE; + wxString str; + str.Printf( _T("%d files dropped"), nFiles); + m_pOwner->Append(str); + for ( size_t n = 0; n < nFiles; n++ ) { + m_pOwner->Append(aszFiles[n]); + } + + return TRUE; } diff --git a/samples/listctrl/listtest.cpp b/samples/listctrl/listtest.cpp index acdf26adfd..a0d52fffd1 100644 --- a/samples/listctrl/listtest.cpp +++ b/samples/listctrl/listtest.cpp @@ -235,6 +235,7 @@ void MyFrame::OnListView(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnReportView(wxCommandEvent& WXUNUSED(event)) { m_listCtrl->DeleteAllItems(); + m_listCtrl->DeleteAllColumns(); m_logWindow->Clear(); m_listCtrl->SetSingleStyle(wxLC_REPORT); diff --git a/samples/minimal/minimal.cpp b/samples/minimal/minimal.cpp index cf8bd0166f..eb11895509 100644 --- a/samples/minimal/minimal.cpp +++ b/samples/minimal/minimal.cpp @@ -69,6 +69,9 @@ public: // event handlers (these functions should _not_ be virtual) void OnQuit(wxCommandEvent& event); void OnAbout(wxCommandEvent& event); + void OnTest(wxCommandEvent& event); + + void OnPaint(wxPaintEvent& event); private: // any class wishing to process wxWindows events must use this macro @@ -85,8 +88,7 @@ enum // menu items Minimal_Quit = 1, Minimal_About, - Minimal_Test1, - Minimal_Test2, + Minimal_Test, // controls start here (the numbers are, of course, arbitrary) Minimal_Text = 1000, @@ -102,6 +104,10 @@ enum BEGIN_EVENT_TABLE(MyFrame, wxFrame) EVT_MENU(Minimal_Quit, MyFrame::OnQuit) EVT_MENU(Minimal_About, MyFrame::OnAbout) + + EVT_BUTTON(-1, MyFrame::OnTest) + + EVT_PAINT(MyFrame::OnPaint) END_EVENT_TABLE() // Create a new application object: this macro will allow wxWindows to create @@ -163,9 +169,11 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size) // ... and attach this menu bar to the frame SetMenuBar(menuBar); +#if wxUSE_STATUSBAR // create a status bar just for fun (by default with 1 pane only) CreateStatusBar(2); SetStatusText("Welcome to wxWindows!"); +#endif // wxUSE_STATUSBAR } @@ -193,3 +201,28 @@ void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event)) wxMessageBox(msg, "About Minimal", wxOK | wxICON_INFORMATION, this); } + +void MyFrame::OnTest(wxCommandEvent& event) +{ +} + +void MyFrame::OnPaint(wxPaintEvent& event) +{ + wxPaintDC dc(this); + + wxMemoryDC dcMem; + wxSize size(GetClientSize()); + dcMem.SelectObject(wxBitmap(size.x, size.y, -1)); + + dcMem.SetBackground(wxBrush(wxColour(0, 0, 255), wxSOLID)); + dcMem.SetTextForeground(wxColour(0, 255, 0)); + dcMem.SetTextBackground(wxColour(0, 0, 0)); + dcMem.SetBackgroundMode(wxSOLID); + dcMem.Clear(); + dcMem.DrawText("Hello, wxWindows!", 10, 10); + + wxPoint ptOrig(0, 0); + dc.Blit(ptOrig, size, &dcMem, ptOrig); + + dcMem.SelectObject(wxNullBitmap); +} diff --git a/samples/richedit/wxLayout.cpp b/samples/richedit/wxLayout.cpp index 017193f635..86532e650e 100644 --- a/samples/richedit/wxLayout.cpp +++ b/samples/richedit/wxLayout.cpp @@ -238,7 +238,7 @@ MyFrame::AddSampleText(wxLayoutList *llist) void MyFrame::Clear(void) { - wxColour colBg(0, 255, 255); + wxColour colBg(0, 0, 0); m_lwin->Clear(wxROMAN,16,wxNORMAL,wxNORMAL, false, wxRED, &colBg); } diff --git a/src/generic/choicdgg.cpp b/src/generic/choicdgg.cpp index 25483ca765..0ff03ba0b0 100644 --- a/src/generic/choicdgg.cpp +++ b/src/generic/choicdgg.cpp @@ -28,21 +28,19 @@ #include "wx/listbox.h" #include "wx/stattext.h" #include "wx/intl.h" - #include "wx/dcclient.h" - #include "wx/settings.h" #endif #if wxUSE_STATLINE - #include "wx/statline.h" + #include "wx/statline.h" #endif #include "wx/generic/choicdgg.h" #define wxID_LISTBOX 3000 -wxString wxGetSingleChoice( const wxString& message, const wxString& caption, int n, +wxString wxGetSingleChoice( const wxString& message, const wxString& caption, int n, const wxString *choices, wxWindow *parent, - int WXUNUSED(x), int WXUNUSED(y), bool WXUNUSED(centre), + int WXUNUSED(x), int WXUNUSED(y), bool WXUNUSED(centre), int WXUNUSED(width), int WXUNUSED(height) ) { wxSingleChoiceDialog dialog(parent, message, caption, n, choices); @@ -53,9 +51,9 @@ wxString wxGetSingleChoice( const wxString& message, const wxString& caption, in } // Overloaded for backward compatibility -wxString wxGetSingleChoice( const wxString& message, const wxString& caption, int n, +wxString wxGetSingleChoice( const wxString& message, const wxString& caption, int n, char *choices[], wxWindow *parent, - int x, int y, bool centre, + int x, int y, bool centre, int width, int height ) { wxString *strings = new wxString[n]; @@ -70,9 +68,9 @@ wxString wxGetSingleChoice( const wxString& message, const wxString& caption, in return ans; } -int wxGetSingleChoiceIndex( const wxString& message, const wxString& caption, int n, +int wxGetSingleChoiceIndex( const wxString& message, const wxString& caption, int n, const wxString *choices, wxWindow *parent, - int WXUNUSED(x), int WXUNUSED(y), bool WXUNUSED(centre), + int WXUNUSED(x), int WXUNUSED(y), bool WXUNUSED(centre), int WXUNUSED(width), int WXUNUSED(height) ) { wxSingleChoiceDialog dialog(parent, message, caption, n, choices); @@ -83,9 +81,9 @@ int wxGetSingleChoiceIndex( const wxString& message, const wxString& caption, in } // Overloaded for backward compatibility -int wxGetSingleChoiceIndex( const wxString& message, const wxString& caption, int n, +int wxGetSingleChoiceIndex( const wxString& message, const wxString& caption, int n, wxChar *choices[], wxWindow *parent, - int x, int y, bool centre, + int x, int y, bool centre, int width, int height ) { wxString *strings = new wxString[n]; @@ -99,7 +97,7 @@ int wxGetSingleChoiceIndex( const wxString& message, const wxString& caption, in wxChar *wxGetSingleChoiceData( const wxString& message, const wxString& caption, int n, const wxString *choices, wxChar **client_data, wxWindow *parent, - int WXUNUSED(x), int WXUNUSED(y), bool WXUNUSED(centre), + int WXUNUSED(x), int WXUNUSED(y), bool WXUNUSED(centre), int WXUNUSED(width), int WXUNUSED(height) ) { wxSingleChoiceDialog dialog(parent, message, caption, n, choices, client_data); @@ -110,9 +108,9 @@ wxChar *wxGetSingleChoiceData( const wxString& message, const wxString& caption, } // Overloaded for backward compatibility -wxChar *wxGetSingleChoiceData( const wxString& message, const wxString& caption, int n, +wxChar *wxGetSingleChoiceData( const wxString& message, const wxString& caption, int n, wxChar *choices[], wxChar **client_data, wxWindow *parent, - int x, int y, bool centre, + int x, int y, bool centre, int width, int height ) { wxString *strings = new wxString[n]; @@ -173,7 +171,7 @@ IMPLEMENT_CLASS(wxSingleChoiceDialog, wxDialog) wxSingleChoiceDialog::wxSingleChoiceDialog(wxWindow *parent, const wxString& message, const wxString& caption, - int n, + int n, const wxString *choices, char **clientData, long style, @@ -187,9 +185,9 @@ wxSingleChoiceDialog::wxSingleChoiceDialog(wxWindow *parent, wxSingleChoiceDialog::wxSingleChoiceDialog(wxWindow *parent, const wxString& message, const wxString& caption, - const wxStringList& choices, - wxChar **clientData, - long style, + const wxStringList& choices, + wxChar **clientData, + long style, const wxPoint& pos) : wxDialog(parent, -1, caption, pos, wxDefaultSize, wxCHOICEDLG_DIALOG_STYLE) @@ -217,92 +215,41 @@ bool wxSingleChoiceDialog::Create(wxWindow *parent, } bool wxSingleChoiceDialog::Create( wxWindow *WXUNUSED(parent), - const wxString& message, + const wxString& message, const wxString& WXUNUSED(caption), - int n, + int n, const wxString *choices, char **clientData, long style, const wxPoint& WXUNUSED(pos) ) { - m_dialogStyle = style; m_selection = 0; m_clientData = NULL; - // dialog layout constants - static const int LAYOUT_X_MARGIN = 5; - static const int LAYOUT_Y_MARGIN = 5; - static const int MARGIN_BETWEEN_BUTTONS = 3*LAYOUT_X_MARGIN; - // calc the message size // --------------------- - // TODO this should be factored out to a common function (also used in - // msgdlgg.cpp) - wxClientDC dc(this); - dc.SetFont(wxSystemSettings::GetSystemFont(wxSYS_DEFAULT_GUI_FONT)); - wxArrayString lines; - wxString curLine; - long height, width, heightTextMax = 0, widthTextMax = 0; - for ( const char *pc = message; ; pc++ ) { - if ( *pc == '\n' || *pc == '\0' ) { - dc.GetTextExtent(curLine, &width, &height); - if ( width > widthTextMax ) - widthTextMax = width; - if ( height > heightTextMax ) - heightTextMax = height; - - lines.Add(curLine); - - if ( *pc == '\n' ) { - curLine.Empty(); - } - else { - // the end of string - break; - } - } - else { - curLine += *pc; - } - } - + wxSize sizeText = SplitTextMessage(message, &lines); + long heightTextMax = sizeText.GetHeight(), + widthTextMax = sizeText.GetWidth(); size_t nLineCount = lines.Count(); long hTotalMsg = heightTextMax*nLineCount; // calc the button size // -------------------- - bool hasCancel = FALSE; - // always create the OK button - the code below supposes we do have buttons // and besides the user should have some way to close this dialog wxASSERT_MSG( style & wxOK, _T("this dialog should have OK button") ); - wxString labelOk(_("OK")); - long wButton = 0; - dc.GetTextExtent(labelOk, &width, NULL); - if ( width > wButton ) - wButton = width; + bool hasCancel = (style & wxCANCEL) != 0; - wxString labelCancel; - if ( style & wxCANCEL ) - { - labelCancel = _("Cancel"); - dc.GetTextExtent(labelCancel, &width, NULL); - if ( width > wButton ) - wButton = width; + wxSize sizeButtons = GetStandardButtonSize(hasCancel); - hasCancel = TRUE; - } - - if ( wButton < 75 ) - wButton = 75; - else - wButton += 10; + long wButton = sizeButtons.GetWidth(), + hButton = sizeButtons.GetHeight(); - long hButton = wButton*23/75; long wTotalButtons = wButton; if ( hasCancel ) { @@ -321,8 +268,7 @@ bool wxSingleChoiceDialog::Create( wxWindow *WXUNUSED(parent), wListbox = wxMax(300, wxMax(wTotalButtons, widthTextMax)); #if wxUSE_STATLINE - // arbitrary... - long hStatLine = 5; + long hStatLine = wxStaticLine::GetDefaultSize(); #endif // now the complete dialog size @@ -362,7 +308,7 @@ bool wxSingleChoiceDialog::Create( wxWindow *WXUNUSED(parent), // listbox m_listbox = new wxListBox( this, wxID_LISTBOX, wxPoint(2*LAYOUT_X_MARGIN, y), - wxSize(wListbox, hListbox), + wxSize(wListbox, hListbox), n, choices, wxLB_HSCROLL); y += hListbox; @@ -376,41 +322,17 @@ bool wxSingleChoiceDialog::Create( wxWindow *WXUNUSED(parent), // separator line #if wxUSE_STATLINE (void) new wxStaticLine( this, -1, - wxPoint(0, y + LAYOUT_Y_MARGIN), - wxSize(wDialog, hStatLine) ); + wxPoint(2*LAYOUT_X_MARGIN, y + LAYOUT_Y_MARGIN), + wxSize(wDialog - 4*LAYOUT_X_MARGIN, hStatLine) ); y += LAYOUT_Y_MARGIN + hStatLine; #endif - + // buttons y += 2*LAYOUT_X_MARGIN; - // NB: create [Ok] first to get the right tab order - - wxButton *ok = (wxButton *) NULL; - wxButton *cancel = (wxButton *) NULL; - - long x = wDialog / 2; - if ( hasCancel ) - x -= MARGIN_BETWEEN_BUTTONS / 2 + wButton; - else - x -= wButton / 2; - - ok = new wxButton( this, wxID_OK, labelOk, - wxPoint(x, y), - wxSize(wButton, hButton) ); - - if ( hasCancel ) - { - x += MARGIN_BETWEEN_BUTTONS + wButton; - cancel = new wxButton( this, wxID_CANCEL, labelCancel, - wxPoint(x, y), - wxSize(wButton, hButton) ); - } - - ok->SetDefault(); - ok->SetFocus(); + CreateStandardButtons(wDialog, y, wButton, hButton, hasCancel); SetClientSize( wDialog, hDialog ); diff --git a/src/generic/msgdlgg.cpp b/src/generic/msgdlgg.cpp index 0b8eea5424..968cd11290 100644 --- a/src/generic/msgdlgg.cpp +++ b/src/generic/msgdlgg.cpp @@ -6,7 +6,7 @@ // Created: 04/01/98 // RCS-ID: $Id$ // Copyright: (c) Julian Smart, Markus Holzem, Robert Roebling -// Licence: wxWindows license +// Licence: wxWindows license ///////////////////////////////////////////////////////////////////////////// #ifdef __GNUG__ @@ -21,15 +21,15 @@ #endif #ifndef WX_PRECOMP - #include "wx/utils.h" - #include "wx/dialog.h" - #include "wx/button.h" - #include "wx/stattext.h" - #include "wx/statbmp.h" - #include "wx/layout.h" - #include "wx/intl.h" - #include "wx/dcclient.h" - #include "wx/settings.h" + #include "wx/utils.h" + #include "wx/dialog.h" + #include "wx/button.h" + #include "wx/stattext.h" + #include "wx/statbmp.h" + #include "wx/layout.h" + #include "wx/intl.h" + #include "wx/dcclient.h" + #include "wx/settings.h" #endif #include @@ -71,9 +71,6 @@ wxGenericMessageDialog::wxGenericMessageDialog( wxWindow *parent, const wxPoint& pos) : wxDialog( parent, -1, caption, pos, wxDefaultSize, wxDEFAULT_DIALOG_STYLE ) { - static const int LAYOUT_X_MARGIN = 5; - static const int LAYOUT_Y_MARGIN = 5; - m_dialogStyle = style; wxBeginBusyCursor(); @@ -122,34 +119,12 @@ wxGenericMessageDialog::wxGenericMessageDialog( wxWindow *parent, // split the message in lines // -------------------------- - wxClientDC dc(this); - dc.SetFont(wxSystemSettings::GetSystemFont(wxSYS_DEFAULT_GUI_FONT)); wxArrayString lines; - wxString curLine; - long height, width, heightTextMax = 0, widthTextMax = 0; - for ( const char *pc = message; ; pc++ ) { - if ( *pc == '\n' || *pc == '\0' ) { - dc.GetTextExtent(curLine, &width, &height); - if ( width > widthTextMax ) - widthTextMax = width; - if ( height > heightTextMax ) - heightTextMax = height; - - lines.Add(curLine); - - if ( *pc == '\n' ) { - curLine.Empty(); - } - else { - // the end of string - break; - } - } - else { - curLine += *pc; - } - } + wxSize sizeText = SplitTextMessage(message, &lines); + long widthTextMax = sizeText.GetWidth(), + heightTextMax = sizeText.GetHeight(); + size_t nLineCount = lines.GetCount(); // calculate the total dialog size enum @@ -194,7 +169,7 @@ wxGenericMessageDialog::wxGenericMessageDialog( wxWindow *parent, // get the longest caption and also calc the number of buttons size_t nBtn, nButtons = 0; - long widthBtnMax = 0; + long width, widthBtnMax = 0; for ( nBtn = 0; nBtn < Btn_Max; nBtn++ ) { if ( buttons[nBtn] ) { nButtons++; @@ -215,8 +190,6 @@ wxGenericMessageDialog::wxGenericMessageDialog( wxWindow *parent, heightTextMax *= 12; heightTextMax /= 10; - size_t nLineCount = lines.Count(); - long widthButtonsTotal = nButtons * (widthBtnMax + LAYOUT_X_MARGIN) - LAYOUT_X_MARGIN; diff --git a/src/generic/progdlgg.cpp b/src/generic/progdlgg.cpp index 801ef396ea..cad525d1d3 100644 --- a/src/generic/progdlgg.cpp +++ b/src/generic/progdlgg.cpp @@ -174,10 +174,7 @@ wxProgressDialog::wxProgressDialog(wxString const &title, m_btnAbort = new wxButton(this, -1, _("Cancel")); c = new wxLayoutConstraints; c->centreX.SameAs(this, wxCentreX); - if(lastWindow) - c->top.Below(lastWindow, 2*LAYOUT_Y_MARGIN); - else - c->top.Below(m_btnAbort, 2*LAYOUT_Y_MARGIN); + c->top.Below(lastWindow, 2*LAYOUT_Y_MARGIN); c->width.AsIs(); c->height.AsIs(); m_btnAbort->SetConstraints(c); @@ -194,9 +191,8 @@ wxProgressDialog::wxProgressDialog(wxString const &title, // wide under Windows, so try to find a reasonable value for the width, not // too big and not too small wxSize size = GetClientSize(); - size.x = 2*widthText; - if ( size.x < 2*size.y ) - SetClientSize(2*size.y, size.y); + size.x = wxMax(3*widthText/2, 2*size.y); + SetClientSize(size); Show(TRUE); Centre(wxCENTER_FRAME | wxBOTH); @@ -235,18 +231,18 @@ wxProgressDialog::Update(int value, const wxString& newmsg) if (m_elapsed) { - s.Printf("%i:%02i:%02i", diff.GetHour(), diff.GetMinute(), diff.GetSecond()); - if (s != m_elapsed->GetLabel()) m_elapsed->SetLabel(s); + s.Printf("%i:%02i:%02i", diff.GetHour(), diff.GetMinute(), diff.GetSecond()); + if (s != m_elapsed->GetLabel()) m_elapsed->SetLabel(s); } if (m_estimated) { - s.Printf("%i:%02i:%02i", estim / (60 * 60), (estim / 60) % 60, estim % 60); - if (s != m_estimated->GetLabel()) m_estimated->SetLabel(s); + s.Printf("%i:%02i:%02i", estim / (60 * 60), (estim / 60) % 60, estim % 60); + if (s != m_estimated->GetLabel()) m_estimated->SetLabel(s); } if (m_remaining) { - s.Printf("%i:%02i:%02i", remai / (60 * 60), (remai / 60) % 60, remai % 60); - if (s != m_remaining->GetLabel()) m_remaining->SetLabel(s); + s.Printf("%i:%02i:%02i", remai / (60 * 60), (remai / 60) % 60, remai % 60); + if (s != m_remaining->GetLabel()) m_remaining->SetLabel(s); } } diff --git a/src/generic/statline.cpp b/src/generic/statline.cpp new file mode 100644 index 0000000000..21ad893852 --- /dev/null +++ b/src/generic/statline.cpp @@ -0,0 +1,61 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: generic/statline.cpp +// Purpose: a generic wxStaticLine class +// Author: Vadim Zeitlin +// Created: 28.06.99 +// Version: $Id$ +// Copyright: (c) 1998 Vadim Zeitlin +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +// ============================================================================ +// declarations +// ============================================================================ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#ifdef __GNUG__ + #pragma implementation "statline.h" +#endif + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#include "wx/statline.h" +#include "wx/statbox.h" + +// ============================================================================ +// implementation +// ============================================================================ + +IMPLEMENT_DYNAMIC_CLASS(wxStaticLine, wxControl) + +// ---------------------------------------------------------------------------- +// wxStaticLine +// ---------------------------------------------------------------------------- + +bool wxStaticLine::Create( wxWindow *parent, + wxWindowID id, + const wxPoint &pos, + const wxSize &size, + long style, + const wxString &name) +{ + if ( !CreateBase(parent, id, pos, size, style, name) ) + return FALSE; + + // ok, this is ugly but it's better than nothing: use a thin static box to + // emulate static line + + wxSize sizeReal = AdjustSize(size); + + m_statbox = new wxStaticBox(parent, id, _T(""), pos, sizeReal, style, name); + + return TRUE; +} diff --git a/src/generic/textdlgg.cpp b/src/generic/textdlgg.cpp index 1c64ac410f..ea9700ee66 100644 --- a/src/generic/textdlgg.cpp +++ b/src/generic/textdlgg.cpp @@ -6,157 +6,132 @@ // Created: 04/01/98 // RCS-ID: $Id$ // Copyright: (c) Julian Smart and Markus Holzem -// Licence: wxWindows license +// Licence: wxWindows license ///////////////////////////////////////////////////////////////////////////// +// ============================================================================ +// declarations +// ============================================================================ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + #ifdef __GNUG__ -#pragma implementation "textdlgg.h" + #pragma implementation "textdlgg.h" #endif // For compilers that support precompilation, includes "wx.h". #include "wx/wxprec.h" #ifdef __BORLANDC__ -#pragma hdrstop + #pragma hdrstop #endif #ifndef WX_PRECOMP - #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" + #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" + #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 (size_t 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); -} +// ---------------------------------------------------------------------------- +// constants +// ---------------------------------------------------------------------------- + +#define wxID_TEXT 3000 +// ============================================================================ +// implementation +// ============================================================================ + +// ---------------------------------------------------------------------------- // wxTextEntryDialog +// ---------------------------------------------------------------------------- #if !USE_SHARED_LIBRARY BEGIN_EVENT_TABLE(wxTextEntryDialog, wxDialog) - EVT_BUTTON(wxID_OK, wxTextEntryDialog::OnOK) + EVT_BUTTON(wxID_OK, wxTextEntryDialog::OnOK) END_EVENT_TABLE() IMPLEMENT_CLASS(wxTextEntryDialog, wxDialog) #endif -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) +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), + m_value(value) { - m_dialogStyle = style; - m_value = value; + // calculate the sizes + // ------------------- - wxBeginBusyCursor(); + wxArrayString lines; + wxSize sizeText = SplitTextMessage(message, &lines); - wxSize message_size( wxSplitMessage2( message, this ) ); + wxSize sizeBtn = GetStandardButtonSize(); - 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; + long wText = wxMax(4*sizeBtn.GetWidth(), sizeText.GetWidth()); + long hText = GetStandardTextHeight(); - if (style & wxOK) - { - ok = new wxButton( this, wxID_OK, _("OK"), wxPoint(-1,y), wxSize(80,-1) ); - m_buttons.Append( ok ); - } + long wDialog = 4*LAYOUT_X_MARGIN + wText; + long hDialog = 2*LAYOUT_Y_MARGIN + + sizeText.GetHeight() * lines.GetCount() + + 2*LAYOUT_Y_MARGIN + + hText + + 2*LAYOUT_Y_MARGIN + + sizeBtn.GetHeight() + + 2*LAYOUT_Y_MARGIN; - if (style & wxCANCEL) - { - cancel = new wxButton( this, wxID_CANCEL, _("Cancel"), wxPoint(-1,y), wxSize(80,-1) ); - m_buttons.Append( cancel ); - } + // create the controls + // ------------------- - if (ok) - { - ok->SetDefault(); - ok->SetFocus(); - } + // message + long x = 2*LAYOUT_X_MARGIN; + long y = CreateTextMessage(lines, + wxPoint(x, 2*LAYOUT_Y_MARGIN), + sizeText); - 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 ); + y += 2*LAYOUT_X_MARGIN; + + // text ctrl + m_textctrl = new wxTextCtrl(this, wxID_TEXT, m_value, + wxPoint(x, y), + wxSize(wText, hText)); + y += hText + 2*LAYOUT_X_MARGIN; - Centre( wxBOTH ); + // and buttons + CreateStandardButtons(wDialog, y, sizeBtn.GetWidth(), sizeBtn.GetHeight()); + // set the dialog size and position + SetClientSize(wDialog, hDialog); + if ( pos == wxDefaultPosition ) + { + // centre the dialog if no explicit position given + Centre(wxBOTH | wxCENTER_FRAME); + } - wxEndBusyCursor(); + m_textctrl->SetFocus(); } void wxTextEntryDialog::OnOK(wxCommandEvent& WXUNUSED(event) ) { - wxTextCtrl *textCtrl = (wxTextCtrl *)FindWindow(wxID_TEXT); - if ( textCtrl ) - m_value = textCtrl->GetValue(); + m_value = m_textctrl->GetValue(); - EndModal(wxID_OK); + EndModal(wxID_OK); } diff --git a/src/generic/tipdlg.cpp b/src/generic/tipdlg.cpp new file mode 100644 index 0000000000..8ea6f3cf6b --- /dev/null +++ b/src/generic/tipdlg.cpp @@ -0,0 +1,260 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: tipdlg.cpp +// Purpose: implementation of wxTipDialog +// Author: Vadim Zeitlin +// Modified by: +// Created: 28.06.99 +// RCS-ID: $Id$ +// Copyright: (c) Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +// ============================================================================ +// declarations +// ============================================================================ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#ifdef __GNUG__ + #pragma implementation "windowbase.h" +#endif + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#if wxUSE_STARTUP_TIPS + +#ifndef WX_PRECOMP + #include "wx/button.h" + #include "wx/checkbox.h" + #include "wx/statbox.h" + #include "wx/statbmp.h" + #include "wx/dialog.h" +#endif // WX_PRECOMP + +#include "wx/statline.h" + +#include "wx/tipdlg.h" + +// ---------------------------------------------------------------------------- +// constants +// ---------------------------------------------------------------------------- + +static const int wxID_NEXT_TIP = -100; // whatever + +// ---------------------------------------------------------------------------- +// private classes +// ---------------------------------------------------------------------------- + +// an implementation which takes the tips from the text file - each line +// represents a tip +class WXDLLEXPORT wxFileTipProvider : public wxTipProvider +{ +public: + wxFileTipProvider(const wxString& filename, size_t currentTip); + + virtual wxString GetTip(); + +private: + wxTextFile m_textfile; +}; + +#ifdef __WIN32__ +// TODO an implementation which takes the tips from the given registry key +class WXDLLEXPORT wxRegTipProvider : public wxTipProvider +{ +public: + wxRegTipProvider(const wxString& keyname); + + virtual wxString GetTip(); +}; +#endif // __WIN32__ + +// the dialog we show in wxShowTip() +class WXDLLEXPORT wxTipDialog : public wxDialog +{ +public: + wxTipDialog(wxWindow *parent, + wxTipProvider *tipProvider, + bool showAtStartup); + + // the tip dialog has "Show tips on startup" checkbox - return TRUE if it + // was checked (or wasn't unchecked) + bool ShowTipsOnStartup() const { return m_checkbox->GetValue(); } + + // sets the (next) tip text + void SetTipText() { m_text->SetValue(m_tipProvider->GetTip()); } + + // "Next" button handler + void OnNextTip(wxCommandEvent& WXUNUSED(event)) { SetTipText(); } + +private: + wxTipProvider *m_tipProvider; + + wxTextCtrl *m_text; + wxCheckBox *m_checkbox; + + DECLARE_EVENT_TABLE() +}; + +// ============================================================================ +// implementation +// ============================================================================ + +// ---------------------------------------------------------------------------- +// wxFileTipProvider +// ---------------------------------------------------------------------------- + +wxFileTipProvider::wxFileTipProvider(const wxString& filename, + size_t currentTip) + : wxTipProvider(currentTip), m_textfile(filename) +{ + m_textfile.Open(); +} + +wxString wxFileTipProvider::GetTip() +{ + size_t count = m_textfile.GetLineCount(); + if ( !count ) + return _("Tips not available, sorry!"); + + // notice that it may be greater, actually, if we remembered it from the + // last time and the number of tips changed + if ( m_currentTip == count ) + { + // wrap + m_currentTip = 0; + } + + return m_textfile.GetLine(m_currentTip++); +} + +// ---------------------------------------------------------------------------- +// wxTipDialog +// ---------------------------------------------------------------------------- + +BEGIN_EVENT_TABLE(wxTipDialog, wxDialog) + EVT_BUTTON(wxID_NEXT_TIP, OnNextTip) +END_EVENT_TABLE() + +wxTipDialog::wxTipDialog(wxWindow *parent, + wxTipProvider *tipProvider, + bool showAtStartup) + : wxDialog(parent, -1, _("Tip of the Day"), + wxDefaultPosition, wxDefaultSize, + wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER) +{ + m_tipProvider = tipProvider; + + wxSize sizeBtn = GetStandardButtonSize(); + wxLayoutConstraints *c; + + // create the controls in the right order, then set the constraints + wxButton *btnClose = new wxButton(this, wxID_CANCEL, _("&Close")); + m_checkbox = new wxCheckBox(this, -1, _("&Show tips at startup")); + wxButton *btnNext = new wxButton(this, wxID_NEXT_TIP, _("&Next")); + + wxTextCtrl *text = new wxTextCtrl(this, -1, _("Did you know..."), + wxDefaultPosition, wxDefaultSize, + wxTE_READONLY | wxNO_BORDER); + text->SetFont(wxFont(18, wxSWISS, wxNORMAL, wxBOLD)); + text->SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_BTNFACE)); + + m_text = new wxTextCtrl(this, -1, _T(""), + wxDefaultPosition, wxDefaultSize, + wxTE_MULTILINE | wxTE_READONLY | wxSUNKEN_BORDER); + m_text->SetFont(wxFont(14, wxROMAN, wxNORMAL, wxNORMAL)); + +#ifdef __WXMSW__ + wxIcon icon("wxICON_TIP"); +#else + #include "wx/generic/tip.xpm" + wxIcon icon(info); +#endif + + wxStaticBitmap *bmp = new wxStaticBitmap(this, -1, icon); + + const int iconSize = icon.GetWidth(); + + c = new wxLayoutConstraints; + c->top.SameAs(this, wxTop, 2*LAYOUT_Y_MARGIN); + c->left.RightOf(bmp, 2*LAYOUT_X_MARGIN); + c->right.SameAs(this, wxRight, 2*LAYOUT_X_MARGIN); + c->height.Absolute(2*text->GetSize().GetHeight()); + text->SetConstraints(c); + + c = new wxLayoutConstraints; + c->centreY.SameAs(text, wxCentreY); + c->left.SameAs(this, wxLeft, 2*LAYOUT_X_MARGIN); + c->width.Absolute(iconSize); + c->height.Absolute(iconSize); + bmp->SetConstraints(c); + + c = new wxLayoutConstraints; + c->bottom.SameAs(this, wxBottom, 2*LAYOUT_X_MARGIN); + c->right.SameAs(this, wxRight, 2*LAYOUT_X_MARGIN); + c->width.Absolute(sizeBtn.GetWidth()); + c->height.Absolute(sizeBtn.GetHeight()); + btnClose->SetConstraints(c); + + c = new wxLayoutConstraints; + c->bottom.SameAs(this, wxBottom, 2*LAYOUT_X_MARGIN); + c->right.LeftOf(btnClose, 2*LAYOUT_X_MARGIN); + c->width.Absolute(sizeBtn.GetWidth()); + c->height.Absolute(sizeBtn.GetHeight()); + btnNext->SetConstraints(c); + + c = new wxLayoutConstraints; + c->bottom.SameAs(this, wxBottom, 2*LAYOUT_X_MARGIN); + c->left.SameAs(this, wxLeft, 2*LAYOUT_X_MARGIN); + c->width.AsIs(); + c->height.AsIs(); + m_checkbox->SetConstraints(c); + m_checkbox->SetValue(showAtStartup); + + c = new wxLayoutConstraints; + c->top.Below(text); + c->left.SameAs(this, wxLeft, 2*LAYOUT_X_MARGIN); + c->right.SameAs(this, wxRight, 2*LAYOUT_X_MARGIN); + c->bottom.Above(btnClose, -2*LAYOUT_Y_MARGIN); + m_text->SetConstraints(c); + + SetTipText(); + + Centre(wxBOTH | wxCENTER_FRAME); + + wxSize size(5*sizeBtn.GetWidth(), 10*sizeBtn.GetHeight()); + SetSize(size); + SetSizeHints(size.x, size.y); + + SetAutoLayout(TRUE); +} + +// ---------------------------------------------------------------------------- +// our public interface +// ---------------------------------------------------------------------------- + +wxTipProvider *wxCreateFileTipProvider(const wxString& filename, + size_t currentTip) +{ + return new wxFileTipProvider(filename, currentTip); +} + +bool wxShowTip(wxWindow *parent, + wxTipProvider *tipProvider, + bool showAtStartup) +{ + wxTipDialog dlg(parent, tipProvider, showAtStartup); + dlg.ShowModal(); + + return dlg.ShowTipsOnStartup(); +} + +#endif // wxUSE_STARTUP_TIPS + diff --git a/src/gtk/Makefile.am b/src/gtk/Makefile.am index 3232551c48..21d7518267 100644 --- a/src/gtk/Makefile.am +++ b/src/gtk/Makefile.am @@ -37,6 +37,7 @@ libwx_gtk_la_SOURCES = \ date.cpp \ datstrm.cpp \ dcbase.cpp \ + dlgcmn.cpp \ docmdi.cpp \ docview.cpp \ dynarray.cpp \ @@ -186,6 +187,7 @@ libwx_gtk_la_SOURCES = \ textctrl.cpp \ textdlg.cpp \ timer.cpp \ + tipdlg.cpp \ tooltip.cpp \ utilsgtk.cpp \ utilsres.cpp \ diff --git a/src/gtk/statline.cpp b/src/gtk/statline.cpp index eb9374713c..98bb5f04b5 100644 --- a/src/gtk/statline.cpp +++ b/src/gtk/statline.cpp @@ -4,7 +4,7 @@ // Author: Robert Roebling // Id: $Id$ // Copyright: (c) 1998 Robert Roebling -// Licence: wxWindows licence +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #ifdef __GNUG__ @@ -22,39 +22,39 @@ // wxStaticLine //----------------------------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxStaticLine,wxControl) +IMPLEMENT_DYNAMIC_CLASS(wxStaticLine, wxControl) -wxStaticLine::wxStaticLine(void) +wxStaticLine::wxStaticLine() { } wxStaticLine::wxStaticLine( wxWindow *parent, wxWindowID id, - const wxPoint &pos, const wxSize &size, - long style, const wxString &name ) + const wxPoint &pos, const wxSize &size, + long style, const wxString &name ) { Create( parent, id, pos, size, style, name ); } -bool wxStaticLine::Create( wxWindow *parent, wxWindowID id, - const wxPoint &pos, const wxSize &size, - long style, const wxString &name ) +bool wxStaticLine::Create( wxWindow *parent, wxWindowID id, + const wxPoint &pos, const wxSize &size, + long style, const wxString &name ) { m_needParent = TRUE; - + PreCreation( parent, id, pos, size, style, name ); - if (style & wxVERTICAL) + if ( IsVertical() ) m_widget = gtk_vseparator_new(); else m_widget = gtk_hseparator_new(); - + m_parent->DoAddChild( this ); - + PostCreation(); - + Show( TRUE ); - + return TRUE; } -#endif \ No newline at end of file +#endif diff --git a/src/gtk/window.cpp b/src/gtk/window.cpp index 8262d26b9d..ee398f439a 100644 --- a/src/gtk/window.cpp +++ b/src/gtk/window.cpp @@ -183,23 +183,23 @@ void debug_focus_in( GtkWidget* widget, const wxChar* name, const wxChar *window void gdk_window_warp_pointer (GdkWindow *window, - gint x, - gint y) + gint x, + gint y) { GdkWindowPrivate *priv; - + if (!window) window = (GdkWindow*) &gdk_root_parent; - + priv = (GdkWindowPrivate*) window; - + if (!priv->destroyed) { - XWarpPointer (priv->xdisplay, + XWarpPointer (priv->xdisplay, None, /* not source window -> move from anywhere */ - priv->xwindow, /* dest window */ + priv->xwindow, /* dest window */ 0, 0, 0, 0, /* not source window -> move from anywhere */ - x, y ); + x, y ); } } @@ -218,139 +218,139 @@ extern bool g_isIdle; /* these functions are copied verbatim from GTK 1.2 */ static void gdkx_XConvertCase (KeySym symbol, - KeySym *lower, - KeySym *upper) + KeySym *lower, + KeySym *upper) { register KeySym sym = symbol; - + g_return_if_fail (lower != NULL); g_return_if_fail (upper != NULL); - + *lower = sym; *upper = sym; - + switch (sym >> 8) { -#if defined (GDK_A) && defined (GDK_Ooblique) +#if defined (GDK_A) && defined (GDK_Ooblique) case 0: /* Latin 1 */ if ((sym >= GDK_A) && (sym <= GDK_Z)) - *lower += (GDK_a - GDK_A); + *lower += (GDK_a - GDK_A); else if ((sym >= GDK_a) && (sym <= GDK_z)) - *upper -= (GDK_a - GDK_A); + *upper -= (GDK_a - GDK_A); else if ((sym >= GDK_Agrave) && (sym <= GDK_Odiaeresis)) - *lower += (GDK_agrave - GDK_Agrave); + *lower += (GDK_agrave - GDK_Agrave); else if ((sym >= GDK_agrave) && (sym <= GDK_odiaeresis)) - *upper -= (GDK_agrave - GDK_Agrave); + *upper -= (GDK_agrave - GDK_Agrave); else if ((sym >= GDK_Ooblique) && (sym <= GDK_Thorn)) - *lower += (GDK_oslash - GDK_Ooblique); + *lower += (GDK_oslash - GDK_Ooblique); else if ((sym >= GDK_oslash) && (sym <= GDK_thorn)) - *upper -= (GDK_oslash - GDK_Ooblique); + *upper -= (GDK_oslash - GDK_Ooblique); break; -#endif /* LATIN1 */ - -#if defined (GDK_Aogonek) && defined (GDK_tcedilla) +#endif /* LATIN1 */ + +#if defined (GDK_Aogonek) && defined (GDK_tcedilla) case 1: /* Latin 2 */ /* Assume the KeySym is a legal value (ignore discontinuities) */ if (sym == GDK_Aogonek) - *lower = GDK_aogonek; + *lower = GDK_aogonek; else if (sym >= GDK_Lstroke && sym <= GDK_Sacute) - *lower += (GDK_lstroke - GDK_Lstroke); + *lower += (GDK_lstroke - GDK_Lstroke); else if (sym >= GDK_Scaron && sym <= GDK_Zacute) - *lower += (GDK_scaron - GDK_Scaron); + *lower += (GDK_scaron - GDK_Scaron); else if (sym >= GDK_Zcaron && sym <= GDK_Zabovedot) - *lower += (GDK_zcaron - GDK_Zcaron); + *lower += (GDK_zcaron - GDK_Zcaron); else if (sym == GDK_aogonek) - *upper = GDK_Aogonek; + *upper = GDK_Aogonek; else if (sym >= GDK_lstroke && sym <= GDK_sacute) - *upper -= (GDK_lstroke - GDK_Lstroke); + *upper -= (GDK_lstroke - GDK_Lstroke); else if (sym >= GDK_scaron && sym <= GDK_zacute) - *upper -= (GDK_scaron - GDK_Scaron); + *upper -= (GDK_scaron - GDK_Scaron); else if (sym >= GDK_zcaron && sym <= GDK_zabovedot) - *upper -= (GDK_zcaron - GDK_Zcaron); + *upper -= (GDK_zcaron - GDK_Zcaron); else if (sym >= GDK_Racute && sym <= GDK_Tcedilla) - *lower += (GDK_racute - GDK_Racute); + *lower += (GDK_racute - GDK_Racute); else if (sym >= GDK_racute && sym <= GDK_tcedilla) - *upper -= (GDK_racute - GDK_Racute); + *upper -= (GDK_racute - GDK_Racute); break; -#endif /* LATIN2 */ - -#if defined (GDK_Hstroke) && defined (GDK_Cabovedot) +#endif /* LATIN2 */ + +#if defined (GDK_Hstroke) && defined (GDK_Cabovedot) case 2: /* Latin 3 */ /* Assume the KeySym is a legal value (ignore discontinuities) */ if (sym >= GDK_Hstroke && sym <= GDK_Hcircumflex) - *lower += (GDK_hstroke - GDK_Hstroke); + *lower += (GDK_hstroke - GDK_Hstroke); else if (sym >= GDK_Gbreve && sym <= GDK_Jcircumflex) - *lower += (GDK_gbreve - GDK_Gbreve); + *lower += (GDK_gbreve - GDK_Gbreve); else if (sym >= GDK_hstroke && sym <= GDK_hcircumflex) - *upper -= (GDK_hstroke - GDK_Hstroke); + *upper -= (GDK_hstroke - GDK_Hstroke); else if (sym >= GDK_gbreve && sym <= GDK_jcircumflex) - *upper -= (GDK_gbreve - GDK_Gbreve); + *upper -= (GDK_gbreve - GDK_Gbreve); else if (sym >= GDK_Cabovedot && sym <= GDK_Scircumflex) - *lower += (GDK_cabovedot - GDK_Cabovedot); + *lower += (GDK_cabovedot - GDK_Cabovedot); else if (sym >= GDK_cabovedot && sym <= GDK_scircumflex) - *upper -= (GDK_cabovedot - GDK_Cabovedot); + *upper -= (GDK_cabovedot - GDK_Cabovedot); break; -#endif /* LATIN3 */ - -#if defined (GDK_Rcedilla) && defined (GDK_Amacron) +#endif /* LATIN3 */ + +#if defined (GDK_Rcedilla) && defined (GDK_Amacron) case 3: /* Latin 4 */ /* Assume the KeySym is a legal value (ignore discontinuities) */ if (sym >= GDK_Rcedilla && sym <= GDK_Tslash) - *lower += (GDK_rcedilla - GDK_Rcedilla); + *lower += (GDK_rcedilla - GDK_Rcedilla); else if (sym >= GDK_rcedilla && sym <= GDK_tslash) - *upper -= (GDK_rcedilla - GDK_Rcedilla); + *upper -= (GDK_rcedilla - GDK_Rcedilla); else if (sym == GDK_ENG) - *lower = GDK_eng; + *lower = GDK_eng; else if (sym == GDK_eng) - *upper = GDK_ENG; + *upper = GDK_ENG; else if (sym >= GDK_Amacron && sym <= GDK_Umacron) - *lower += (GDK_amacron - GDK_Amacron); + *lower += (GDK_amacron - GDK_Amacron); else if (sym >= GDK_amacron && sym <= GDK_umacron) - *upper -= (GDK_amacron - GDK_Amacron); + *upper -= (GDK_amacron - GDK_Amacron); break; -#endif /* LATIN4 */ - -#if defined (GDK_Serbian_DJE) && defined (GDK_Cyrillic_yu) +#endif /* LATIN4 */ + +#if defined (GDK_Serbian_DJE) && defined (GDK_Cyrillic_yu) case 6: /* Cyrillic */ /* Assume the KeySym is a legal value (ignore discontinuities) */ if (sym >= GDK_Serbian_DJE && sym <= GDK_Serbian_DZE) - *lower -= (GDK_Serbian_DJE - GDK_Serbian_dje); + *lower -= (GDK_Serbian_DJE - GDK_Serbian_dje); else if (sym >= GDK_Serbian_dje && sym <= GDK_Serbian_dze) - *upper += (GDK_Serbian_DJE - GDK_Serbian_dje); + *upper += (GDK_Serbian_DJE - GDK_Serbian_dje); else if (sym >= GDK_Cyrillic_YU && sym <= GDK_Cyrillic_HARDSIGN) - *lower -= (GDK_Cyrillic_YU - GDK_Cyrillic_yu); + *lower -= (GDK_Cyrillic_YU - GDK_Cyrillic_yu); else if (sym >= GDK_Cyrillic_yu && sym <= GDK_Cyrillic_hardsign) - *upper += (GDK_Cyrillic_YU - GDK_Cyrillic_yu); + *upper += (GDK_Cyrillic_YU - GDK_Cyrillic_yu); break; -#endif /* CYRILLIC */ - -#if defined (GDK_Greek_ALPHAaccent) && defined (GDK_Greek_finalsmallsigma) +#endif /* CYRILLIC */ + +#if defined (GDK_Greek_ALPHAaccent) && defined (GDK_Greek_finalsmallsigma) case 7: /* Greek */ /* Assume the KeySym is a legal value (ignore discontinuities) */ if (sym >= GDK_Greek_ALPHAaccent && sym <= GDK_Greek_OMEGAaccent) - *lower += (GDK_Greek_alphaaccent - GDK_Greek_ALPHAaccent); + *lower += (GDK_Greek_alphaaccent - GDK_Greek_ALPHAaccent); else if (sym >= GDK_Greek_alphaaccent && sym <= GDK_Greek_omegaaccent && - sym != GDK_Greek_iotaaccentdieresis && - sym != GDK_Greek_upsilonaccentdieresis) - *upper -= (GDK_Greek_alphaaccent - GDK_Greek_ALPHAaccent); + sym != GDK_Greek_iotaaccentdieresis && + sym != GDK_Greek_upsilonaccentdieresis) + *upper -= (GDK_Greek_alphaaccent - GDK_Greek_ALPHAaccent); else if (sym >= GDK_Greek_ALPHA && sym <= GDK_Greek_OMEGA) - *lower += (GDK_Greek_alpha - GDK_Greek_ALPHA); + *lower += (GDK_Greek_alpha - GDK_Greek_ALPHA); else if (sym >= GDK_Greek_alpha && sym <= GDK_Greek_omega && - sym != GDK_Greek_finalsmallsigma) - *upper -= (GDK_Greek_alpha - GDK_Greek_ALPHA); + sym != GDK_Greek_finalsmallsigma) + *upper -= (GDK_Greek_alpha - GDK_Greek_ALPHA); break; -#endif /* GREEK */ +#endif /* GREEK */ } } static guint -gdk_keyval_to_upper (guint keyval) +gdk_keyval_to_upper (guint keyval) { if (keyval) { KeySym lower_val = 0; KeySym upper_val = 0; - + gdkx_XConvertCase (keyval, &lower_val, &upper_val); return upper_val; } @@ -368,12 +368,12 @@ static long map_to_unmodified_wx_keysym( KeySym keysym ) case GDK_Shift_R: key_code = WXK_SHIFT; break; case GDK_Control_L: case GDK_Control_R: key_code = WXK_CONTROL; break; - case GDK_Meta_L: - case GDK_Meta_R: - case GDK_Alt_L: - case GDK_Alt_R: - case GDK_Super_L: - case GDK_Super_R: key_code = WXK_ALT; break; + case GDK_Meta_L: + case GDK_Meta_R: + case GDK_Alt_L: + case GDK_Alt_R: + case GDK_Super_L: + case GDK_Super_R: key_code = WXK_ALT; break; case GDK_Menu: key_code = WXK_MENU; break; case GDK_Help: key_code = WXK_HELP; break; case GDK_BackSpace: key_code = WXK_BACK; break; @@ -440,7 +440,7 @@ static long map_to_unmodified_wx_keysym( KeySym keysym ) case GDK_KP_Subtract: key_code = WXK_NUMPAD_SUBTRACT; break; case GDK_KP_Decimal: key_code = WXK_NUMPAD_DECIMAL; break; case GDK_KP_Divide: key_code = WXK_NUMPAD_DIVIDE; break; - + case GDK_F1: key_code = WXK_F1; break; case GDK_F2: key_code = WXK_F2; break; case GDK_F3: key_code = WXK_F3; break; @@ -539,7 +539,7 @@ static long map_to_wx_keysym( KeySym keysym ) case GDK_KP_Subtract: key_code = '-'; break; case GDK_KP_Decimal: key_code = '.'; break; case GDK_KP_Divide: key_code = '/'; break; - + case GDK_F1: key_code = WXK_F1; break; case GDK_F2: key_code = WXK_F2; break; case GDK_F3: key_code = WXK_F3; break; @@ -692,7 +692,7 @@ static void gtk_window_expose_callback( GtkWidget *WXUNUSED(widget), GdkEventExp static void gtk_window_draw_callback( GtkWidget *WXUNUSED(widget), GdkRectangle *rect, wxWindow *win ) { - if (g_isIdle) + if (g_isIdle) wxapp_install_idle_handler(); if (!win->m_hasVMT) @@ -714,7 +714,7 @@ static void gtk_window_draw_callback( GtkWidget *WXUNUSED(widget), GdkRectangle static gint gtk_window_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_event, wxWindow *win ) { - if (g_isIdle) + if (g_isIdle) wxapp_install_idle_handler(); if (!win->m_hasVMT) return FALSE; @@ -738,13 +738,13 @@ static gint gtk_window_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_e if (gdk_event->window) gdk_window_get_pointer(gdk_event->window, &x, &y, &state); long key_code = map_to_unmodified_wx_keysym( gdk_event->keyval ); - + /* sending unknown key events doesn't really make sense */ if (key_code == 0) return FALSE; bool ret = FALSE; - - wxKeyEvent event( wxEVT_KEY_DOWN ); + + wxKeyEvent event( wxEVT_KEY_DOWN ); event.SetTimestamp( gdk_event->time ); event.m_shiftDown = (gdk_event->state & GDK_SHIFT_MASK); event.m_controlDown = (gdk_event->state & GDK_CONTROL_MASK); @@ -756,7 +756,7 @@ static gint gtk_window_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_e event.m_y = y; event.SetEventObject( win ); ret = win->GetEventHandler()->ProcessEvent( event ); - + key_code = map_to_wx_keysym( gdk_event->keyval ); #if wxUSE_ACCEL @@ -781,7 +781,7 @@ static gint gtk_window_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_e will only be sent if it is not a menu accelerator. */ if ((key_code != 0) && ! ret ) { - wxKeyEvent event2( wxEVT_CHAR ); + wxKeyEvent event2( wxEVT_CHAR ); event2.SetTimestamp( gdk_event->time ); event2.m_shiftDown = (gdk_event->state & GDK_SHIFT_MASK); event2.m_controlDown = (gdk_event->state & GDK_CONTROL_MASK); @@ -818,7 +818,7 @@ static gint gtk_window_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_e new_event.SetEventObject( win ); ret = win->GetEventHandler()->ProcessEvent( new_event ); } - + #if (GTK_MINOR_VERSION > 0) /* pressing F10 will activate the menu bar of the top frame */ if ( (!ret) && @@ -828,22 +828,22 @@ static gint gtk_window_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_e while (ancestor) { if (wxIsKindOf(ancestor,wxFrame)) - { - wxFrame *frame = (wxFrame*) ancestor; + { + wxFrame *frame = (wxFrame*) ancestor; wxMenuBar *menubar = frame->GetMenuBar(); - if (menubar) - { + if (menubar) + { wxNode *node = menubar->GetMenus().First(); - if (node) - { - // doesn't work correctly + if (node) + { + // doesn't work correctly // wxMenu *firstMenu = (wxMenu*) node->Data(); - // gtk_menu_item_select( GTK_MENU_ITEM(firstMenu->m_owner) ); - // ret = TRUE; - break; - } - } - } + // gtk_menu_item_select( GTK_MENU_ITEM(firstMenu->m_owner) ); + // ret = TRUE; + break; + } + } + } ancestor = ancestor->GetParent(); } } @@ -887,7 +887,7 @@ static gint gtk_window_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_e static gint gtk_window_key_release_callback( GtkWidget *widget, GdkEventKey *gdk_event, wxWindow *win ) { - if (g_isIdle) + if (g_isIdle) wxapp_install_idle_handler(); if (!win->m_hasVMT) return FALSE; @@ -907,7 +907,7 @@ static gint gtk_window_key_release_callback( GtkWidget *widget, GdkEventKey *gdk */ long key_code = map_to_unmodified_wx_keysym( gdk_event->keyval ); - + /* sending unknown key events doesn't really make sense */ if (key_code == 0) return FALSE; @@ -943,7 +943,7 @@ static gint gtk_window_key_release_callback( GtkWidget *widget, GdkEventKey *gdk static gint gtk_window_button_press_callback( GtkWidget *widget, GdkEventButton *gdk_event, wxWindow *win ) { - if (g_isIdle) + if (g_isIdle) wxapp_install_idle_handler(); /* @@ -1097,7 +1097,7 @@ static gint gtk_window_button_press_callback( GtkWidget *widget, GdkEventButton static gint gtk_window_button_release_callback( GtkWidget *widget, GdkEventButton *gdk_event, wxWindow *win ) { - if (g_isIdle) + if (g_isIdle) wxapp_install_idle_handler(); if (!win->m_hasVMT) return FALSE; @@ -1205,7 +1205,7 @@ static gint gtk_window_button_release_callback( GtkWidget *widget, GdkEventButto static gint gtk_window_motion_notify_callback( GtkWidget *widget, GdkEventMotion *gdk_event, wxWindow *win ) { - if (g_isIdle) + if (g_isIdle) wxapp_install_idle_handler(); if (!win->m_hasVMT) return FALSE; @@ -1316,7 +1316,7 @@ static gint gtk_window_motion_notify_callback( GtkWidget *widget, GdkEventMotion static gint gtk_window_focus_in_callback( GtkWidget *widget, GdkEvent *WXUNUSED(event), wxWindow *win ) { - if (g_isIdle) + if (g_isIdle) wxapp_install_idle_handler(); if (!win->m_hasVMT) return FALSE; @@ -1366,7 +1366,7 @@ static gint gtk_window_focus_in_callback( GtkWidget *widget, GdkEvent *WXUNUSED( static gint gtk_window_focus_out_callback( GtkWidget *widget, GdkEvent *WXUNUSED(event), wxWindow *win ) { - if (g_isIdle) + if (g_isIdle) wxapp_install_idle_handler(); if (!win->m_hasVMT) return FALSE; @@ -1403,7 +1403,7 @@ static gint gtk_window_focus_out_callback( GtkWidget *widget, GdkEvent *WXUNUSED static gint gtk_window_enter_callback( GtkWidget *widget, GdkEventCrossing *gdk_event, wxWindow *win ) { - if (g_isIdle) + if (g_isIdle) wxapp_install_idle_handler(); if (!win->m_hasVMT) return FALSE; @@ -1449,14 +1449,14 @@ static gint gtk_window_enter_callback( GtkWidget *widget, GdkEventCrossing *gdk_ static gint gtk_window_leave_callback( GtkWidget *widget, GdkEventCrossing *gdk_event, wxWindow *win ) { - if (g_isIdle) + if (g_isIdle) wxapp_install_idle_handler(); if (!win->m_hasVMT) return FALSE; if (g_blockEventsOnDrag) return FALSE; if (!win->IsOwnGtkWindow( gdk_event->window )) return FALSE; - + wxMouseEvent event( wxEVT_LEAVE_WINDOW ); #if (GTK_MINOR_VERSION > 0) event.SetTimestamp( gdk_event->time ); @@ -1495,7 +1495,7 @@ static gint gtk_window_leave_callback( GtkWidget *widget, GdkEventCrossing *gdk_ static void gtk_window_vscroll_callback( GtkWidget *WXUNUSED(widget), wxWindow *win ) { - if (g_isIdle) + if (g_isIdle) wxapp_install_idle_handler(); if (g_blockEventsOnDrag) return; @@ -1539,7 +1539,7 @@ static void gtk_window_vscroll_callback( GtkWidget *WXUNUSED(widget), wxWindow * static void gtk_window_hscroll_callback( GtkWidget *WXUNUSED(widget), wxWindow *win ) { - if (g_isIdle) + if (g_isIdle) wxapp_install_idle_handler(); if (g_blockEventsOnDrag) return; @@ -1582,7 +1582,7 @@ static void gtk_window_hscroll_callback( GtkWidget *WXUNUSED(widget), wxWindow * static void gtk_window_vscroll_change_callback( GtkWidget *WXUNUSED(widget), wxWindow *win ) { - if (g_isIdle) + if (g_isIdle) wxapp_install_idle_handler(); if (g_blockEventsOnDrag) return; @@ -1602,7 +1602,7 @@ static void gtk_window_vscroll_change_callback( GtkWidget *WXUNUSED(widget), wxW static void gtk_window_hscroll_change_callback( GtkWidget *WXUNUSED(widget), wxWindow *win ) { - if (g_isIdle) + if (g_isIdle) wxapp_install_idle_handler(); if (g_blockEventsOnDrag) return; @@ -1624,7 +1624,7 @@ static gint gtk_scrollbar_button_press_callback( GtkRange *WXUNUSED(widget), GdkEventButton *WXUNUSED(gdk_event), wxWindow *win ) { - if (g_isIdle) + if (g_isIdle) wxapp_install_idle_handler(); // don't test here as we can release the mouse while being over @@ -1683,7 +1683,7 @@ wxWindow *wxWindowBase::FindFocus() static gint gtk_window_realized_callback( GtkWidget * WXUNUSED(widget), wxWindow *win ) { - if (g_isIdle) + if (g_isIdle) wxapp_install_idle_handler(); if (win->m_delayedFont) @@ -1696,7 +1696,7 @@ gtk_window_realized_callback( GtkWidget * WXUNUSED(widget), wxWindow *win ) win->SetForegroundColour( win->GetForegroundColour() ); win->SetCursor( win->GetCursor() ); - + wxWindowCreateEvent event( win ); event.SetEventObject( win ); win->GetEventHandler()->ProcessEvent( event ); @@ -1962,25 +1962,25 @@ wxWindow::~wxWindow() if (m_widgetStyle) { gtk_style_unref( m_widgetStyle ); - m_widgetStyle = (GtkStyle*) NULL; + m_widgetStyle = (GtkStyle*) NULL; } if (m_scrollGC) { gdk_gc_unref( m_scrollGC ); - m_scrollGC = (GdkGC*) NULL; + m_scrollGC = (GdkGC*) NULL; } if (m_wxwindow) { gtk_widget_destroy( m_wxwindow ); - m_wxwindow = (GtkWidget*) NULL; + m_wxwindow = (GtkWidget*) NULL; } if (m_widget) { gtk_widget_destroy( m_widget ); - m_widget = (GtkWidget*) NULL; + m_widget = (GtkWidget*) NULL; } } @@ -2049,7 +2049,7 @@ void wxWindow::PostCreation() /* we cannot set colours, fonts and cursors before the widget has been realized, so we do this directly after realization */ gtk_signal_connect( GTK_OBJECT(connect_widget), "realize", - GTK_SIGNAL_FUNC(gtk_window_realized_callback), (gpointer) this ); + GTK_SIGNAL_FUNC(gtk_window_realized_callback), (gpointer) this ); m_hasVMT = TRUE; } @@ -2142,42 +2142,42 @@ void wxWindow::DoSetSize( int x, int y, int width, int height, int sizeFlags ) if ((m_maxHeight != -1) && (m_height > m_maxHeight)) m_height = m_maxHeight; int border = 0; - int bottom_border = 0; + int bottom_border = 0; if (GTK_WIDGET_CAN_DEFAULT(m_widget)) - { - /* the default button has a border around it */ - border = 6; - bottom_border = 5; - } - - /* this is the result of hours of debugging: the following code - means that if we have a m_wxwindow and we set the size of - m_widget, m_widget (which is a GtkScrolledWindow) does NOT - automatically propagate its size down to its m_wxwindow, - which is its client area. therefore, we have to tell the - client area directly that it has to resize itself. - this will lead to that m_widget (GtkScrolledWindow) will - calculate how much size it needs for scrollbars etc and - it will then call XXX_size_allocate of its child, which - is m_wxwindow. m_wxwindow in turn will do the same with its - children and so on. problems can arise if this happens - before all the children have been realized as some widgets - stupidy need to be realized during XXX_size_allocate (e.g. - GtkNotebook) and they will segv if called otherwise. this - emergency is tested in gtk_myfixed_size_allocate. Normally - this shouldn't be needed and only gtk_widget_queue_resize() - should be enough to provoke a resize at the next appropriate - moment, but this seems to fail, e.g. when a wxNotebook contains - a wxSplitterWindow: the splitter window's children won't - show up properly resized then. */ - - gtk_myfixed_set_size( GTK_MYFIXED(m_parent->m_wxwindow), - m_widget, - m_x-border, - m_y-border, - m_width+2*border, - m_height+border+bottom_border ); + { + /* the default button has a border around it */ + border = 6; + bottom_border = 5; + } + + /* this is the result of hours of debugging: the following code + means that if we have a m_wxwindow and we set the size of + m_widget, m_widget (which is a GtkScrolledWindow) does NOT + automatically propagate its size down to its m_wxwindow, + which is its client area. therefore, we have to tell the + client area directly that it has to resize itself. + this will lead to that m_widget (GtkScrolledWindow) will + calculate how much size it needs for scrollbars etc and + it will then call XXX_size_allocate of its child, which + is m_wxwindow. m_wxwindow in turn will do the same with its + children and so on. problems can arise if this happens + before all the children have been realized as some widgets + stupidy need to be realized during XXX_size_allocate (e.g. + GtkNotebook) and they will segv if called otherwise. this + emergency is tested in gtk_myfixed_size_allocate. Normally + this shouldn't be needed and only gtk_widget_queue_resize() + should be enough to provoke a resize at the next appropriate + moment, but this seems to fail, e.g. when a wxNotebook contains + a wxSplitterWindow: the splitter window's children won't + show up properly resized then. */ + + gtk_myfixed_set_size( GTK_MYFIXED(m_parent->m_wxwindow), + m_widget, + m_x-border, + m_y-border, + m_width+2*border, + m_height+border+bottom_border ); } m_sizeSet = TRUE; @@ -2196,13 +2196,13 @@ void wxWindow::OnInternalIdle() { wxCursor cursor = m_cursor; if (g_globalCursor.Ok()) cursor = g_globalCursor; - - if (cursor.Ok() && m_currentGdkCursor != cursor) - { - gdk_window_set_cursor( window, cursor.GetCursor() ); - m_currentGdkCursor = cursor; - } - } + + if (cursor.Ok() && m_currentGdkCursor != cursor) + { + gdk_window_set_cursor( window, cursor.GetCursor() ); + m_currentGdkCursor = cursor; + } + } UpdateWindowUI(); } @@ -2513,7 +2513,7 @@ bool wxWindow::AcceptsFocus() const bool wxWindow::Reparent( wxWindow *newParent ) { wxCHECK_MSG( (m_widget != NULL), FALSE, _T("invalid window") ); - + wxWindow *oldParent = m_parent; if ( !wxWindowBase::Reparent(newParent) ) @@ -2523,27 +2523,27 @@ bool wxWindow::Reparent( wxWindow *newParent ) { gtk_container_remove( GTK_CONTAINER(oldParent->m_wxwindow), m_widget ); } - + if (newParent) { /* insert GTK representation */ (*(newParent->m_insertCallback))(newParent, this); } - + return TRUE; } -void wxWindow::DoAddChild(wxWindow *child) +void wxWindow::DoAddChild(wxWindow *child) { wxASSERT_MSG( (m_widget != NULL), _T("invalid window") ); wxASSERT_MSG( (child != NULL), _T("invalid child window") ); wxASSERT_MSG( (m_insertCallback != NULL), _T("invalid child insertion function") ); - + /* add to list */ AddChild( child ); - + /* insert GTK representation */ (*m_insertCallback)(this, child); } @@ -2576,16 +2576,16 @@ bool wxWindow::SetCursor( const wxCursor &cursor ) // been realized if (!m_delayedCursor) return FALSE; } - + GtkWidget *connect_widget = GetConnectWidget(); if (!connect_widget->window) { // indicate that a new style has been set - // but it couldn't get applied as the - // widget hasn't been realized yet. - m_delayedCursor = TRUE; - - // pretend we have done something + // but it couldn't get applied as the + // widget hasn't been realized yet. + m_delayedCursor = TRUE; + + // pretend we have done something return TRUE; } @@ -2603,7 +2603,7 @@ void wxWindow::WarpPointer( int x, int y ) if (connect_widget->window) { /* we provide this function ourselves as it is - missing in GDK */ + missing in GDK */ gdk_window_warp_pointer( connect_widget->window, x, y ); } } @@ -2687,16 +2687,16 @@ bool wxWindow::SetBackgroundColour( const wxColour &colour ) // been realized if (!m_delayedBackgroundColour) return FALSE; } - + GtkWidget *connect_widget = GetConnectWidget(); if (!connect_widget->window) { // indicate that a new style has been set - // but it couldn't get applied as the - // widget hasn't been realized yet. - m_delayedBackgroundColour = TRUE; - - // pretend we have done something + // but it couldn't get applied as the + // widget hasn't been realized yet. + m_delayedBackgroundColour = TRUE; + + // pretend we have done something return TRUE; } @@ -2734,16 +2734,16 @@ bool wxWindow::SetForegroundColour( const wxColour &colour ) // been realized if (!m_delayedForegroundColour) return FALSE; } - + GtkWidget *connect_widget = GetConnectWidget(); if (!connect_widget->window) { // indicate that a new style has been set - // but it couldn't get applied as the - // widget hasn't been realized yet. - m_delayedForegroundColour = TRUE; - - // pretend we have done something + // but it couldn't get applied as the + // widget hasn't been realized yet. + m_delayedForegroundColour = TRUE; + + // pretend we have done something return TRUE; } @@ -2890,7 +2890,7 @@ bool wxWindow::IsOwnGtkWindow( GdkWindow *window ) bool wxWindow::SetFont( const wxFont &font ) { - wxCHECK_MSG( m_widget != NULL, FALSE, _T( "invalid window") ); + wxCHECK_MSG( m_widget != NULL, FALSE, _T( "invalid window") ); if (!wxWindowBase::SetFont(font)) { @@ -2898,16 +2898,16 @@ bool wxWindow::SetFont( const wxFont &font ) // been realized if (!m_delayedFont) return FALSE; } - + GtkWidget *connect_widget = GetConnectWidget(); if (!connect_widget->window) { // indicate that a new style has been set - // but it couldn't get applied as the - // widget hasn't been realized yet. - m_delayedFont = TRUE; - - // pretend we have done something + // but it couldn't get applied as the + // widget hasn't been realized yet. + m_delayedFont = TRUE; + + // pretend we have done something return TRUE; } @@ -2934,7 +2934,7 @@ void wxWindow::CaptureMouse() GtkWidget *connect_widget = GetConnectWidget(); if (!connect_widget->window) return; - + gdk_pointer_grab( connect_widget->window, FALSE, (GdkEventMask) (GDK_BUTTON_PRESS_MASK | @@ -2954,7 +2954,7 @@ void wxWindow::ReleaseMouse() GtkWidget *connect_widget = GetConnectWidget(); if (!connect_widget->window) return; - + gdk_pointer_ungrab ( GDK_CURRENT_TIME ); g_captureWindow = (wxWindow*) NULL; } @@ -3114,16 +3114,16 @@ void wxWindow::ScrollWindow( int dx, int dy, const wxRect* WXUNUSED(rect) ) m_scrollGC = gdk_gc_new( m_wxwindow->window ); gdk_gc_set_exposures( m_scrollGC, TRUE ); } - + wxNode *node = m_children.First(); while (node) { wxWindow *child = (wxWindow*) node->Data(); - int sx = 0; - int sy = 0; - child->GetSize( &sx, &sy ); - child->SetSize( child->m_x + dx, child->m_y + dy, sx, sy, wxSIZE_ALLOW_MINUS_ONE ); - node = node->Next(); + int sx = 0; + int sy = 0; + child->GetSize( &sx, &sy ); + child->SetSize( child->m_x + dx, child->m_y + dy, sx, sy, wxSIZE_ALLOW_MINUS_ONE ); + node = node->Next(); } int cw = 0; @@ -3131,7 +3131,7 @@ void wxWindow::ScrollWindow( int dx, int dy, const wxRect* WXUNUSED(rect) ) GetClientSize( &cw, &ch ); int w = cw - abs(dx); int h = ch - abs(dy); - + if ((h < 0) || (w < 0)) { Refresh(); diff --git a/src/gtk1/Makefile.am b/src/gtk1/Makefile.am index 3232551c48..21d7518267 100644 --- a/src/gtk1/Makefile.am +++ b/src/gtk1/Makefile.am @@ -37,6 +37,7 @@ libwx_gtk_la_SOURCES = \ date.cpp \ datstrm.cpp \ dcbase.cpp \ + dlgcmn.cpp \ docmdi.cpp \ docview.cpp \ dynarray.cpp \ @@ -186,6 +187,7 @@ libwx_gtk_la_SOURCES = \ textctrl.cpp \ textdlg.cpp \ timer.cpp \ + tipdlg.cpp \ tooltip.cpp \ utilsgtk.cpp \ utilsres.cpp \ diff --git a/src/gtk1/statline.cpp b/src/gtk1/statline.cpp index eb9374713c..98bb5f04b5 100644 --- a/src/gtk1/statline.cpp +++ b/src/gtk1/statline.cpp @@ -4,7 +4,7 @@ // Author: Robert Roebling // Id: $Id$ // Copyright: (c) 1998 Robert Roebling -// Licence: wxWindows licence +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #ifdef __GNUG__ @@ -22,39 +22,39 @@ // wxStaticLine //----------------------------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxStaticLine,wxControl) +IMPLEMENT_DYNAMIC_CLASS(wxStaticLine, wxControl) -wxStaticLine::wxStaticLine(void) +wxStaticLine::wxStaticLine() { } wxStaticLine::wxStaticLine( wxWindow *parent, wxWindowID id, - const wxPoint &pos, const wxSize &size, - long style, const wxString &name ) + const wxPoint &pos, const wxSize &size, + long style, const wxString &name ) { Create( parent, id, pos, size, style, name ); } -bool wxStaticLine::Create( wxWindow *parent, wxWindowID id, - const wxPoint &pos, const wxSize &size, - long style, const wxString &name ) +bool wxStaticLine::Create( wxWindow *parent, wxWindowID id, + const wxPoint &pos, const wxSize &size, + long style, const wxString &name ) { m_needParent = TRUE; - + PreCreation( parent, id, pos, size, style, name ); - if (style & wxVERTICAL) + if ( IsVertical() ) m_widget = gtk_vseparator_new(); else m_widget = gtk_hseparator_new(); - + m_parent->DoAddChild( this ); - + PostCreation(); - + Show( TRUE ); - + return TRUE; } -#endif \ No newline at end of file +#endif diff --git a/src/gtk1/window.cpp b/src/gtk1/window.cpp index 8262d26b9d..ee398f439a 100644 --- a/src/gtk1/window.cpp +++ b/src/gtk1/window.cpp @@ -183,23 +183,23 @@ void debug_focus_in( GtkWidget* widget, const wxChar* name, const wxChar *window void gdk_window_warp_pointer (GdkWindow *window, - gint x, - gint y) + gint x, + gint y) { GdkWindowPrivate *priv; - + if (!window) window = (GdkWindow*) &gdk_root_parent; - + priv = (GdkWindowPrivate*) window; - + if (!priv->destroyed) { - XWarpPointer (priv->xdisplay, + XWarpPointer (priv->xdisplay, None, /* not source window -> move from anywhere */ - priv->xwindow, /* dest window */ + priv->xwindow, /* dest window */ 0, 0, 0, 0, /* not source window -> move from anywhere */ - x, y ); + x, y ); } } @@ -218,139 +218,139 @@ extern bool g_isIdle; /* these functions are copied verbatim from GTK 1.2 */ static void gdkx_XConvertCase (KeySym symbol, - KeySym *lower, - KeySym *upper) + KeySym *lower, + KeySym *upper) { register KeySym sym = symbol; - + g_return_if_fail (lower != NULL); g_return_if_fail (upper != NULL); - + *lower = sym; *upper = sym; - + switch (sym >> 8) { -#if defined (GDK_A) && defined (GDK_Ooblique) +#if defined (GDK_A) && defined (GDK_Ooblique) case 0: /* Latin 1 */ if ((sym >= GDK_A) && (sym <= GDK_Z)) - *lower += (GDK_a - GDK_A); + *lower += (GDK_a - GDK_A); else if ((sym >= GDK_a) && (sym <= GDK_z)) - *upper -= (GDK_a - GDK_A); + *upper -= (GDK_a - GDK_A); else if ((sym >= GDK_Agrave) && (sym <= GDK_Odiaeresis)) - *lower += (GDK_agrave - GDK_Agrave); + *lower += (GDK_agrave - GDK_Agrave); else if ((sym >= GDK_agrave) && (sym <= GDK_odiaeresis)) - *upper -= (GDK_agrave - GDK_Agrave); + *upper -= (GDK_agrave - GDK_Agrave); else if ((sym >= GDK_Ooblique) && (sym <= GDK_Thorn)) - *lower += (GDK_oslash - GDK_Ooblique); + *lower += (GDK_oslash - GDK_Ooblique); else if ((sym >= GDK_oslash) && (sym <= GDK_thorn)) - *upper -= (GDK_oslash - GDK_Ooblique); + *upper -= (GDK_oslash - GDK_Ooblique); break; -#endif /* LATIN1 */ - -#if defined (GDK_Aogonek) && defined (GDK_tcedilla) +#endif /* LATIN1 */ + +#if defined (GDK_Aogonek) && defined (GDK_tcedilla) case 1: /* Latin 2 */ /* Assume the KeySym is a legal value (ignore discontinuities) */ if (sym == GDK_Aogonek) - *lower = GDK_aogonek; + *lower = GDK_aogonek; else if (sym >= GDK_Lstroke && sym <= GDK_Sacute) - *lower += (GDK_lstroke - GDK_Lstroke); + *lower += (GDK_lstroke - GDK_Lstroke); else if (sym >= GDK_Scaron && sym <= GDK_Zacute) - *lower += (GDK_scaron - GDK_Scaron); + *lower += (GDK_scaron - GDK_Scaron); else if (sym >= GDK_Zcaron && sym <= GDK_Zabovedot) - *lower += (GDK_zcaron - GDK_Zcaron); + *lower += (GDK_zcaron - GDK_Zcaron); else if (sym == GDK_aogonek) - *upper = GDK_Aogonek; + *upper = GDK_Aogonek; else if (sym >= GDK_lstroke && sym <= GDK_sacute) - *upper -= (GDK_lstroke - GDK_Lstroke); + *upper -= (GDK_lstroke - GDK_Lstroke); else if (sym >= GDK_scaron && sym <= GDK_zacute) - *upper -= (GDK_scaron - GDK_Scaron); + *upper -= (GDK_scaron - GDK_Scaron); else if (sym >= GDK_zcaron && sym <= GDK_zabovedot) - *upper -= (GDK_zcaron - GDK_Zcaron); + *upper -= (GDK_zcaron - GDK_Zcaron); else if (sym >= GDK_Racute && sym <= GDK_Tcedilla) - *lower += (GDK_racute - GDK_Racute); + *lower += (GDK_racute - GDK_Racute); else if (sym >= GDK_racute && sym <= GDK_tcedilla) - *upper -= (GDK_racute - GDK_Racute); + *upper -= (GDK_racute - GDK_Racute); break; -#endif /* LATIN2 */ - -#if defined (GDK_Hstroke) && defined (GDK_Cabovedot) +#endif /* LATIN2 */ + +#if defined (GDK_Hstroke) && defined (GDK_Cabovedot) case 2: /* Latin 3 */ /* Assume the KeySym is a legal value (ignore discontinuities) */ if (sym >= GDK_Hstroke && sym <= GDK_Hcircumflex) - *lower += (GDK_hstroke - GDK_Hstroke); + *lower += (GDK_hstroke - GDK_Hstroke); else if (sym >= GDK_Gbreve && sym <= GDK_Jcircumflex) - *lower += (GDK_gbreve - GDK_Gbreve); + *lower += (GDK_gbreve - GDK_Gbreve); else if (sym >= GDK_hstroke && sym <= GDK_hcircumflex) - *upper -= (GDK_hstroke - GDK_Hstroke); + *upper -= (GDK_hstroke - GDK_Hstroke); else if (sym >= GDK_gbreve && sym <= GDK_jcircumflex) - *upper -= (GDK_gbreve - GDK_Gbreve); + *upper -= (GDK_gbreve - GDK_Gbreve); else if (sym >= GDK_Cabovedot && sym <= GDK_Scircumflex) - *lower += (GDK_cabovedot - GDK_Cabovedot); + *lower += (GDK_cabovedot - GDK_Cabovedot); else if (sym >= GDK_cabovedot && sym <= GDK_scircumflex) - *upper -= (GDK_cabovedot - GDK_Cabovedot); + *upper -= (GDK_cabovedot - GDK_Cabovedot); break; -#endif /* LATIN3 */ - -#if defined (GDK_Rcedilla) && defined (GDK_Amacron) +#endif /* LATIN3 */ + +#if defined (GDK_Rcedilla) && defined (GDK_Amacron) case 3: /* Latin 4 */ /* Assume the KeySym is a legal value (ignore discontinuities) */ if (sym >= GDK_Rcedilla && sym <= GDK_Tslash) - *lower += (GDK_rcedilla - GDK_Rcedilla); + *lower += (GDK_rcedilla - GDK_Rcedilla); else if (sym >= GDK_rcedilla && sym <= GDK_tslash) - *upper -= (GDK_rcedilla - GDK_Rcedilla); + *upper -= (GDK_rcedilla - GDK_Rcedilla); else if (sym == GDK_ENG) - *lower = GDK_eng; + *lower = GDK_eng; else if (sym == GDK_eng) - *upper = GDK_ENG; + *upper = GDK_ENG; else if (sym >= GDK_Amacron && sym <= GDK_Umacron) - *lower += (GDK_amacron - GDK_Amacron); + *lower += (GDK_amacron - GDK_Amacron); else if (sym >= GDK_amacron && sym <= GDK_umacron) - *upper -= (GDK_amacron - GDK_Amacron); + *upper -= (GDK_amacron - GDK_Amacron); break; -#endif /* LATIN4 */ - -#if defined (GDK_Serbian_DJE) && defined (GDK_Cyrillic_yu) +#endif /* LATIN4 */ + +#if defined (GDK_Serbian_DJE) && defined (GDK_Cyrillic_yu) case 6: /* Cyrillic */ /* Assume the KeySym is a legal value (ignore discontinuities) */ if (sym >= GDK_Serbian_DJE && sym <= GDK_Serbian_DZE) - *lower -= (GDK_Serbian_DJE - GDK_Serbian_dje); + *lower -= (GDK_Serbian_DJE - GDK_Serbian_dje); else if (sym >= GDK_Serbian_dje && sym <= GDK_Serbian_dze) - *upper += (GDK_Serbian_DJE - GDK_Serbian_dje); + *upper += (GDK_Serbian_DJE - GDK_Serbian_dje); else if (sym >= GDK_Cyrillic_YU && sym <= GDK_Cyrillic_HARDSIGN) - *lower -= (GDK_Cyrillic_YU - GDK_Cyrillic_yu); + *lower -= (GDK_Cyrillic_YU - GDK_Cyrillic_yu); else if (sym >= GDK_Cyrillic_yu && sym <= GDK_Cyrillic_hardsign) - *upper += (GDK_Cyrillic_YU - GDK_Cyrillic_yu); + *upper += (GDK_Cyrillic_YU - GDK_Cyrillic_yu); break; -#endif /* CYRILLIC */ - -#if defined (GDK_Greek_ALPHAaccent) && defined (GDK_Greek_finalsmallsigma) +#endif /* CYRILLIC */ + +#if defined (GDK_Greek_ALPHAaccent) && defined (GDK_Greek_finalsmallsigma) case 7: /* Greek */ /* Assume the KeySym is a legal value (ignore discontinuities) */ if (sym >= GDK_Greek_ALPHAaccent && sym <= GDK_Greek_OMEGAaccent) - *lower += (GDK_Greek_alphaaccent - GDK_Greek_ALPHAaccent); + *lower += (GDK_Greek_alphaaccent - GDK_Greek_ALPHAaccent); else if (sym >= GDK_Greek_alphaaccent && sym <= GDK_Greek_omegaaccent && - sym != GDK_Greek_iotaaccentdieresis && - sym != GDK_Greek_upsilonaccentdieresis) - *upper -= (GDK_Greek_alphaaccent - GDK_Greek_ALPHAaccent); + sym != GDK_Greek_iotaaccentdieresis && + sym != GDK_Greek_upsilonaccentdieresis) + *upper -= (GDK_Greek_alphaaccent - GDK_Greek_ALPHAaccent); else if (sym >= GDK_Greek_ALPHA && sym <= GDK_Greek_OMEGA) - *lower += (GDK_Greek_alpha - GDK_Greek_ALPHA); + *lower += (GDK_Greek_alpha - GDK_Greek_ALPHA); else if (sym >= GDK_Greek_alpha && sym <= GDK_Greek_omega && - sym != GDK_Greek_finalsmallsigma) - *upper -= (GDK_Greek_alpha - GDK_Greek_ALPHA); + sym != GDK_Greek_finalsmallsigma) + *upper -= (GDK_Greek_alpha - GDK_Greek_ALPHA); break; -#endif /* GREEK */ +#endif /* GREEK */ } } static guint -gdk_keyval_to_upper (guint keyval) +gdk_keyval_to_upper (guint keyval) { if (keyval) { KeySym lower_val = 0; KeySym upper_val = 0; - + gdkx_XConvertCase (keyval, &lower_val, &upper_val); return upper_val; } @@ -368,12 +368,12 @@ static long map_to_unmodified_wx_keysym( KeySym keysym ) case GDK_Shift_R: key_code = WXK_SHIFT; break; case GDK_Control_L: case GDK_Control_R: key_code = WXK_CONTROL; break; - case GDK_Meta_L: - case GDK_Meta_R: - case GDK_Alt_L: - case GDK_Alt_R: - case GDK_Super_L: - case GDK_Super_R: key_code = WXK_ALT; break; + case GDK_Meta_L: + case GDK_Meta_R: + case GDK_Alt_L: + case GDK_Alt_R: + case GDK_Super_L: + case GDK_Super_R: key_code = WXK_ALT; break; case GDK_Menu: key_code = WXK_MENU; break; case GDK_Help: key_code = WXK_HELP; break; case GDK_BackSpace: key_code = WXK_BACK; break; @@ -440,7 +440,7 @@ static long map_to_unmodified_wx_keysym( KeySym keysym ) case GDK_KP_Subtract: key_code = WXK_NUMPAD_SUBTRACT; break; case GDK_KP_Decimal: key_code = WXK_NUMPAD_DECIMAL; break; case GDK_KP_Divide: key_code = WXK_NUMPAD_DIVIDE; break; - + case GDK_F1: key_code = WXK_F1; break; case GDK_F2: key_code = WXK_F2; break; case GDK_F3: key_code = WXK_F3; break; @@ -539,7 +539,7 @@ static long map_to_wx_keysym( KeySym keysym ) case GDK_KP_Subtract: key_code = '-'; break; case GDK_KP_Decimal: key_code = '.'; break; case GDK_KP_Divide: key_code = '/'; break; - + case GDK_F1: key_code = WXK_F1; break; case GDK_F2: key_code = WXK_F2; break; case GDK_F3: key_code = WXK_F3; break; @@ -692,7 +692,7 @@ static void gtk_window_expose_callback( GtkWidget *WXUNUSED(widget), GdkEventExp static void gtk_window_draw_callback( GtkWidget *WXUNUSED(widget), GdkRectangle *rect, wxWindow *win ) { - if (g_isIdle) + if (g_isIdle) wxapp_install_idle_handler(); if (!win->m_hasVMT) @@ -714,7 +714,7 @@ static void gtk_window_draw_callback( GtkWidget *WXUNUSED(widget), GdkRectangle static gint gtk_window_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_event, wxWindow *win ) { - if (g_isIdle) + if (g_isIdle) wxapp_install_idle_handler(); if (!win->m_hasVMT) return FALSE; @@ -738,13 +738,13 @@ static gint gtk_window_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_e if (gdk_event->window) gdk_window_get_pointer(gdk_event->window, &x, &y, &state); long key_code = map_to_unmodified_wx_keysym( gdk_event->keyval ); - + /* sending unknown key events doesn't really make sense */ if (key_code == 0) return FALSE; bool ret = FALSE; - - wxKeyEvent event( wxEVT_KEY_DOWN ); + + wxKeyEvent event( wxEVT_KEY_DOWN ); event.SetTimestamp( gdk_event->time ); event.m_shiftDown = (gdk_event->state & GDK_SHIFT_MASK); event.m_controlDown = (gdk_event->state & GDK_CONTROL_MASK); @@ -756,7 +756,7 @@ static gint gtk_window_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_e event.m_y = y; event.SetEventObject( win ); ret = win->GetEventHandler()->ProcessEvent( event ); - + key_code = map_to_wx_keysym( gdk_event->keyval ); #if wxUSE_ACCEL @@ -781,7 +781,7 @@ static gint gtk_window_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_e will only be sent if it is not a menu accelerator. */ if ((key_code != 0) && ! ret ) { - wxKeyEvent event2( wxEVT_CHAR ); + wxKeyEvent event2( wxEVT_CHAR ); event2.SetTimestamp( gdk_event->time ); event2.m_shiftDown = (gdk_event->state & GDK_SHIFT_MASK); event2.m_controlDown = (gdk_event->state & GDK_CONTROL_MASK); @@ -818,7 +818,7 @@ static gint gtk_window_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_e new_event.SetEventObject( win ); ret = win->GetEventHandler()->ProcessEvent( new_event ); } - + #if (GTK_MINOR_VERSION > 0) /* pressing F10 will activate the menu bar of the top frame */ if ( (!ret) && @@ -828,22 +828,22 @@ static gint gtk_window_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_e while (ancestor) { if (wxIsKindOf(ancestor,wxFrame)) - { - wxFrame *frame = (wxFrame*) ancestor; + { + wxFrame *frame = (wxFrame*) ancestor; wxMenuBar *menubar = frame->GetMenuBar(); - if (menubar) - { + if (menubar) + { wxNode *node = menubar->GetMenus().First(); - if (node) - { - // doesn't work correctly + if (node) + { + // doesn't work correctly // wxMenu *firstMenu = (wxMenu*) node->Data(); - // gtk_menu_item_select( GTK_MENU_ITEM(firstMenu->m_owner) ); - // ret = TRUE; - break; - } - } - } + // gtk_menu_item_select( GTK_MENU_ITEM(firstMenu->m_owner) ); + // ret = TRUE; + break; + } + } + } ancestor = ancestor->GetParent(); } } @@ -887,7 +887,7 @@ static gint gtk_window_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_e static gint gtk_window_key_release_callback( GtkWidget *widget, GdkEventKey *gdk_event, wxWindow *win ) { - if (g_isIdle) + if (g_isIdle) wxapp_install_idle_handler(); if (!win->m_hasVMT) return FALSE; @@ -907,7 +907,7 @@ static gint gtk_window_key_release_callback( GtkWidget *widget, GdkEventKey *gdk */ long key_code = map_to_unmodified_wx_keysym( gdk_event->keyval ); - + /* sending unknown key events doesn't really make sense */ if (key_code == 0) return FALSE; @@ -943,7 +943,7 @@ static gint gtk_window_key_release_callback( GtkWidget *widget, GdkEventKey *gdk static gint gtk_window_button_press_callback( GtkWidget *widget, GdkEventButton *gdk_event, wxWindow *win ) { - if (g_isIdle) + if (g_isIdle) wxapp_install_idle_handler(); /* @@ -1097,7 +1097,7 @@ static gint gtk_window_button_press_callback( GtkWidget *widget, GdkEventButton static gint gtk_window_button_release_callback( GtkWidget *widget, GdkEventButton *gdk_event, wxWindow *win ) { - if (g_isIdle) + if (g_isIdle) wxapp_install_idle_handler(); if (!win->m_hasVMT) return FALSE; @@ -1205,7 +1205,7 @@ static gint gtk_window_button_release_callback( GtkWidget *widget, GdkEventButto static gint gtk_window_motion_notify_callback( GtkWidget *widget, GdkEventMotion *gdk_event, wxWindow *win ) { - if (g_isIdle) + if (g_isIdle) wxapp_install_idle_handler(); if (!win->m_hasVMT) return FALSE; @@ -1316,7 +1316,7 @@ static gint gtk_window_motion_notify_callback( GtkWidget *widget, GdkEventMotion static gint gtk_window_focus_in_callback( GtkWidget *widget, GdkEvent *WXUNUSED(event), wxWindow *win ) { - if (g_isIdle) + if (g_isIdle) wxapp_install_idle_handler(); if (!win->m_hasVMT) return FALSE; @@ -1366,7 +1366,7 @@ static gint gtk_window_focus_in_callback( GtkWidget *widget, GdkEvent *WXUNUSED( static gint gtk_window_focus_out_callback( GtkWidget *widget, GdkEvent *WXUNUSED(event), wxWindow *win ) { - if (g_isIdle) + if (g_isIdle) wxapp_install_idle_handler(); if (!win->m_hasVMT) return FALSE; @@ -1403,7 +1403,7 @@ static gint gtk_window_focus_out_callback( GtkWidget *widget, GdkEvent *WXUNUSED static gint gtk_window_enter_callback( GtkWidget *widget, GdkEventCrossing *gdk_event, wxWindow *win ) { - if (g_isIdle) + if (g_isIdle) wxapp_install_idle_handler(); if (!win->m_hasVMT) return FALSE; @@ -1449,14 +1449,14 @@ static gint gtk_window_enter_callback( GtkWidget *widget, GdkEventCrossing *gdk_ static gint gtk_window_leave_callback( GtkWidget *widget, GdkEventCrossing *gdk_event, wxWindow *win ) { - if (g_isIdle) + if (g_isIdle) wxapp_install_idle_handler(); if (!win->m_hasVMT) return FALSE; if (g_blockEventsOnDrag) return FALSE; if (!win->IsOwnGtkWindow( gdk_event->window )) return FALSE; - + wxMouseEvent event( wxEVT_LEAVE_WINDOW ); #if (GTK_MINOR_VERSION > 0) event.SetTimestamp( gdk_event->time ); @@ -1495,7 +1495,7 @@ static gint gtk_window_leave_callback( GtkWidget *widget, GdkEventCrossing *gdk_ static void gtk_window_vscroll_callback( GtkWidget *WXUNUSED(widget), wxWindow *win ) { - if (g_isIdle) + if (g_isIdle) wxapp_install_idle_handler(); if (g_blockEventsOnDrag) return; @@ -1539,7 +1539,7 @@ static void gtk_window_vscroll_callback( GtkWidget *WXUNUSED(widget), wxWindow * static void gtk_window_hscroll_callback( GtkWidget *WXUNUSED(widget), wxWindow *win ) { - if (g_isIdle) + if (g_isIdle) wxapp_install_idle_handler(); if (g_blockEventsOnDrag) return; @@ -1582,7 +1582,7 @@ static void gtk_window_hscroll_callback( GtkWidget *WXUNUSED(widget), wxWindow * static void gtk_window_vscroll_change_callback( GtkWidget *WXUNUSED(widget), wxWindow *win ) { - if (g_isIdle) + if (g_isIdle) wxapp_install_idle_handler(); if (g_blockEventsOnDrag) return; @@ -1602,7 +1602,7 @@ static void gtk_window_vscroll_change_callback( GtkWidget *WXUNUSED(widget), wxW static void gtk_window_hscroll_change_callback( GtkWidget *WXUNUSED(widget), wxWindow *win ) { - if (g_isIdle) + if (g_isIdle) wxapp_install_idle_handler(); if (g_blockEventsOnDrag) return; @@ -1624,7 +1624,7 @@ static gint gtk_scrollbar_button_press_callback( GtkRange *WXUNUSED(widget), GdkEventButton *WXUNUSED(gdk_event), wxWindow *win ) { - if (g_isIdle) + if (g_isIdle) wxapp_install_idle_handler(); // don't test here as we can release the mouse while being over @@ -1683,7 +1683,7 @@ wxWindow *wxWindowBase::FindFocus() static gint gtk_window_realized_callback( GtkWidget * WXUNUSED(widget), wxWindow *win ) { - if (g_isIdle) + if (g_isIdle) wxapp_install_idle_handler(); if (win->m_delayedFont) @@ -1696,7 +1696,7 @@ gtk_window_realized_callback( GtkWidget * WXUNUSED(widget), wxWindow *win ) win->SetForegroundColour( win->GetForegroundColour() ); win->SetCursor( win->GetCursor() ); - + wxWindowCreateEvent event( win ); event.SetEventObject( win ); win->GetEventHandler()->ProcessEvent( event ); @@ -1962,25 +1962,25 @@ wxWindow::~wxWindow() if (m_widgetStyle) { gtk_style_unref( m_widgetStyle ); - m_widgetStyle = (GtkStyle*) NULL; + m_widgetStyle = (GtkStyle*) NULL; } if (m_scrollGC) { gdk_gc_unref( m_scrollGC ); - m_scrollGC = (GdkGC*) NULL; + m_scrollGC = (GdkGC*) NULL; } if (m_wxwindow) { gtk_widget_destroy( m_wxwindow ); - m_wxwindow = (GtkWidget*) NULL; + m_wxwindow = (GtkWidget*) NULL; } if (m_widget) { gtk_widget_destroy( m_widget ); - m_widget = (GtkWidget*) NULL; + m_widget = (GtkWidget*) NULL; } } @@ -2049,7 +2049,7 @@ void wxWindow::PostCreation() /* we cannot set colours, fonts and cursors before the widget has been realized, so we do this directly after realization */ gtk_signal_connect( GTK_OBJECT(connect_widget), "realize", - GTK_SIGNAL_FUNC(gtk_window_realized_callback), (gpointer) this ); + GTK_SIGNAL_FUNC(gtk_window_realized_callback), (gpointer) this ); m_hasVMT = TRUE; } @@ -2142,42 +2142,42 @@ void wxWindow::DoSetSize( int x, int y, int width, int height, int sizeFlags ) if ((m_maxHeight != -1) && (m_height > m_maxHeight)) m_height = m_maxHeight; int border = 0; - int bottom_border = 0; + int bottom_border = 0; if (GTK_WIDGET_CAN_DEFAULT(m_widget)) - { - /* the default button has a border around it */ - border = 6; - bottom_border = 5; - } - - /* this is the result of hours of debugging: the following code - means that if we have a m_wxwindow and we set the size of - m_widget, m_widget (which is a GtkScrolledWindow) does NOT - automatically propagate its size down to its m_wxwindow, - which is its client area. therefore, we have to tell the - client area directly that it has to resize itself. - this will lead to that m_widget (GtkScrolledWindow) will - calculate how much size it needs for scrollbars etc and - it will then call XXX_size_allocate of its child, which - is m_wxwindow. m_wxwindow in turn will do the same with its - children and so on. problems can arise if this happens - before all the children have been realized as some widgets - stupidy need to be realized during XXX_size_allocate (e.g. - GtkNotebook) and they will segv if called otherwise. this - emergency is tested in gtk_myfixed_size_allocate. Normally - this shouldn't be needed and only gtk_widget_queue_resize() - should be enough to provoke a resize at the next appropriate - moment, but this seems to fail, e.g. when a wxNotebook contains - a wxSplitterWindow: the splitter window's children won't - show up properly resized then. */ - - gtk_myfixed_set_size( GTK_MYFIXED(m_parent->m_wxwindow), - m_widget, - m_x-border, - m_y-border, - m_width+2*border, - m_height+border+bottom_border ); + { + /* the default button has a border around it */ + border = 6; + bottom_border = 5; + } + + /* this is the result of hours of debugging: the following code + means that if we have a m_wxwindow and we set the size of + m_widget, m_widget (which is a GtkScrolledWindow) does NOT + automatically propagate its size down to its m_wxwindow, + which is its client area. therefore, we have to tell the + client area directly that it has to resize itself. + this will lead to that m_widget (GtkScrolledWindow) will + calculate how much size it needs for scrollbars etc and + it will then call XXX_size_allocate of its child, which + is m_wxwindow. m_wxwindow in turn will do the same with its + children and so on. problems can arise if this happens + before all the children have been realized as some widgets + stupidy need to be realized during XXX_size_allocate (e.g. + GtkNotebook) and they will segv if called otherwise. this + emergency is tested in gtk_myfixed_size_allocate. Normally + this shouldn't be needed and only gtk_widget_queue_resize() + should be enough to provoke a resize at the next appropriate + moment, but this seems to fail, e.g. when a wxNotebook contains + a wxSplitterWindow: the splitter window's children won't + show up properly resized then. */ + + gtk_myfixed_set_size( GTK_MYFIXED(m_parent->m_wxwindow), + m_widget, + m_x-border, + m_y-border, + m_width+2*border, + m_height+border+bottom_border ); } m_sizeSet = TRUE; @@ -2196,13 +2196,13 @@ void wxWindow::OnInternalIdle() { wxCursor cursor = m_cursor; if (g_globalCursor.Ok()) cursor = g_globalCursor; - - if (cursor.Ok() && m_currentGdkCursor != cursor) - { - gdk_window_set_cursor( window, cursor.GetCursor() ); - m_currentGdkCursor = cursor; - } - } + + if (cursor.Ok() && m_currentGdkCursor != cursor) + { + gdk_window_set_cursor( window, cursor.GetCursor() ); + m_currentGdkCursor = cursor; + } + } UpdateWindowUI(); } @@ -2513,7 +2513,7 @@ bool wxWindow::AcceptsFocus() const bool wxWindow::Reparent( wxWindow *newParent ) { wxCHECK_MSG( (m_widget != NULL), FALSE, _T("invalid window") ); - + wxWindow *oldParent = m_parent; if ( !wxWindowBase::Reparent(newParent) ) @@ -2523,27 +2523,27 @@ bool wxWindow::Reparent( wxWindow *newParent ) { gtk_container_remove( GTK_CONTAINER(oldParent->m_wxwindow), m_widget ); } - + if (newParent) { /* insert GTK representation */ (*(newParent->m_insertCallback))(newParent, this); } - + return TRUE; } -void wxWindow::DoAddChild(wxWindow *child) +void wxWindow::DoAddChild(wxWindow *child) { wxASSERT_MSG( (m_widget != NULL), _T("invalid window") ); wxASSERT_MSG( (child != NULL), _T("invalid child window") ); wxASSERT_MSG( (m_insertCallback != NULL), _T("invalid child insertion function") ); - + /* add to list */ AddChild( child ); - + /* insert GTK representation */ (*m_insertCallback)(this, child); } @@ -2576,16 +2576,16 @@ bool wxWindow::SetCursor( const wxCursor &cursor ) // been realized if (!m_delayedCursor) return FALSE; } - + GtkWidget *connect_widget = GetConnectWidget(); if (!connect_widget->window) { // indicate that a new style has been set - // but it couldn't get applied as the - // widget hasn't been realized yet. - m_delayedCursor = TRUE; - - // pretend we have done something + // but it couldn't get applied as the + // widget hasn't been realized yet. + m_delayedCursor = TRUE; + + // pretend we have done something return TRUE; } @@ -2603,7 +2603,7 @@ void wxWindow::WarpPointer( int x, int y ) if (connect_widget->window) { /* we provide this function ourselves as it is - missing in GDK */ + missing in GDK */ gdk_window_warp_pointer( connect_widget->window, x, y ); } } @@ -2687,16 +2687,16 @@ bool wxWindow::SetBackgroundColour( const wxColour &colour ) // been realized if (!m_delayedBackgroundColour) return FALSE; } - + GtkWidget *connect_widget = GetConnectWidget(); if (!connect_widget->window) { // indicate that a new style has been set - // but it couldn't get applied as the - // widget hasn't been realized yet. - m_delayedBackgroundColour = TRUE; - - // pretend we have done something + // but it couldn't get applied as the + // widget hasn't been realized yet. + m_delayedBackgroundColour = TRUE; + + // pretend we have done something return TRUE; } @@ -2734,16 +2734,16 @@ bool wxWindow::SetForegroundColour( const wxColour &colour ) // been realized if (!m_delayedForegroundColour) return FALSE; } - + GtkWidget *connect_widget = GetConnectWidget(); if (!connect_widget->window) { // indicate that a new style has been set - // but it couldn't get applied as the - // widget hasn't been realized yet. - m_delayedForegroundColour = TRUE; - - // pretend we have done something + // but it couldn't get applied as the + // widget hasn't been realized yet. + m_delayedForegroundColour = TRUE; + + // pretend we have done something return TRUE; } @@ -2890,7 +2890,7 @@ bool wxWindow::IsOwnGtkWindow( GdkWindow *window ) bool wxWindow::SetFont( const wxFont &font ) { - wxCHECK_MSG( m_widget != NULL, FALSE, _T( "invalid window") ); + wxCHECK_MSG( m_widget != NULL, FALSE, _T( "invalid window") ); if (!wxWindowBase::SetFont(font)) { @@ -2898,16 +2898,16 @@ bool wxWindow::SetFont( const wxFont &font ) // been realized if (!m_delayedFont) return FALSE; } - + GtkWidget *connect_widget = GetConnectWidget(); if (!connect_widget->window) { // indicate that a new style has been set - // but it couldn't get applied as the - // widget hasn't been realized yet. - m_delayedFont = TRUE; - - // pretend we have done something + // but it couldn't get applied as the + // widget hasn't been realized yet. + m_delayedFont = TRUE; + + // pretend we have done something return TRUE; } @@ -2934,7 +2934,7 @@ void wxWindow::CaptureMouse() GtkWidget *connect_widget = GetConnectWidget(); if (!connect_widget->window) return; - + gdk_pointer_grab( connect_widget->window, FALSE, (GdkEventMask) (GDK_BUTTON_PRESS_MASK | @@ -2954,7 +2954,7 @@ void wxWindow::ReleaseMouse() GtkWidget *connect_widget = GetConnectWidget(); if (!connect_widget->window) return; - + gdk_pointer_ungrab ( GDK_CURRENT_TIME ); g_captureWindow = (wxWindow*) NULL; } @@ -3114,16 +3114,16 @@ void wxWindow::ScrollWindow( int dx, int dy, const wxRect* WXUNUSED(rect) ) m_scrollGC = gdk_gc_new( m_wxwindow->window ); gdk_gc_set_exposures( m_scrollGC, TRUE ); } - + wxNode *node = m_children.First(); while (node) { wxWindow *child = (wxWindow*) node->Data(); - int sx = 0; - int sy = 0; - child->GetSize( &sx, &sy ); - child->SetSize( child->m_x + dx, child->m_y + dy, sx, sy, wxSIZE_ALLOW_MINUS_ONE ); - node = node->Next(); + int sx = 0; + int sy = 0; + child->GetSize( &sx, &sy ); + child->SetSize( child->m_x + dx, child->m_y + dy, sx, sy, wxSIZE_ALLOW_MINUS_ONE ); + node = node->Next(); } int cw = 0; @@ -3131,7 +3131,7 @@ void wxWindow::ScrollWindow( int dx, int dy, const wxRect* WXUNUSED(rect) ) GetClientSize( &cw, &ch ); int w = cw - abs(dx); int h = ch - abs(dy); - + if ((h < 0) || (w < 0)) { Refresh(); diff --git a/src/msw/Makefile.am b/src/msw/Makefile.am index 64da4228f6..31294a6914 100644 --- a/src/msw/Makefile.am +++ b/src/msw/Makefile.am @@ -51,6 +51,7 @@ libwx_msw_la_SOURCES = \ date.cpp \ datstrm.cpp \ dcbase.cpp \ + dlgcmn.cpp \ docmdi.cpp \ docview.cpp \ dynlib.cpp \ @@ -114,6 +115,7 @@ libwx_msw_la_SOURCES = \ statusbr.cpp \ tabg.cpp \ textdlgg.cpp \ + tipdlg.cpp \ \ accel.cpp \ app.cpp \ diff --git a/src/msw/accel.cpp b/src/msw/accel.cpp index fbd23d9939..1a2c5d78af 100644 --- a/src/msw/accel.cpp +++ b/src/msw/accel.cpp @@ -38,8 +38,8 @@ class WXDLLEXPORT wxAcceleratorRefData: public wxObjectRefData { friend class WXDLLEXPORT wxAcceleratorTable; public: - wxAcceleratorRefData(void); - ~wxAcceleratorRefData(void); + wxAcceleratorRefData(); + ~wxAcceleratorRefData(); inline HACCEL GetHACCEL() const { return m_hAccel; } protected: @@ -132,13 +132,14 @@ wxAcceleratorTable::wxAcceleratorTable(int n, const wxAcceleratorEntry entries[] M_ACCELDATA->m_ok = (M_ACCELDATA->m_hAccel != 0); } -#else +#else // Win16 wxAcceleratorTable::wxAcceleratorTable(int WXUNUSED(n), const wxAcceleratorEntry WXUNUSED(entries)[]) { + wxFAIL_MSG("not implemented"); } -#endif +#endif // Win32/16 -bool wxAcceleratorTable::Ok(void) const +bool wxAcceleratorTable::Ok() const { return (M_ACCELDATA && (M_ACCELDATA->m_ok)); } @@ -158,3 +159,8 @@ WXHACCEL wxAcceleratorTable::GetHACCEL() const return (WXHACCEL) M_ACCELDATA->m_hAccel; } +bool wxAcceleratorTable::Translate(wxWindow *window, WXMSG *wxmsg) const +{ + MSG *msg = (MSG *)wxmsg; + + return Ok() && ::TranslateAccelerator(GetHwndOf(window), GetHaccel(), msg); } diff --git a/src/msw/frame.cpp b/src/msw/frame.cpp index 4cba2dd81f..82d435e254 100644 --- a/src/msw/frame.cpp +++ b/src/msw/frame.cpp @@ -846,10 +846,7 @@ bool wxFrame::MSWTranslateMessage(WXMSG* pMsg) return FALSE; const wxAcceleratorTable& acceleratorTable = menuBar->GetAccelTable(); - return acceleratorTable.Ok() && - ::TranslateAccelerator(GetHwnd(), - GetTableHaccel(acceleratorTable), - (MSG *)pMsg); + return acceleratorTable.Translate(this, pMsg); } // --------------------------------------------------------------------------- @@ -863,7 +860,7 @@ bool wxFrame::HandlePaint() { if ( m_iconized ) { - HICON hIcon = m_icon.Ok() ? GetIconHicon(m_icon) + HICON hIcon = m_icon.Ok() ? GetHiconOf(m_icon) : (HICON)m_defaultIcon; // Hold a pointer to the dc so long as the OnPaint() message @@ -1059,7 +1056,7 @@ long wxFrame::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam) case WM_QUERYDRAGICON: { - HICON hIcon = m_icon.Ok() ? GetIconHicon(m_icon) + HICON hIcon = m_icon.Ok() ? GetHiconOf(m_icon) : (HICON)(m_defaultIcon); rc = (long)hIcon; processed = rc != 0; diff --git a/src/msw/makefile.b32 b/src/msw/makefile.b32 index 6e357ccafc..422e3ae1a7 100644 --- a/src/msw/makefile.b32 +++ b/src/msw/makefile.b32 @@ -86,6 +86,7 @@ GENERICOBJS= \ $(MSWDIR)\statusbr.obj \ $(MSWDIR)\tabg.obj \ $(MSWDIR)\textdlgg.obj \ + $(MSWDIR)\tipdlg.obj # Not needed: # $(MSWDIR)\colrdlgg.obj \ @@ -102,6 +103,7 @@ COMMONOBJS = \ $(MSWDIR)\config.obj \ $(MSWDIR)\cmndata.obj \ $(MSWDIR)\dcbase.obj \ + $(MSWDIR)\dlgcmn.obj \ $(MSWDIR)\docview.obj \ $(MSWDIR)\docmdi.obj \ $(MSWDIR)\dynarray.obj \ @@ -239,6 +241,7 @@ MSWOBJS = \ $(MSWDIR)\spinbutt.obj \ $(MSWDIR)\statbmp.obj \ $(MSWDIR)\statbox.obj \ + $(MSWDIR)\statline.obj \ $(MSWDIR)\stattext.obj \ $(MSWDIR)\statbr95.obj \ $(MSWDIR)\tabctrl.obj \ @@ -445,6 +448,8 @@ $(MSWDIR)\statbmp.obj: $(MSWDIR)\statbmp.$(SRCSUFF) $(MSWDIR)\statbox.obj: $(MSWDIR)\statbox.$(SRCSUFF) +$(MSWDIR)\statline.obj: $(MSWDIR)\statline.$(SRCSUFF) + $(MSWDIR)\statbr95.obj: $(MSWDIR)\statbr95.$(SRCSUFF) $(MSWDIR)\stattext.obj: $(MSWDIR)\stattext.$(SRCSUFF) @@ -600,6 +605,8 @@ $(MSWDIR)\stream.obj: $(COMMDIR)\stream.$(SRCSUFF) $(MSWDIR)\objstrm.obj: $(COMMDIR)\objstrm.$(SRCSUFF) +$(MSWDIR)\dlgcmn.obj: $(COMMDIR)\dlgcmn.$(SRCSUFF) + $(MSWDIR)\wincmn.obj: $(COMMDIR)\wincmn.$(SRCSUFF) $(MSWDIR)\extended.obj: $(COMMDIR)\extended.c @@ -668,6 +675,8 @@ $(MSWDIR)\statusbr.obj: $(GENDIR)\statusbr.$(SRCSUFF) $(MSWDIR)\textdlgg.obj: $(GENDIR)\textdlgg.$(SRCSUFF) +$(MSWDIR)\tipdlg.obj: $(GENDIR)\tipdlg.$(SRCSUFF) + $(MSWDIR)\tabg.obj: $(GENDIR)\tabg.$(SRCSUFF) all_utils: diff --git a/src/msw/makefile.bcc b/src/msw/makefile.bcc index 30b77448a2..70b465d6cf 100644 --- a/src/msw/makefile.bcc +++ b/src/msw/makefile.bcc @@ -89,6 +89,7 @@ GENERICOBJS= \ $(MSWDIR)\statusbr.obj \ $(MSWDIR)\tabg.obj \ $(MSWDIR)\textdlgg.obj \ + $(MSWDIR)\tipdlg.obj \ $(MSWDIR)\treectrl.obj # $(MSWDIR)\msgdlgg.obj \ @@ -144,6 +145,7 @@ COMMONOBJS = \ $(MSWDIR)\datstrm.obj \ $(MSWDIR)\sckstrm.obj \ $(MSWDIR)\extended.obj \ + $(MSWDIR)\dlgcmn.obj \ $(MSWDIR)\wincmn.obj \ $(MSWDIR)\objstrm.obj \ $(MSWDIR)\dynlib.obj \ @@ -230,6 +232,7 @@ MSWOBJS = \ $(MSWDIR)\spinbutt.obj \ $(MSWDIR)\statbmp.obj \ $(MSWDIR)\statbox.obj \ + $(MSWDIR)\statline.obj \ $(MSWDIR)\stattext.obj \ $(MSWDIR)\tbarmsw.obj \ $(MSWDIR)\textctrl.obj \ @@ -425,6 +428,8 @@ $(MSWDIR)\statbmp.obj: $(MSWDIR)\statbmp.$(SRCSUFF) $(MSWDIR)\statbox.obj: $(MSWDIR)\statbox.$(SRCSUFF) +$(MSWDIR)\statline.obj: $(MSWDIR)\statline.$(SRCSUFF) + $(MSWDIR)\statbr95.obj: $(MSWDIR)\statbr95.$(SRCSUFF) $(MSWDIR)\stattext.obj: $(MSWDIR)\stattext.$(SRCSUFF) @@ -572,6 +577,8 @@ $(MSWDIR)\stream.obj: $(COMMDIR)\stream.$(SRCSUFF) $(MSWDIR)\objstrm.obj: $(COMMDIR)\objstrm.$(SRCSUFF) +$(MSWDIR)\dlgcmn.obj: $(COMMDIR)\dlgcmn.$(SRCSUFF) + $(MSWDIR)\wincmn.obj: $(COMMDIR)\wincmn.$(SRCSUFF) $(MSWDIR)\extended.obj: $(COMMDIR)\extended.c @@ -638,6 +645,8 @@ $(MSWDIR)\statusbr.obj: $(GENDIR)\statusbr.$(SRCSUFF) $(MSWDIR)\textdlgg.obj: $(GENDIR)\textdlgg.$(SRCSUFF) +$(MSWDIR)\tipdlg.obj: $(GENDIR)\tipdlg.$(SRCSUFF) + $(MSWDIR)\tabg.obj: $(GENDIR)\tabg.$(SRCSUFF) $(MSWDIR)\treectrl.obj: $(GENDIR)\treectrl.$(SRCSUFF) diff --git a/src/msw/makefile.dos b/src/msw/makefile.dos index 4048a14e96..a9a3678b9d 100644 --- a/src/msw/makefile.dos +++ b/src/msw/makefile.dos @@ -71,6 +71,7 @@ GENERICOBJS= \ $(GENDIR)\statusbr.obj \ $(GENDIR)\tabg.obj \ $(GENDIR)\textdlgg.obj\ + $(GENDIR)\tipdlg.obj\ $(GENDIR)\prntdlgg.obj \ $(GENDIR)\treectrl.obj @@ -128,6 +129,7 @@ COMMONOBJS = \ $(COMMDIR)\zstream.obj \ $(COMMDIR)\datstrm.obj \ $(COMMDIR)\extended.obj \ + $(COMMDIR)\dlgcmn.obj \ $(COMMDIR)\wincmn.obj \ $(COMMDIR)\wxchar.obj @@ -201,6 +203,7 @@ MSWOBJS = \ $(MSWDIR)\spinbutt.obj \ $(MSWDIR)\statbmp.obj \ $(MSWDIR)\statbox.obj \ + $(MSWDIR)\statline.obj \ $(MSWDIR)\stattext.obj \ $(MSWDIR)\tbarmsw.obj \ $(MSWDIR)\textctrl.obj \ @@ -610,6 +613,11 @@ $(MSWDIR)/statbox.obj: $*.$(SRCSUFF) $(CPPFLAGS) /Fo$@ /c /Tp $*.$(SRCSUFF) << +$(MSWDIR)/statline.obj: $*.$(SRCSUFF) + cl @<< +$(CPPFLAGS) /Fo$@ /c /Tp $*.$(SRCSUFF) +<< + $(MSWDIR)/stattext.obj: $*.$(SRCSUFF) cl @<< $(CPPFLAGS) /Fo$@ /c /Tp $*.$(SRCSUFF) @@ -948,6 +956,11 @@ $(COMMDIR)/extended.obj: $*.c $(CPPFLAGS2) /Fo$@ /c /Tp $*.c << +$(COMMDIR)/dlgcmn.obj: $*.$(SRCSUFF) + cl @<< +$(CPPFLAGS) /Fo$@ /c /Tp $*.$(SRCSUFF) +<< + $(COMMDIR)/wincmn.obj: $*.$(SRCSUFF) cl @<< $(CPPFLAGS) /Fo$@ /c /Tp $*.$(SRCSUFF) @@ -1083,6 +1096,11 @@ $(GENDIR)/textdlgg.obj: $*.$(SRCSUFF) $(CPPFLAGS) /Fo$@ /c /Tp $*.$(SRCSUFF) << +$(GENDIR)/tipdlg.obj: $*.$(SRCSUFF) + cl @<< +$(CPPFLAGS) /Fo$@ /c /Tp $*.$(SRCSUFF) +<< + $(GENDIR)/treectrl.obj: $*.$(SRCSUFF) cl @<< $(CPPFLAGS) /Fo$@ /c /Tp $*.$(SRCSUFF) diff --git a/src/msw/makefile.g95 b/src/msw/makefile.g95 index bb84243c76..bcaa1278de 100644 --- a/src/msw/makefile.g95 +++ b/src/msw/makefile.g95 @@ -69,6 +69,7 @@ GENERICOBJS= \ $(GENDIR)/statusbr.$(OBJSUFF) \ $(GENDIR)/tabg.$(OBJSUFF) \ $(GENDIR)/textdlgg.$(OBJSUFF) + $(GENDIR)/tipdlg.$(OBJSUFF) # $(GENDIR)/colrdlgg.$(OBJSUFF) \ # $(GENDIR)/fontdlgg.$(OBJSUFF) \ @@ -131,6 +132,7 @@ COMMONOBJS = \ $(COMMDIR)/datstrm.$(OBJSUFF) \ $(COMMDIR)/objstrm.$(OBJSUFF) \ $(COMMDIR)/extended.$(OBJSUFF) \ + $(COMMDIR)/dlgcmn.$(OBJSUFF) \ $(COMMDIR)/wincmn.$(OBJSUFF) \ $(COMMDIR)/wxchar.$(OBJSUFF) @@ -214,6 +216,7 @@ MSWOBJS = \ spinbutt.$(OBJSUFF) \ statbmp.$(OBJSUFF) \ statbox.$(OBJSUFF) \ + statline.$(OBJSUFF) \ statbr95.$(OBJSUFF) \ stattext.$(OBJSUFF) \ tabctrl.$(OBJSUFF) \ diff --git a/src/msw/makefile.sc b/src/msw/makefile.sc index d2d9a93acb..ae802d21f8 100644 --- a/src/msw/makefile.sc +++ b/src/msw/makefile.sc @@ -35,7 +35,8 @@ GENERICOBJS= \ $(GENDIR)\splitter.obj \ $(GENDIR)\statusbr.obj \ $(GENDIR)\tabg.obj \ - $(GENDIR)\textdlgg.obj + $(GENDIR)\textdlgg.obj \ + $(GENDIR)\tipdlg.obj # $(GENDIR)\imaglist.obj \ # $(GENDIR)\treectrl.obj \ @@ -105,6 +106,7 @@ COMMONOBJS = \ $(COMMDIR)\datstrm.obj \ $(COMMDIR)\objstrm.obj \ $(COMMDIR)\variant.obj \ + $(COMMDIR)\dlgcmn.obj \ $(COMMDIR)\wincmn.obj \ $(COMMDIR)\wxchar.obj @@ -189,6 +191,7 @@ MSWOBJS = \ $(MSWDIR)\spinbutt.obj \ $(MSWDIR)\statbmp.obj \ $(MSWDIR)\statbox.obj \ + $(MSWDIR)\statline.obj \ $(MSWDIR)\statbr95.obj \ $(MSWDIR)\stattext.obj \ $(MSWDIR)\tabctrl.obj \ diff --git a/src/msw/makefile.vc b/src/msw/makefile.vc index 6ebf727c68..4732fd0a47 100644 --- a/src/msw/makefile.vc +++ b/src/msw/makefile.vc @@ -79,7 +79,8 @@ GENERICOBJS= \ ..\generic\$D\splitter.obj \ ..\generic\$D\statusbr.obj \ ..\generic\$D\tabg.obj \ - ..\generic\$D\textdlgg.obj + ..\generic\$D\textdlgg.obj \ + ..\generic\$D\tipdlg.obj # ..\generic\$D\imaglist.obj \ # ..\generic\$D\treectrl.obj \ @@ -165,6 +166,7 @@ COMMONOBJS = \ ..\common\$D\datstrm.obj \ ..\common\$D\objstrm.obj \ ..\common\$D\variant.obj \ + ..\common\$D\dlgcmn.obj \ ..\common\$D\wincmn.obj \ ..\common\$D\wxchar.obj @@ -240,6 +242,7 @@ MSWOBJS = \ ..\msw\$D\spinbutt.obj \ ..\msw\$D\statbmp.obj \ ..\msw\$D\statbox.obj \ + ..\msw\$D\statline.obj \ ..\msw\$D\statbr95.obj \ ..\msw\$D\stattext.obj \ ..\msw\$D\tabctrl.obj \ diff --git a/src/msw/makefile.wat b/src/msw/makefile.wat index fe278f986c..04db240faa 100644 --- a/src/msw/makefile.wat +++ b/src/msw/makefile.wat @@ -39,7 +39,8 @@ GENERICOBJS= choicdgg.obj & splitter.obj & statusbr.obj & tabg.obj & - textdlgg.obj + textdlgg.obj & + tipdlg.obj # These are generic things that don't need to be compiled on MSW, # but sometimes it's useful to do so for testing purposes. @@ -112,6 +113,7 @@ COMMONOBJS = cmndata.obj & datstrm.obj & objstrm.obj & variant.obj & + dlgcmn.obj & wincmn.obj & wxchar.obj @@ -191,6 +193,7 @@ MSWOBJS = & spinbutt.obj & statbmp.obj & statbox.obj & + statline.obj & statbr95.obj & stattext.obj & tabctrl.obj & @@ -453,6 +456,9 @@ statbmp.obj: $(MSWDIR)\statbmp.cpp statbox.obj: $(MSWDIR)\statbox.cpp *$(CCC) $(CPPFLAGS) $(IFLAGS) $< +statline.obj: $(MSWDIR)\statline.cpp + *$(CCC) $(CPPFLAGS) $(IFLAGS) $< + statbr95.obj: $(MSWDIR)\statbr95.cpp *$(CCC) $(CPPFLAGS) $(IFLAGS) $< @@ -720,6 +726,9 @@ process.obj: $(COMMDIR)\process.cpp variant.obj: $(COMMDIR)\variant.cpp *$(CCC) $(CPPFLAGS) $(IFLAGS) $< +dlgcmn.obj: $(COMMDIR)\dlgcmn.cpp + *$(CCC) $(CPPFLAGS) $(IFLAGS) $< + wincmn.obj: $(COMMDIR)\wincmn.cpp *$(CCC) $(CPPFLAGS) $(IFLAGS) $< @@ -801,6 +810,9 @@ tabg.obj: $(GENDIR)\tabg.cpp textdlgg.obj: $(GENDIR)\textdlgg.cpp *$(CCC) $(CPPFLAGS) $(IFLAGS) $< +tipdlg.obj: $(GENDIR)\tipdlg.cpp + *$(CCC) $(CPPFLAGS) $(IFLAGS) $< + crbuffri.obj: $(XPMDIR)\crbuffri.c *$(CC) $(CPPFLAGS) $(IFLAGS) $< diff --git a/src/msw/mdi.cpp b/src/msw/mdi.cpp index 0a43426620..551c1cc4ec 100644 --- a/src/msw/mdi.cpp +++ b/src/msw/mdi.cpp @@ -537,10 +537,7 @@ bool wxMDIParentFrame::MSWTranslateMessage(WXMSG* msg) return TRUE; } - if ( m_acceleratorTable.Ok() && - ::TranslateAccelerator(GetHwnd(), - GetTableHaccel(m_acceleratorTable), - pMsg) ) + if ( m_acceleratorTable.Translate(this, msg) ) { return TRUE; } @@ -993,15 +990,7 @@ long wxMDIChildFrame::MSWDefWindowProc(WXUINT message, WXUINT wParam, WXLPARAM l bool wxMDIChildFrame::MSWTranslateMessage(WXMSG* msg) { - MSG *pMsg = (MSG *)msg; - if ( m_acceleratorTable.Ok() ) - { - return ::TranslateAccelerator(GetWinHwnd(GetParent()), - GetTableHaccel(m_acceleratorTable), - pMsg) != 0; - } - - return FALSE; + return m_acceleratorTable.Translate(GetParent(), msg); } // --------------------------------------------------------------------------- diff --git a/src/msw/menu.cpp b/src/msw/menu.cpp index b89b794879..ef870cc461 100644 --- a/src/msw/menu.cpp +++ b/src/msw/menu.cpp @@ -69,10 +69,6 @@ static const int idMenuTitle = -2; IMPLEMENT_DYNAMIC_CLASS(wxMenuBar, wxEvtHandler) #endif -// convenience macros -#define GetHMENU() ((HMENU)GetHMenu()) -#define GetHMenuOf(menu) ((HMENU)menu->GetHMenu()) - // ============================================================================ // implementation // ============================================================================ @@ -257,7 +253,7 @@ void wxMenu::Append(wxMenuItem *pItem) pData = label; } - if ( !::AppendMenu(GetHMENU(), flags, id, pData) ) + if ( !::AppendMenu(GetHmenu(), flags, id, pData) ) { wxLogLastError("AppendMenu"); } @@ -272,7 +268,7 @@ void wxMenu::Append(wxMenuItem *pItem) mii.fMask = MIIM_STATE; mii.fState = MFS_DEFAULT; - if ( !SetMenuItemInfo(GetHMENU(), (unsigned)id, FALSE, &mii) ) + if ( !SetMenuItemInfo(GetHmenu(), (unsigned)id, FALSE, &mii) ) { wxLogLastError(_T("SetMenuItemInfo")); } @@ -323,7 +319,7 @@ void wxMenu::Delete(int id) wxCHECK_RET( node, _T("wxMenu::Delete(): item doesn't exist") ); - HMENU menu = GetHMENU(); + HMENU menu = GetHmenu(); wxMenu *pSubMenu = item->GetSubMenu(); if ( pSubMenu != NULL ) { @@ -453,7 +449,7 @@ void wxMenu::SetTitle(const wxString& label) bool hasNoTitle = m_title.IsEmpty(); m_title = label; - HMENU hMenu = GetHMENU(); + HMENU hMenu = GetHmenu(); if ( hasNoTitle ) { @@ -622,27 +618,6 @@ wxMenuItem *wxMenu::FindItemForId(int itemId, wxMenu ** itemMenu) const // other // --------------------------------------------------------------------------- -bool wxWindow::PopupMenu(wxMenu *menu, int x, int y) -{ - menu->SetInvokingWindow(this); - menu->UpdateUI(); - - HWND hWnd = (HWND) GetHWND(); - HMENU hMenu = (HMENU)menu->GetHMenu(); - POINT point; - point.x = x; - point.y = y; - ::ClientToScreen(hWnd, &point); - wxCurrentPopupMenu = menu; - ::TrackPopupMenu(hMenu, TPM_RIGHTBUTTON, point.x, point.y, 0, hWnd, NULL); - wxYield(); - wxCurrentPopupMenu = NULL; - - menu->SetInvokingWindow(NULL); - - return TRUE; -} - void wxMenu::Attach(wxMenuBar *menubar) { // menu can be in at most one menubar because otherwise they would both @@ -793,7 +768,7 @@ bool wxMenuBar::IsChecked(int id) const wxCHECK_MSG( item, FALSE, _T("wxMenuBar::IsChecked(): no such item") ); - int flag = ::GetMenuState(GetHMenuOf(itemMenu), id, MF_BYCOMMAND); + int flag = ::GetMenuState(GetHmenuOf(itemMenu), id, MF_BYCOMMAND); return (flag & MF_CHECKED) != 0; } @@ -805,7 +780,7 @@ bool wxMenuBar::IsEnabled(int id) const wxCHECK_MSG( item, FALSE, _T("wxMenuBar::IsEnabled(): no such item") ); - int flag = ::GetMenuState(GetHMenuOf(itemMenu), id, MF_BYCOMMAND) ; + int flag = ::GetMenuState(GetHmenuOf(itemMenu), id, MF_BYCOMMAND) ; return (flag & MF_ENABLED) != 0; } @@ -879,7 +854,7 @@ void wxMenuBar::SetLabelTop(int pos, const wxString& label) id = pos; } - if ( ::ModifyMenu(GetHMENU(), pos, MF_BYPOSITION | MF_STRING | flagsOld, + if ( ::ModifyMenu(GetHmenu(), pos, MF_BYPOSITION | MF_STRING | flagsOld, id, label) == 0xFFFFFFFF ) { wxLogLastError("ModifyMenu"); @@ -892,7 +867,7 @@ wxString wxMenuBar::GetLabelTop(int pos) const len++; // for the NUL character wxString label; - ::GetMenuString(GetHMENU(), pos, label.GetWriteBuf(len), len, MF_BYCOMMAND); + ::GetMenuString(GetHmenu(), pos, label.GetWriteBuf(len), len, MF_BYCOMMAND); label.UngetWriteBuf(); return label; @@ -938,7 +913,7 @@ bool wxMenuBar::OnAppend(wxMenu *a_menu, const wxChar *title) a_menu->Attach(this); - if ( !::AppendMenu(GetHMENU(), MF_POPUP | MF_STRING, + if ( !::AppendMenu(GetHmenu(), MF_POPUP | MF_STRING, (UINT)submenu, title) ) { wxLogLastError(_T("AppendMenu")); diff --git a/src/msw/statline.cpp b/src/msw/statline.cpp new file mode 100644 index 0000000000..2e55df4d40 --- /dev/null +++ b/src/msw/statline.cpp @@ -0,0 +1,82 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: msw/statline.cpp +// Purpose: MSW version of wxStaticLine class +// Author: Vadim Zeitlin +// Created: 28.06.99 +// Version: $Id$ +// Copyright: (c) 1998 Vadim Zeitlin +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +// ============================================================================ +// declarations +// ============================================================================ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#ifdef __GNUG__ + #pragma implementation "statline.h" +#endif + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#include "wx/statline.h" + +#include "wx/msw/private.h" + +// ============================================================================ +// implementation +// ============================================================================ + +IMPLEMENT_DYNAMIC_CLASS(wxStaticLine, wxControl) + +// ---------------------------------------------------------------------------- +// wxStaticLine +// ---------------------------------------------------------------------------- + +bool wxStaticLine::Create( wxWindow *parent, + wxWindowID id, + const wxPoint &pos, + const wxSize &size, + long style, + const wxString &name) +{ + if ( !CreateBase(parent, id, pos, size, style, name) ) + return FALSE; + + parent->AddChild(this); + + wxSize sizeReal = AdjustSize(size); + + m_hWnd = (WXHWND)::CreateWindow + ( + _T("STATIC"), + "", + WS_VISIBLE | WS_CHILD | + SS_GRAYRECT | SS_SUNKEN,// | SS_ETCHEDFRAME, + pos.x, pos.y, sizeReal.x, sizeReal.y, + GetWinHwnd(parent), + (HMENU)m_windowId, + wxGetInstance(), + NULL + ); + + if ( !m_hWnd ) + { + wxLogDebug(_T("Failed to create static control")); + + return FALSE; + } + + SubclassWin(m_hWnd); + + return TRUE; +} + diff --git a/src/msw/textctrl.cpp b/src/msw/textctrl.cpp index d166ede2c2..97dfca82bd 100644 --- a/src/msw/textctrl.cpp +++ b/src/msw/textctrl.cpp @@ -1280,3 +1280,8 @@ void wxTextCtrl::OnUpdateRedo(wxUpdateUIEvent& event) event.Enable( CanRedo() ); } +bool wxTextCtrl::AcceptsFocus() const +{ + // we don't want focus if we can't be edited + return IsEditable() && wxControl::AcceptsFocus(); +} diff --git a/src/msw/window.cpp b/src/msw/window.cpp index ac5c4cac6d..dd54ee8e9b 100644 --- a/src/msw/window.cpp +++ b/src/msw/window.cpp @@ -281,11 +281,10 @@ wxWindow::~wxWindow() { if ( !::DestroyWindow(GetHwnd()) ) wxLogLastError("DestroyWindow"); - } - // Restore old Window proc, if required and remove hWnd <-> wxWindow - // association - UnsubclassWin(); + // remove hWnd <-> wxWindow association + wxRemoveHandleAssociation(this); + } } // real construction (Init() must have been called before!) @@ -328,7 +327,6 @@ bool wxWindow::Create(wxWindow *parent, wxWindowID id, // want everything: i.e. all keys and WM_CHAR message m_lDlgCode = DLGC_WANTARROWS | DLGC_WANTCHARS | DLGC_WANTTAB | DLGC_WANTMESSAGE; - } MSWCreate(m_windowId, parent, wxCanvasClassName, this, NULL, @@ -448,7 +446,7 @@ bool wxWindow::SetFont(const wxFont& font) wxASSERT_MSG( hFont, _T("should have valid font") ); - ::SendMessage(hWnd, WM_SETFONT, (WPARAM)hFont, TRUE); + ::SendMessage(hWnd, WM_SETFONT, (WPARAM)hFont, MAKELPARAM(TRUE, 0)); } return TRUE; @@ -801,10 +799,13 @@ void wxWindow::SubclassWin(WXHWND hWnd) { wxASSERT_MSG( !m_oldWndProc, _T("subclassing window twice?") ); - wxAssociateWinWithHandle((HWND)hWnd, this); + HWND hwnd = (HWND)hWnd; + wxCHECK_RET( ::IsWindow(hwnd), _T("invalid HWND in SubclassWin") ); + + wxAssociateWinWithHandle(hwnd, this); - m_oldWndProc = (WXFARPROC) GetWindowLong((HWND) hWnd, GWL_WNDPROC); - SetWindowLong((HWND) hWnd, GWL_WNDPROC, (LONG) wxWndProc); + m_oldWndProc = (WXFARPROC) GetWindowLong(hwnd, GWL_WNDPROC); + SetWindowLong(hwnd, GWL_WNDPROC, (LONG) wxWndProc); } void wxWindow::UnsubclassWin() @@ -812,16 +813,19 @@ void wxWindow::UnsubclassWin() wxRemoveHandleAssociation(this); // Restore old Window proc - if ( GetHwnd() ) + HWND hwnd = GetHwnd(); + if ( hwnd ) { - FARPROC farProc = (FARPROC) GetWindowLong(GetHwnd(), GWL_WNDPROC); + m_hWnd = 0; + + wxCHECK_RET( ::IsWindow(hwnd), _T("invalid HWND in SubclassWin") ); + + FARPROC farProc = (FARPROC) GetWindowLong(hwnd, GWL_WNDPROC); if ( (m_oldWndProc != 0) && (farProc != (FARPROC) m_oldWndProc) ) { - SetWindowLong(GetHwnd(), GWL_WNDPROC, (LONG) m_oldWndProc); + SetWindowLong(hwnd, GWL_WNDPROC, (LONG) m_oldWndProc); m_oldWndProc = 0; } - - m_hWnd = 0; } } @@ -1368,6 +1372,31 @@ void wxWindow::GetCaretPos(int *x, int *y) const } #endif // wxUSE_CARET +// --------------------------------------------------------------------------- +// popup menu +// --------------------------------------------------------------------------- + +bool wxWindow::PopupMenu(wxMenu *menu, int x, int y) +{ + menu->SetInvokingWindow(this); + menu->UpdateUI(); + + HWND hWnd = GetHwnd(); + HMENU hMenu = GetHmenuOf(menu); + POINT point; + point.x = x; + point.y = y; + ::ClientToScreen(hWnd, &point); + wxCurrentPopupMenu = menu; + ::TrackPopupMenu(hMenu, TPM_RIGHTBUTTON, point.x, point.y, 0, hWnd, NULL); + wxYield(); + wxCurrentPopupMenu = NULL; + + menu->SetInvokingWindow(NULL); + + return TRUE; +} + // =========================================================================== // pre/post message processing // =========================================================================== @@ -1454,9 +1483,28 @@ bool wxWindow::MSWProcessMessage(WXMSG* pMsg) // buttons want process Enter themselevs bProcess = FALSE; } - // else: but if it does not it makes sense to make it - // work like a TAB - and that's what we do. - // Note that Ctrl-Enter always works this way. + else + { + wxPanel *panel = wxDynamicCast(this, wxPanel); + wxButton *btn = NULL; + if ( panel ) + { + // panel may have a default button which should + // be activated by Enter + btn = panel->GetDefaultItem(); + } + + if ( btn ) + { + // if we do have a default button, do press it + btn->MSWCommand(BN_CLICKED, 0 /* unused */); + + return TRUE; + } + // else: but if it does not it makes sense to make + // it work like a TAB - and that's what we do. + // Note that Ctrl-Enter always works this way. + } } break; @@ -1504,10 +1552,7 @@ bool wxWindow::MSWProcessMessage(WXMSG* pMsg) bool wxWindow::MSWTranslateMessage(WXMSG* pMsg) { - return m_acceleratorTable.Ok() && - ::TranslateAccelerator(GetHwnd(), - GetTableHaccel(m_acceleratorTable), - (MSG *)pMsg); + return m_acceleratorTable.Translate(this, pMsg); } // --------------------------------------------------------------------------- diff --git a/utils/wxPython/src/makefile.nt b/utils/wxPython/src/makefile.nt new file mode 100644 index 0000000000..42d9af86b7 --- /dev/null +++ b/utils/wxPython/src/makefile.nt @@ -0,0 +1,339 @@ +#---------------------------------------------------------------------------- +# Name: makefile.nt +# Purpose: Win32, VC++ 5 makefile for wxPython +# +# Author: Robin Dunn +# +# Created: 3/27/97 +# RCS-ID: $Id$ +# Copyright: (c) 1998 by Total Control Software +# Licence: wxWindows license +#---------------------------------------------------------------------------- +VERSION=0.5.4 + +# Set WXDIR to the root wxWindows directory for your system +WXDIR = $(WXWIN) + +# Set this to the root of the Python installation +PYTHONDIR=d:\Python + +# Set this to 1 for a non-debug, optimised compile +FINAL=0 + +# Set this to where you want the stuff installed at. It should +# be a directory contained in a PYTHONPATH directory, and should be +# named wxPython +TARGETDIR=.. + +# Set this to 1 for make to pre-compile the Python modules, 0 to +# just copy the sources and let Python compile them at the first +# runtime. +COMPILEPY=0 + +SEPARATE=0 + +#---------------------------------------------------------------------- + +WXUSINGDLL=0 +NOPCH=1 +THISDIR=$(WXDIR)\utils\wxPython + +EXTRALIBS=$(PYTHONDIR)\libs\python15.lib +EXTRAINC=-I$(PYTHONDIR)\include -I. +EXTRAFLAGS=/Fpwxp.pch /YXhelpers.h -DSWIG_GLOBAL -DHAVE_CONFIG_H +OVERRIDEFLAGS=/GX- + + +SWIGFLAGS=-c++ -shadow -python -dnone -D__WXMSW__ +GENCODEDIR=msw + + +!include $(WXDIR)\src\ntwxwin.mak + +#---------------------------------------------------------------------- + +TARGET = wxc + +OBJECTS = wx.obj helpers.obj windows.obj events.obj \ + misc.obj gdi.obj mdi.obj controls.obj \ + controls2.obj windows2.obj cmndlgs.obj stattool.obj \ + frames.obj windows3.obj \ +!if "$(SEPARATE)" == "0" + utils.obj +!else + +TARGET2 = utilsc +OBJECTS2 = utils.obj +target2=$(TARGETDIR)\$(TARGET2).pyd +!endif + +PYMODULES = $(TARGETDIR)\wx.py $(TARGETDIR)\events.py \ + $(TARGETDIR)\windows.py $(TARGETDIR)\misc.py \ + $(TARGETDIR)\gdi.py $(TARGETDIR)\mdi.py \ + $(TARGETDIR)\controls.py $(TARGETDIR)\controls2.py \ + $(TARGETDIR)\windows2.py $(TARGETDIR)\cmndlgs.py \ + $(TARGETDIR)\stattool.py $(TARGETDIR)\frames.py \ + $(TARGETDIR)\utils.py $(TARGETDIR)\windows3.py \ + $(TARGETDIR)\__init__.py + + +#---------------------------------------------------------------------- + +!if "$(FINAL)" == "0" +DEBUGLFLAGS = /DEBUG /INCREMENTAL:YES +!else +DEBUGLFLAGS = /INCREMENTAL:NO +!endif + +LFLAGS= $(DEBUGLFLAGS) /DLL /def:$(TARGET).def /subsystem:windows,3.50 \ + /machine:I386 /implib:./$(TARGET).lib /nologo + +LFLAGS2=$(DEBUGLFLAGS) /DLL /def:$(TARGET2).def /subsystem:windows,3.50 \ + /machine:I386 /implib:./$(TARGET2).lib /nologo + +#---------------------------------------------------------------------- + +default: $(TARGETDIR)\$(TARGET).pyd $(target2) pycfiles + +all: wx $(TARGET) $(TARGET2) + +wx: + cd $(WXDIR)\src\msw + nmake -f makefile.nt FINAL=$(FINAL) + cd $(THISDIR) + +wxclean: + cd $(WXDIR)\src\msw + nmake -f makefile.nt clean + cd $(THISDIR) + + +pycfiles : $(PYMODULES) +!if "$(COMPILEPY)" == "1" + $(PYTHONDIR)\python $(PYTHONDIR)\Lib\compileall.py -l $(TARGETDIR) + $(PYTHONDIR)\python -O $(PYTHONDIR)\Lib\compileall.py -l $(TARGETDIR) +!endif + +#---------------------------------------------------------------------- + +$(TARGETDIR)\$(TARGET).pyd : $(DUMMYOBJ) $(WXLIB) $(OBJECTS) $(TARGET).res + $(link) @<< +/out:$@ /dll +$(LFLAGS) +$(DUMMYOBJ) $(OBJECTS) $(TARGET).res +$(LIBS) +<< + +$(TARGETDIR)\$(TARGET2).pyd : $(DUMMYOBJ) $(WXLIB) $(OBJECTS2) + $(link) @<< +/out:$@ /dll +$(LFLAGS2) +$(DUMMYOBJ) $(OBJECTS2) +$(LIBS) +<< + + +$(TARGET).res : $(TARGET).rc $(WXDIR)\include\wx\msw\wx.rc + $(rc) -r /i$(WXDIR)\include -fo$@ $(TARGET).rc + + + +# implicit rule for compiling .cpp files +{}.cpp{}.obj: + $(cc) @<< +$(CPPFLAGS) /c /Tp $< +<< + +{$(GENCODEDIR)}.cpp{}.obj: + $(cc) @<< +$(CPPFLAGS) /c /Tp $< +<< + + +clean: + -erase *.obj + -erase *.exe + -erase *.res + -erase *.map + -erase *.sbr + -erase *.pdb + -erase *.pch + -erase $(TARGET).exp + -erase $(TARGET).lib + -erase $(TARGETDIR)\$(TARGET).* +!if "$(SEPARATE)" != "0" + -erase $(TARGET2).exp + -erase $(TARGET2).lib + -erase $(TARGETDIR)\$(TARGET2).* +!endif + -erase $(TARGETDIR)\$(TARGET).pyd + -erase $(TARGETDIR)\*.py + -erase $(TARGETDIR)\*.pyc + -erase $(TARGETDIR)\*.pyo + + + +#------------------------------------------------------------------------ + +.SUFFIXES : .i .py + +# Implicit rules to run SWIG +{}.i{$(GENCODEDIR)}.cpp: + swig $(SWIGFLAGS) -c -o $@ $< + +{}.i{$(GENCODEDIR)}.py: + swig $(SWIGFLAGS) -c -o $@ $< + + +{$(GENCODEDIR)}.py{$(TARGETDIR)}.py: + copy $< $@ + +{}.py{$(TARGETDIR)}.py: + copy $< $@ + +#{}.py{$(TARGETDIR)}.$(PYEXT): +# $(PYTHON) -c "import py_compile; py_compile.compile('$<', '$@')" + + + + +# This one must leave out the -c flag so we define the whole rule +$(GENCODEDIR)\wx.cpp $(GENCODEDIR)\wx.py : wx.i my_typemaps.i _defs.i _extras.py + swig $(SWIGFLAGS) -o $(GENCODEDIR)/wx.cpp wx.i + + +# Define some dependencies. These MUST use forward slashes so SWIG +# will write the shadow file to the right directory. +$(GENCODEDIR)/windows.cpp $(GENCODEDIR)/windows.py : windows.i my_typemaps.i _defs.i +$(GENCODEDIR)/windows2.cpp $(GENCODEDIR)/windows2.py : windows2.i my_typemaps.i _defs.i +$(GENCODEDIR)/windows3.cpp $(GENCODEDIR)/windows3.py : windows3.i my_typemaps.i _defs.i +$(GENCODEDIR)/events.cpp $(GENCODEDIR)/events.py : events.i my_typemaps.i _defs.i +$(GENCODEDIR)/misc.cpp $(GENCODEDIR)/misc.py : misc.i my_typemaps.i _defs.i +$(GENCODEDIR)/gdi.cpp $(GENCODEDIR)/gdi.py : gdi.i my_typemaps.i _defs.i +$(GENCODEDIR)/mdi.cpp $(GENCODEDIR)/mdi.py : mdi.i my_typemaps.i _defs.i +$(GENCODEDIR)/controls.cpp $(GENCODEDIR)/controls.py : controls.i my_typemaps.i _defs.i +$(GENCODEDIR)/controls2.cpp $(GENCODEDIR)/controls2.py : controls2.i my_typemaps.i _defs.i +$(GENCODEDIR)/cmndlgs.cpp $(GENCODEDIR)/cmndlgs.py : cmndlgs.i my_typemaps.i _defs.i +$(GENCODEDIR)/stattool.cpp $(GENCODEDIR)/stattool.py : stattool.i my_typemaps.i _defs.i +$(GENCODEDIR)/frames.cpp $(GENCODEDIR)/frames.py : frames.i my_typemaps.i _defs.i + +!if "$(SEPARATE)" == "1" +$(GENCODEDIR)\utils.cpp $(GENCODEDIR)\utils.py : utils.i my_typemaps.i + swig $(SWIGFLAGS) -o $(GENCODEDIR)/utils.cpp utils.i +!else +$(GENCODEDIR)/utils.cpp $(GENCODEDIR)/utils.py : utils.i my_typemaps.i _defs.i +!endif + + +$(TARGETDIR)\wx.py : $(GENCODEDIR)\wx.py +$(TARGETDIR)\windows.py : $(GENCODEDIR)\windows.py +$(TARGETDIR)\windows2.py : $(GENCODEDIR)\windows2.py +$(TARGETDIR)\windows3.py : $(GENCODEDIR)\windows3.py +$(TARGETDIR)\events.py : $(GENCODEDIR)\events.py +$(TARGETDIR)\misc.py : $(GENCODEDIR)\misc.py +$(TARGETDIR)\gdi.py : $(GENCODEDIR)\gdi.py +$(TARGETDIR)\mdi.py : $(GENCODEDIR)\mdi.py +$(TARGETDIR)\controls.py : $(GENCODEDIR)\controls.py +$(TARGETDIR)\controls2.py : $(GENCODEDIR)\controls2.py +$(TARGETDIR)\cmndlgs.py : $(GENCODEDIR)\cmndlgs.py +$(TARGETDIR)\frames.py : $(GENCODEDIR)\frames.py +$(TARGETDIR)\stattool.py : $(GENCODEDIR)\stattool.py +$(TARGETDIR)\utils.py : $(GENCODEDIR)\utils.py +$(TARGETDIR)\__init__.py : __init__.py + + +SOURCES = $(GENCODEDIR)\wx.cpp $(GENCODEDIR)\wx.py \ + $(GENCODEDIR)/windows.cpp $(GENCODEDIR)/windows.py \ + $(GENCODEDIR)/windows2.cpp $(GENCODEDIR)/windows2.py \ + $(GENCODEDIR)/windows3.cpp $(GENCODEDIR)/windows3.py \ + $(GENCODEDIR)/events.cpp $(GENCODEDIR)/events.py \ + $(GENCODEDIR)/misc.cpp $(GENCODEDIR)/misc.py \ + $(GENCODEDIR)/gdi.cpp $(GENCODEDIR)/gdi.py \ + $(GENCODEDIR)/mdi.cpp $(GENCODEDIR)/mdi.py \ + $(GENCODEDIR)/controls.cpp $(GENCODEDIR)/controls.py \ + $(GENCODEDIR)/controls2.cpp $(GENCODEDIR)/controls2.py\ + $(GENCODEDIR)/cmndlgs.cpp $(GENCODEDIR)/cmndlgs.py \ + $(GENCODEDIR)/stattool.cpp $(GENCODEDIR)/stattool.py \ + $(GENCODEDIR)/frames.cpp $(GENCODEDIR)/frames.py \ + $(GENCODEDIR)/utils.cpp $(GENCODEDIR)/utils.py \ + + +sources : $(SOURCES) + + +dist: + cd ..\.. + wxPython\distrib\zipit.bat $(VERSION) + +#------------------------------------------------------------------------ +# +# $Log$ +# Revision 1.12 1999/06/28 21:39:47 VZ +# 1. wxStaticLine implemented (generic (ugly) and MSW versions) +# 2. wxTextDialog looks fine under MSW again +# 3. startup tips added: code, sample, docs +# 4. read-only text controls don't participate in TAB traversal +# +# Revision 1.11 1999/02/06 23:47:02 RD +# +# Changing makefile.nt to makefile.vc as in rest of wxWindows +# +# Revision 1.10 1999/02/01 00:10:40 RD +# +# Added the missing EVT_LIST_ITEM_SELECTED and friends. +# +# Revision 1.9 1999/01/30 07:30:13 RD +# +# Added wxSashWindow, wxSashEvent, wxLayoutAlgorithm, etc. +# +# Various cleanup, tweaks, minor additions, etc. to maintain +# compatibility with the current wxWindows. +# +# Revision 1.8 1998/12/21 19:58:06 RD +# +# Now compiles with /GX- on MSW. +# +# Revision 1.7 1998/12/15 20:41:20 RD +# Changed the import semantics from "from wxPython import *" to "from +# wxPython.wx import *" This is for people who are worried about +# namespace pollution, they can use "from wxPython import wx" and then +# prefix all the wxPython identifiers with "wx." +# +# Added wxTaskbarIcon for wxMSW. +# +# Made the events work for wxGrid. +# +# Added wxConfig. +# +# Added wxMiniFrame for wxGTK, (untested.) +# +# Changed many of the args and return values that were pointers to gdi +# objects to references to reflect changes in the wxWindows API. +# +# Other assorted fixes and additions. +# +# Revision 1.6 1998/10/02 06:40:41 RD +# +# Version 0.4 of wxPython for MSW. +# +# Revision 1.5 1998/08/19 00:38:23 RD +# +# A few tweaks +# +# Revision 1.4 1998/08/18 21:55:10 RD +# +# New build directory structure +# +# Revision 1.3 1998/08/15 07:36:37 RD +# - Moved the header in the .i files out of the code that gets put into +# the .cpp files. It caused CVS conflicts because of the RCS ID being +# different each time. +# +# - A few minor fixes. +# +# Revision 1.2 1998/08/14 03:34:23 RD +# made pre-compiling the python files optional +# +# Revision 1.1 1998/08/09 08:25:51 RD +# Initial version +# diff --git a/utils/wxPython/src/wxp.cpp b/utils/wxPython/src/wxp.cpp new file mode 100644 index 0000000000..cea3c3c5c4 --- /dev/null +++ b/utils/wxPython/src/wxp.cpp @@ -0,0 +1,2049 @@ +/* + * FILE : wxp.cpp + * + * This file was automatically generated by : + * Simplified Wrapper and Interface Generator (SWIG) + * Version 1.1 (Patch 5) + * + * Portions Copyright (c) 1995-1998 + * The University of Utah and The Regents of the University of California. + * Permission is granted to distribute this file in any manner provided + * this notice remains intact. + * + * Do not make changes to this file--changes will be lost! + * + */ + + +#define SWIGCODE +/* Implementation : PYTHON */ + +#define SWIGPYTHON +#include +#include +/*********************************************************************** + * $Header$ + * swig_lib/python/python.cfg + * + * This file contains coded needed to add variable linking to the + * Python interpreter. C variables are added as a new kind of Python + * datatype. + * + * Also contains supporting code for building python under Windows + * and things like that. + * + * $Log$ + * Revision 1.6 1999/06/28 21:39:47 VZ + * 1. wxStaticLine implemented (generic (ugly) and MSW versions) + * 2. wxTextDialog looks fine under MSW again + * 3. startup tips added: code, sample, docs + * 4. read-only text controls don't participate in TAB traversal + * + * Revision 1.5 1998/08/18 21:50:09 RD + * + * moving the SWIG-generated files to toolkit specific subdirectories + * + * Revision 1.4 1998/08/15 07:36:51 RD + * - Moved the header in the .i files out of the code that gets put into + * the .cpp files. It caused CVS conflicts because of the RCS ID being + * different each time. + * + * - A few minor fixes. + * + ************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif +#include "Python.h" +#ifdef __cplusplus +} +#endif + +/* Definitions for Windows/Unix exporting */ +#if defined(__WIN32__) +# if defined(_MSC_VER) +# define SWIGEXPORT(a,b) __declspec(dllexport) a b +# else +# if defined(__BORLANDC__) +# define SWIGEXPORT(a,b) a _export b +# else +# define SWIGEXPORT(a,b) a b +# endif +# endif +#else +# define SWIGEXPORT(a,b) a b +#endif + +#ifdef SWIG_GLOBAL +#ifdef __cplusplus +#define SWIGSTATIC extern "C" +#else +#define SWIGSTATIC +#endif +#endif + +#ifndef SWIGSTATIC +#define SWIGSTATIC static +#endif + +typedef struct { + char *name; + PyObject *(*get_attr)(void); + int (*set_attr)(PyObject *); +} swig_globalvar; + +typedef struct swig_varlinkobject { + PyObject_HEAD + swig_globalvar **vars; + int nvars; + int maxvars; +} swig_varlinkobject; + +/* ---------------------------------------------------------------------- + swig_varlink_repr() + + Function for python repr method + ---------------------------------------------------------------------- */ + +static PyObject * +swig_varlink_repr(swig_varlinkobject *v) +{ + v = v; + return PyString_FromString(""); +} + +/* --------------------------------------------------------------------- + swig_varlink_print() + + Print out all of the global variable names + --------------------------------------------------------------------- */ + +static int +swig_varlink_print(swig_varlinkobject *v, FILE *fp, int flags) +{ + + int i = 0; + flags = flags; + fprintf(fp,"Global variables { "); + while (v->vars[i]) { + fprintf(fp,"%s", v->vars[i]->name); + i++; + if (v->vars[i]) fprintf(fp,", "); + } + fprintf(fp," }\n"); + return 0; +} + +/* -------------------------------------------------------------------- + swig_varlink_getattr + + This function gets the value of a variable and returns it as a + PyObject. In our case, we'll be looking at the datatype and + converting into a number or string + -------------------------------------------------------------------- */ + +static PyObject * +swig_varlink_getattr(swig_varlinkobject *v, char *n) +{ + int i = 0; + char temp[128]; + + while (v->vars[i]) { + if (strcmp(v->vars[i]->name,n) == 0) { + return (*v->vars[i]->get_attr)(); + } + i++; + } + sprintf(temp,"C global variable %s not found.", n); + PyErr_SetString(PyExc_NameError,temp); + return NULL; +} + +/* ------------------------------------------------------------------- + swig_varlink_setattr() + + This function sets the value of a variable. + ------------------------------------------------------------------- */ + +static int +swig_varlink_setattr(swig_varlinkobject *v, char *n, PyObject *p) +{ + char temp[128]; + int i = 0; + while (v->vars[i]) { + if (strcmp(v->vars[i]->name,n) == 0) { + return (*v->vars[i]->set_attr)(p); + } + i++; + } + sprintf(temp,"C global variable %s not found.", n); + PyErr_SetString(PyExc_NameError,temp); + return 1; +} + +statichere PyTypeObject varlinktype = { +/* PyObject_HEAD_INIT(&PyType_Type) Note : This doesn't work on some machines */ + PyObject_HEAD_INIT(0) + 0, + "varlink", /* Type name */ + sizeof(swig_varlinkobject), /* Basic size */ + 0, /* Itemsize */ + 0, /* Deallocator */ + (printfunc) swig_varlink_print, /* Print */ + (getattrfunc) swig_varlink_getattr, /* get attr */ + (setattrfunc) swig_varlink_setattr, /* Set attr */ + 0, /* tp_compare */ + (reprfunc) swig_varlink_repr, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_mapping*/ + 0, /* tp_hash */ +}; + +/* Create a variable linking object for use later */ + +SWIGSTATIC PyObject * +SWIG_newvarlink(void) +{ + swig_varlinkobject *result = 0; + result = PyMem_NEW(swig_varlinkobject,1); + varlinktype.ob_type = &PyType_Type; /* Patch varlinktype into a PyType */ + result->ob_type = &varlinktype; + /* _Py_NewReference(result); Does not seem to be necessary */ + result->nvars = 0; + result->maxvars = 64; + result->vars = (swig_globalvar **) malloc(64*sizeof(swig_globalvar *)); + result->vars[0] = 0; + result->ob_refcnt = 0; + Py_XINCREF((PyObject *) result); + return ((PyObject*) result); +} + +SWIGSTATIC void +SWIG_addvarlink(PyObject *p, char *name, + PyObject *(*get_attr)(void), int (*set_attr)(PyObject *p)) +{ + swig_varlinkobject *v; + v= (swig_varlinkobject *) p; + + if (v->nvars >= v->maxvars -1) { + v->maxvars = 2*v->maxvars; + v->vars = (swig_globalvar **) realloc(v->vars,v->maxvars*sizeof(swig_globalvar *)); + if (v->vars == NULL) { + fprintf(stderr,"SWIG : Fatal error in initializing Python module.\n"); + exit(1); + } + } + v->vars[v->nvars] = (swig_globalvar *) malloc(sizeof(swig_globalvar)); + v->vars[v->nvars]->name = (char *) malloc(strlen(name)+1); + strcpy(v->vars[v->nvars]->name,name); + v->vars[v->nvars]->get_attr = get_attr; + v->vars[v->nvars]->set_attr = set_attr; + v->nvars++; + v->vars[v->nvars] = 0; +} + + + +/***************************************************************************** + * $Header$ + * + * swigptr.swg + * + * This file contains supporting code for the SWIG run-time type checking + * mechanism. The following functions are available : + * + * SWIG_RegisterMapping(char *origtype, char *newtype, void *(*cast)(void *)); + * + * Registers a new type-mapping with the type-checker. origtype is the + * original datatype and newtype is an equivalent type. cast is optional + * pointer to a function to cast pointer values between types (this + * is typically used to cast pointers from derived classes to base classes in C++) + * + * SWIG_MakePtr(char *buffer, void *ptr, char *typestring); + * + * Makes a pointer string from a pointer and typestring. The result is returned + * in buffer which is assumed to hold enough space for the result. + * + * char * SWIG_GetPtr(char *buffer, void **ptr, char *type) + * + * Gets a pointer value from a string. If there is a type-mismatch, returns + * a character string to the received type. On success, returns NULL. + * + * + * You can remap these functions by making a file called "swigptr.swg" in + * your the same directory as the interface file you are wrapping. + * + * These functions are normally declared static, but this file can be + * can be used in a multi-module environment by redefining the symbol + * SWIGSTATIC. + *****************************************************************************/ + +#include + +#ifdef SWIG_GLOBAL +#ifdef __cplusplus +#define SWIGSTATIC extern "C" +#else +#define SWIGSTATIC +#endif +#endif + +#ifndef SWIGSTATIC +#define SWIGSTATIC static +#endif + + +/* SWIG pointer structure */ + +typedef struct SwigPtrType { + char *name; /* Datatype name */ + int len; /* Length (used for optimization) */ + void *(*cast)(void *); /* Pointer casting function */ + struct SwigPtrType *next; /* Linked list pointer */ +} SwigPtrType; + +/* Pointer cache structure */ + +typedef struct { + int stat; /* Status (valid) bit */ + SwigPtrType *tp; /* Pointer to type structure */ + char name[256]; /* Given datatype name */ + char mapped[256]; /* Equivalent name */ +} SwigCacheType; + +/* Some variables */ + +static int SwigPtrMax = 64; /* Max entries that can be currently held */ + /* This value may be adjusted dynamically */ +static int SwigPtrN = 0; /* Current number of entries */ +static int SwigPtrSort = 0; /* Status flag indicating sort */ +static int SwigStart[256]; /* Starting positions of types */ + +/* Pointer table */ +static SwigPtrType *SwigPtrTable = 0; /* Table containing pointer equivalences */ + +/* Cached values */ + +#define SWIG_CACHESIZE 8 +#define SWIG_CACHEMASK 0x7 +static SwigCacheType SwigCache[SWIG_CACHESIZE]; +static int SwigCacheIndex = 0; +static int SwigLastCache = 0; + +/* Sort comparison function */ +static int swigsort(const void *data1, const void *data2) { + SwigPtrType *d1 = (SwigPtrType *) data1; + SwigPtrType *d2 = (SwigPtrType *) data2; + return strcmp(d1->name,d2->name); +} + +/* Binary Search function */ +static int swigcmp(const void *key, const void *data) { + char *k = (char *) key; + SwigPtrType *d = (SwigPtrType *) data; + return strncmp(k,d->name,d->len); +} + +/* Register a new datatype with the type-checker */ + +SWIGSTATIC +void SWIG_RegisterMapping(char *origtype, char *newtype, void *(*cast)(void *)) { + + int i; + SwigPtrType *t = 0,*t1; + + /* Allocate the pointer table if necessary */ + + if (!SwigPtrTable) { + SwigPtrTable = (SwigPtrType *) malloc(SwigPtrMax*sizeof(SwigPtrType)); + SwigPtrN = 0; + } + /* Grow the table */ + if (SwigPtrN >= SwigPtrMax) { + SwigPtrMax = 2*SwigPtrMax; + SwigPtrTable = (SwigPtrType *) realloc((char *) SwigPtrTable,SwigPtrMax*sizeof(SwigPtrType)); + } + for (i = 0; i < SwigPtrN; i++) + if (strcmp(SwigPtrTable[i].name,origtype) == 0) { + t = &SwigPtrTable[i]; + break; + } + if (!t) { + t = &SwigPtrTable[SwigPtrN]; + t->name = origtype; + t->len = strlen(t->name); + t->cast = 0; + t->next = 0; + SwigPtrN++; + } + + /* Check for existing entry */ + + while (t->next) { + if ((strcmp(t->name,newtype) == 0)) { + if (cast) t->cast = cast; + return; + } + t = t->next; + } + + /* Now place entry (in sorted order) */ + + t1 = (SwigPtrType *) malloc(sizeof(SwigPtrType)); + t1->name = newtype; + t1->len = strlen(t1->name); + t1->cast = cast; + t1->next = 0; + t->next = t1; + SwigPtrSort = 0; +} + +/* Make a pointer value string */ + +SWIGSTATIC +void SWIG_MakePtr(char *_c, const void *_ptr, char *type) { + static char _hex[16] = + {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', + 'a', 'b', 'c', 'd', 'e', 'f'}; + unsigned long _p, _s; + char _result[20], *_r; /* Note : a 64-bit hex number = 16 digits */ + _r = _result; + _p = (unsigned long) _ptr; + if (_p > 0) { + while (_p > 0) { + _s = _p & 0xf; + *(_r++) = _hex[_s]; + _p = _p >> 4; + } + *_r = '_'; + while (_r >= _result) + *(_c++) = *(_r--); + } else { + strcpy (_c, "NULL"); + } + if (_ptr) + strcpy (_c, type); +} + +/* Define for backwards compatibility */ + +#define _swig_make_hex SWIG_MakePtr + +/* Function for getting a pointer value */ + +SWIGSTATIC +char *SWIG_GetPtr(char *_c, void **ptr, char *_t) +{ + unsigned long _p; + char temp_type[256]; + char *name; + int i, len; + SwigPtrType *sp,*tp; + SwigCacheType *cache; + int start, end; + _p = 0; + + /* Pointer values must start with leading underscore */ + if (*_c == '_') { + _c++; + /* Extract hex value from pointer */ + while (*_c) { + if ((*_c >= '0') && (*_c <= '9')) + _p = (_p << 4) + (*_c - '0'); + else if ((*_c >= 'a') && (*_c <= 'f')) + _p = (_p << 4) + ((*_c - 'a') + 10); + else + break; + _c++; + } + + if (_t) { + if (strcmp(_t,_c)) { + if (!SwigPtrSort) { + qsort((void *) SwigPtrTable, SwigPtrN, sizeof(SwigPtrType), swigsort); + for (i = 0; i < 256; i++) { + SwigStart[i] = SwigPtrN; + } + for (i = SwigPtrN-1; i >= 0; i--) { + SwigStart[(int) (SwigPtrTable[i].name[1])] = i; + } + for (i = 255; i >= 1; i--) { + if (SwigStart[i-1] > SwigStart[i]) + SwigStart[i-1] = SwigStart[i]; + } + SwigPtrSort = 1; + for (i = 0; i < SWIG_CACHESIZE; i++) + SwigCache[i].stat = 0; + } + + /* First check cache for matches. Uses last cache value as starting point */ + cache = &SwigCache[SwigLastCache]; + for (i = 0; i < SWIG_CACHESIZE; i++) { + if (cache->stat) { + if (strcmp(_t,cache->name) == 0) { + if (strcmp(_c,cache->mapped) == 0) { + cache->stat++; + *ptr = (void *) _p; + if (cache->tp->cast) *ptr = (*(cache->tp->cast))(*ptr); + return (char *) 0; + } + } + } + SwigLastCache = (SwigLastCache+1) & SWIG_CACHEMASK; + if (!SwigLastCache) cache = SwigCache; + else cache++; + } + /* We have a type mismatch. Will have to look through our type + mapping table to figure out whether or not we can accept this datatype */ + + start = SwigStart[(int) _t[1]]; + end = SwigStart[(int) _t[1]+1]; + sp = &SwigPtrTable[start]; + while (start < end) { + if (swigcmp(_t,sp) == 0) break; + sp++; + start++; + } + if (start >= end) sp = 0; + /* Try to find a match for this */ + if (sp) { + while (swigcmp(_t,sp) == 0) { + name = sp->name; + len = sp->len; + tp = sp->next; + /* Try to find entry for our given datatype */ + while(tp) { + if (tp->len >= 255) { + return _c; + } + strcpy(temp_type,tp->name); + strncat(temp_type,_t+len,255-tp->len); + if (strcmp(_c,temp_type) == 0) { + + strcpy(SwigCache[SwigCacheIndex].mapped,_c); + strcpy(SwigCache[SwigCacheIndex].name,_t); + SwigCache[SwigCacheIndex].stat = 1; + SwigCache[SwigCacheIndex].tp = tp; + SwigCacheIndex = SwigCacheIndex & SWIG_CACHEMASK; + + /* Get pointer value */ + *ptr = (void *) _p; + if (tp->cast) *ptr = (*(tp->cast))(*ptr); + return (char *) 0; + } + tp = tp->next; + } + sp++; + /* Hmmm. Didn't find it this time */ + } + } + /* Didn't find any sort of match for this data. + Get the pointer value and return the received type */ + *ptr = (void *) _p; + return _c; + } else { + /* Found a match on the first try. Return pointer value */ + *ptr = (void *) _p; + return (char *) 0; + } + } else { + /* No type specified. Good luck */ + *ptr = (void *) _p; + return (char *) 0; + } + } else { + if (strcmp (_c, "NULL") == 0) { + *ptr = (void *) 0; + return (char *) 0; + } + *ptr = (void *) 0; + return _c; + } +} + +/* Compatibility mode */ + +#define _swig_get_hex SWIG_GetPtr + +#define SWIG_init initwxpc + +#define SWIG_name "wxpc" + + +#ifdef __WXMSW__ +#include +#undef FindWindow +#undef GetCharWidth +#undef LoadAccelerators +#endif + + +#include "helpers.h" + +static PyObject* l_output_helper(PyObject* target, PyObject* o) { + PyObject* o2; + if (!target) { + target = o; + } else if (target == Py_None) { + Py_DECREF(Py_None); + target = o; + } else { + if (!PyList_Check(target)) { + o2 = target; + target = PyList_New(0); + PyList_Append(target, o2); + Py_XDECREF(o2); + } + PyList_Append(target,o); + Py_XDECREF(o); + } + return target; +} + +static PyObject* t_output_helper(PyObject* target, PyObject* o) { + PyObject* o2; + PyObject* o3; + + if (!target) { + target = o; + } else if (target == Py_None) { + Py_DECREF(Py_None); + target = o; + } else { + if (!PyTuple_Check(target)) { + o2 = target; + target = PyTuple_New(1); + PyTuple_SetItem(target, 0, o2); + } + o3 = PyTuple_New(1); + PyTuple_SetItem(o3, 0, o); + + o2 = target; + target = PySequence_Concat(o2, o3); + Py_DECREF(o2); + Py_DECREF(o3); + } + return target; +} + + +extern int* int_LIST_helper(PyObject* source); +extern long* long_LIST_helper(PyObject* source); +extern char** string_LIST_helper(PyObject* source); +extern wxPoint* wxPoint_LIST_helper(PyObject* source); +extern wxBitmap** wxBitmap_LIST_helper(PyObject* source); +extern wxString* wxString_LIST_helper(PyObject* source); +#ifdef __WXMSW__ +extern wxAcceleratorEntry* wxAcceleratorEntry_LIST_helper(PyObject* source); +#endif + + +static char* wxStringErrorMsg = "string type is required for parameter"; + +#ifdef __WXMSW__ // If building for win32... + +#include +#undef GetClassName + +extern HINSTANCE wxhInstance; + +BOOL WINAPI DllMain( + HINSTANCE hinstDLL, // handle to DLL module + DWORD fdwReason, // reason for calling function + LPVOID lpvReserved // reserved + ) +{ + wxhInstance = hinstDLL; + return 1; +} +#endif + + +extern "C" SWIGEXPORT(void,initwindowsc)(); +extern "C" SWIGEXPORT(void,initwindows2c)(); +extern "C" SWIGEXPORT(void,initeventsc)(); +extern "C" SWIGEXPORT(void,initmiscc)(); +extern "C" SWIGEXPORT(void,initgdic)(); +extern "C" SWIGEXPORT(void,initmdic)(); +extern "C" SWIGEXPORT(void,initcontrolsc)(); +extern "C" SWIGEXPORT(void,initcontrols2c)(); +extern "C" SWIGEXPORT(void,initcmndlgsc)(); + +static int _wrap_wxPyDefaultPosition_set(PyObject *val) { + + PyErr_SetString(PyExc_TypeError,"Variable wxPyDefaultPosition is read-only."); + return 1; +} + +static PyObject *_wrap_wxPyDefaultPosition_get() { + PyObject * pyobj; + char ptemp[128]; + + SWIG_MakePtr(ptemp,(char *) &wxPyDefaultPosition,"_wxPoint_p"); + pyobj = PyString_FromString(ptemp); + return pyobj; +} + +static int _wrap_wxPyDefaultSize_set(PyObject *val) { + + PyErr_SetString(PyExc_TypeError,"Variable wxPyDefaultSize is read-only."); + return 1; +} + +static PyObject *_wrap_wxPyDefaultSize_get() { + PyObject * pyobj; + char ptemp[128]; + + SWIG_MakePtr(ptemp,(char *) &wxPyDefaultSize,"_wxSize_p"); + pyobj = PyString_FromString(ptemp); + return pyobj; +} + +static void *SwigwxPyAppTowxEvtHandler(void *ptr) { + wxPyApp *src; + wxEvtHandler *dest; + src = (wxPyApp *) ptr; + dest = (wxEvtHandler *) src; + return (void *) dest; +} + +static wxPyApp *new_wxPyApp() { + wxPythonApp = new wxPyApp(); + return wxPythonApp; + } + +static PyObject *_wrap_new_wxPyApp(PyObject *self, PyObject *args) { + PyObject * _resultobj; + wxPyApp * _result; + char _ptemp[128]; + + self = self; + if(!PyArg_ParseTuple(args,":new_wxPyApp")) + return NULL; + _result = (wxPyApp *)new_wxPyApp(); + SWIG_MakePtr(_ptemp, (char *) _result,"_wxPyApp_p"); + _resultobj = Py_BuildValue("s",_ptemp); + return _resultobj; +} + +#define wxPyApp_GetAppName(_swigobj) (_swigobj->GetAppName()) +static PyObject *_wrap_wxPyApp_GetAppName(PyObject *self, PyObject *args) { + PyObject * _resultobj; + wxString * _result; + wxPyApp * _arg0; + char * _argc0 = 0; + + self = self; + if(!PyArg_ParseTuple(args,"s:wxPyApp_GetAppName",&_argc0)) + return NULL; + if (_argc0) { + if (SWIG_GetPtr(_argc0,(void **) &_arg0,"_wxPyApp_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxPyApp_GetAppName. Expected _wxPyApp_p."); + return NULL; + } + } + _result = new wxString (wxPyApp_GetAppName(_arg0)); +{ + _resultobj = PyString_FromString(WXSTRINGCAST *(_result)); +} +{ + delete _result; +} + return _resultobj; +} + +#define wxPyApp_GetAuto3D(_swigobj) (_swigobj->GetAuto3D()) +static PyObject *_wrap_wxPyApp_GetAuto3D(PyObject *self, PyObject *args) { + PyObject * _resultobj; + bool _result; + wxPyApp * _arg0; + char * _argc0 = 0; + + self = self; + if(!PyArg_ParseTuple(args,"s:wxPyApp_GetAuto3D",&_argc0)) + return NULL; + if (_argc0) { + if (SWIG_GetPtr(_argc0,(void **) &_arg0,"_wxPyApp_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxPyApp_GetAuto3D. Expected _wxPyApp_p."); + return NULL; + } + } + _result = (bool )wxPyApp_GetAuto3D(_arg0); + _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + +#define wxPyApp_GetClassName(_swigobj) (_swigobj->GetClassName()) +static PyObject *_wrap_wxPyApp_GetClassName(PyObject *self, PyObject *args) { + PyObject * _resultobj; + wxString * _result; + wxPyApp * _arg0; + char * _argc0 = 0; + + self = self; + if(!PyArg_ParseTuple(args,"s:wxPyApp_GetClassName",&_argc0)) + return NULL; + if (_argc0) { + if (SWIG_GetPtr(_argc0,(void **) &_arg0,"_wxPyApp_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxPyApp_GetClassName. Expected _wxPyApp_p."); + return NULL; + } + } + _result = new wxString (wxPyApp_GetClassName(_arg0)); +{ + _resultobj = PyString_FromString(WXSTRINGCAST *(_result)); +} +{ + delete _result; +} + return _resultobj; +} + +#define wxPyApp_GetExitOnFrameDelete(_swigobj) (_swigobj->GetExitOnFrameDelete()) +static PyObject *_wrap_wxPyApp_GetExitOnFrameDelete(PyObject *self, PyObject *args) { + PyObject * _resultobj; + bool _result; + wxPyApp * _arg0; + char * _argc0 = 0; + + self = self; + if(!PyArg_ParseTuple(args,"s:wxPyApp_GetExitOnFrameDelete",&_argc0)) + return NULL; + if (_argc0) { + if (SWIG_GetPtr(_argc0,(void **) &_arg0,"_wxPyApp_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxPyApp_GetExitOnFrameDelete. Expected _wxPyApp_p."); + return NULL; + } + } + _result = (bool )wxPyApp_GetExitOnFrameDelete(_arg0); + _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + +#define wxPyApp_GetPrintMode(_swigobj) (_swigobj->GetPrintMode()) +static PyObject *_wrap_wxPyApp_GetPrintMode(PyObject *self, PyObject *args) { + PyObject * _resultobj; + int _result; + wxPyApp * _arg0; + char * _argc0 = 0; + + self = self; + if(!PyArg_ParseTuple(args,"s:wxPyApp_GetPrintMode",&_argc0)) + return NULL; + if (_argc0) { + if (SWIG_GetPtr(_argc0,(void **) &_arg0,"_wxPyApp_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxPyApp_GetPrintMode. Expected _wxPyApp_p."); + return NULL; + } + } + _result = (int )wxPyApp_GetPrintMode(_arg0); + _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + +#define wxPyApp_GetTopWindow(_swigobj) (_swigobj->GetTopWindow()) +static PyObject *_wrap_wxPyApp_GetTopWindow(PyObject *self, PyObject *args) { + PyObject * _resultobj; + wxWindow * _result; + wxPyApp * _arg0; + char * _argc0 = 0; + char _ptemp[128]; + + self = self; + if(!PyArg_ParseTuple(args,"s:wxPyApp_GetTopWindow",&_argc0)) + return NULL; + if (_argc0) { + if (SWIG_GetPtr(_argc0,(void **) &_arg0,"_wxPyApp_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxPyApp_GetTopWindow. Expected _wxPyApp_p."); + return NULL; + } + } + _result = (wxWindow *)wxPyApp_GetTopWindow(_arg0); + SWIG_MakePtr(_ptemp, (char *) _result,"_wxWindow_p"); + _resultobj = Py_BuildValue("s",_ptemp); + return _resultobj; +} + +#define wxPyApp_GetVendorName(_swigobj) (_swigobj->GetVendorName()) +static PyObject *_wrap_wxPyApp_GetVendorName(PyObject *self, PyObject *args) { + PyObject * _resultobj; + wxString * _result; + wxPyApp * _arg0; + char * _argc0 = 0; + + self = self; + if(!PyArg_ParseTuple(args,"s:wxPyApp_GetVendorName",&_argc0)) + return NULL; + if (_argc0) { + if (SWIG_GetPtr(_argc0,(void **) &_arg0,"_wxPyApp_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxPyApp_GetVendorName. Expected _wxPyApp_p."); + return NULL; + } + } + _result = new wxString (wxPyApp_GetVendorName(_arg0)); +{ + _resultobj = PyString_FromString(WXSTRINGCAST *(_result)); +} +{ + delete _result; +} + return _resultobj; +} + +#define wxPyApp_Dispatch(_swigobj) (_swigobj->Dispatch()) +static PyObject *_wrap_wxPyApp_Dispatch(PyObject *self, PyObject *args) { + PyObject * _resultobj; + wxPyApp * _arg0; + char * _argc0 = 0; + + self = self; + if(!PyArg_ParseTuple(args,"s:wxPyApp_Dispatch",&_argc0)) + return NULL; + if (_argc0) { + if (SWIG_GetPtr(_argc0,(void **) &_arg0,"_wxPyApp_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxPyApp_Dispatch. Expected _wxPyApp_p."); + return NULL; + } + } + wxPyApp_Dispatch(_arg0); + Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxPyApp_ExitMainLoop(_swigobj) (_swigobj->ExitMainLoop()) +static PyObject *_wrap_wxPyApp_ExitMainLoop(PyObject *self, PyObject *args) { + PyObject * _resultobj; + wxPyApp * _arg0; + char * _argc0 = 0; + + self = self; + if(!PyArg_ParseTuple(args,"s:wxPyApp_ExitMainLoop",&_argc0)) + return NULL; + if (_argc0) { + if (SWIG_GetPtr(_argc0,(void **) &_arg0,"_wxPyApp_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxPyApp_ExitMainLoop. Expected _wxPyApp_p."); + return NULL; + } + } + wxPyApp_ExitMainLoop(_arg0); + Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxPyApp_Initialized(_swigobj) (_swigobj->Initialized()) +static PyObject *_wrap_wxPyApp_Initialized(PyObject *self, PyObject *args) { + PyObject * _resultobj; + bool _result; + wxPyApp * _arg0; + char * _argc0 = 0; + + self = self; + if(!PyArg_ParseTuple(args,"s:wxPyApp_Initialized",&_argc0)) + return NULL; + if (_argc0) { + if (SWIG_GetPtr(_argc0,(void **) &_arg0,"_wxPyApp_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxPyApp_Initialized. Expected _wxPyApp_p."); + return NULL; + } + } + _result = (bool )wxPyApp_Initialized(_arg0); + _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + +#define wxPyApp_MainLoop(_swigobj) (_swigobj->MainLoop()) +static PyObject *_wrap_wxPyApp_MainLoop(PyObject *self, PyObject *args) { + PyObject * _resultobj; + int _result; + wxPyApp * _arg0; + char * _argc0 = 0; + + self = self; + if(!PyArg_ParseTuple(args,"s:wxPyApp_MainLoop",&_argc0)) + return NULL; + if (_argc0) { + if (SWIG_GetPtr(_argc0,(void **) &_arg0,"_wxPyApp_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxPyApp_MainLoop. Expected _wxPyApp_p."); + return NULL; + } + } + _result = (int )wxPyApp_MainLoop(_arg0); + _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + +#define wxPyApp_Pending(_swigobj) (_swigobj->Pending()) +static PyObject *_wrap_wxPyApp_Pending(PyObject *self, PyObject *args) { + PyObject * _resultobj; + bool _result; + wxPyApp * _arg0; + char * _argc0 = 0; + + self = self; + if(!PyArg_ParseTuple(args,"s:wxPyApp_Pending",&_argc0)) + return NULL; + if (_argc0) { + if (SWIG_GetPtr(_argc0,(void **) &_arg0,"_wxPyApp_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxPyApp_Pending. Expected _wxPyApp_p."); + return NULL; + } + } + _result = (bool )wxPyApp_Pending(_arg0); + _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + +#define wxPyApp_SetAppName(_swigobj,_swigarg0) (_swigobj->SetAppName(_swigarg0)) +static PyObject *_wrap_wxPyApp_SetAppName(PyObject *self, PyObject *args) { + PyObject * _resultobj; + wxPyApp * _arg0; + wxString * _arg1; + char * _argc0 = 0; + PyObject * _obj1 = 0; + + self = self; + if(!PyArg_ParseTuple(args,"sO:wxPyApp_SetAppName",&_argc0,&_obj1)) + return NULL; + if (_argc0) { + if (SWIG_GetPtr(_argc0,(void **) &_arg0,"_wxPyApp_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxPyApp_SetAppName. Expected _wxPyApp_p."); + return NULL; + } + } +{ + if (!PyString_Check(_obj1)) { + PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); + return NULL; + } + _arg1 = new wxString(PyString_AsString(_obj1)); +} + wxPyApp_SetAppName(_arg0,*_arg1); + Py_INCREF(Py_None); + _resultobj = Py_None; +{ + if (_obj1) + delete _arg1; +} + return _resultobj; +} + +#define wxPyApp_SetAuto3D(_swigobj,_swigarg0) (_swigobj->SetAuto3D(_swigarg0)) +static PyObject *_wrap_wxPyApp_SetAuto3D(PyObject *self, PyObject *args) { + PyObject * _resultobj; + wxPyApp * _arg0; + bool _arg1; + char * _argc0 = 0; + int tempbool1; + + self = self; + if(!PyArg_ParseTuple(args,"si:wxPyApp_SetAuto3D",&_argc0,&tempbool1)) + return NULL; + if (_argc0) { + if (SWIG_GetPtr(_argc0,(void **) &_arg0,"_wxPyApp_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxPyApp_SetAuto3D. Expected _wxPyApp_p."); + return NULL; + } + } + _arg1 = (bool ) tempbool1; + wxPyApp_SetAuto3D(_arg0,_arg1); + Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxPyApp_SetClassName(_swigobj,_swigarg0) (_swigobj->SetClassName(_swigarg0)) +static PyObject *_wrap_wxPyApp_SetClassName(PyObject *self, PyObject *args) { + PyObject * _resultobj; + wxPyApp * _arg0; + wxString * _arg1; + char * _argc0 = 0; + PyObject * _obj1 = 0; + + self = self; + if(!PyArg_ParseTuple(args,"sO:wxPyApp_SetClassName",&_argc0,&_obj1)) + return NULL; + if (_argc0) { + if (SWIG_GetPtr(_argc0,(void **) &_arg0,"_wxPyApp_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxPyApp_SetClassName. Expected _wxPyApp_p."); + return NULL; + } + } +{ + if (!PyString_Check(_obj1)) { + PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); + return NULL; + } + _arg1 = new wxString(PyString_AsString(_obj1)); +} + wxPyApp_SetClassName(_arg0,*_arg1); + Py_INCREF(Py_None); + _resultobj = Py_None; +{ + if (_obj1) + delete _arg1; +} + return _resultobj; +} + +#define wxPyApp_SetExitOnFrameDelete(_swigobj,_swigarg0) (_swigobj->SetExitOnFrameDelete(_swigarg0)) +static PyObject *_wrap_wxPyApp_SetExitOnFrameDelete(PyObject *self, PyObject *args) { + PyObject * _resultobj; + wxPyApp * _arg0; + bool _arg1; + char * _argc0 = 0; + int tempbool1; + + self = self; + if(!PyArg_ParseTuple(args,"si:wxPyApp_SetExitOnFrameDelete",&_argc0,&tempbool1)) + return NULL; + if (_argc0) { + if (SWIG_GetPtr(_argc0,(void **) &_arg0,"_wxPyApp_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxPyApp_SetExitOnFrameDelete. Expected _wxPyApp_p."); + return NULL; + } + } + _arg1 = (bool ) tempbool1; + wxPyApp_SetExitOnFrameDelete(_arg0,_arg1); + Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxPyApp_SetPrintMode(_swigobj,_swigarg0) (_swigobj->SetPrintMode(_swigarg0)) +static PyObject *_wrap_wxPyApp_SetPrintMode(PyObject *self, PyObject *args) { + PyObject * _resultobj; + wxPyApp * _arg0; + int _arg1; + char * _argc0 = 0; + + self = self; + if(!PyArg_ParseTuple(args,"si:wxPyApp_SetPrintMode",&_argc0,&_arg1)) + return NULL; + if (_argc0) { + if (SWIG_GetPtr(_argc0,(void **) &_arg0,"_wxPyApp_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxPyApp_SetPrintMode. Expected _wxPyApp_p."); + return NULL; + } + } + wxPyApp_SetPrintMode(_arg0,_arg1); + Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxPyApp_SetTopWindow(_swigobj,_swigarg0) (_swigobj->SetTopWindow(_swigarg0)) +static PyObject *_wrap_wxPyApp_SetTopWindow(PyObject *self, PyObject *args) { + PyObject * _resultobj; + wxPyApp * _arg0; + wxWindow * _arg1; + char * _argc0 = 0; + char * _argc1 = 0; + + self = self; + if(!PyArg_ParseTuple(args,"ss:wxPyApp_SetTopWindow",&_argc0,&_argc1)) + return NULL; + if (_argc0) { + if (SWIG_GetPtr(_argc0,(void **) &_arg0,"_wxPyApp_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxPyApp_SetTopWindow. Expected _wxPyApp_p."); + return NULL; + } + } + if (_argc1) { + if (SWIG_GetPtr(_argc1,(void **) &_arg1,"_wxWindow_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxPyApp_SetTopWindow. Expected _wxWindow_p."); + return NULL; + } + } + wxPyApp_SetTopWindow(_arg0,_arg1); + Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxPyApp_SetVendorName(_swigobj,_swigarg0) (_swigobj->SetVendorName(_swigarg0)) +static PyObject *_wrap_wxPyApp_SetVendorName(PyObject *self, PyObject *args) { + PyObject * _resultobj; + wxPyApp * _arg0; + wxString * _arg1; + char * _argc0 = 0; + PyObject * _obj1 = 0; + + self = self; + if(!PyArg_ParseTuple(args,"sO:wxPyApp_SetVendorName",&_argc0,&_obj1)) + return NULL; + if (_argc0) { + if (SWIG_GetPtr(_argc0,(void **) &_arg0,"_wxPyApp_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxPyApp_SetVendorName. Expected _wxPyApp_p."); + return NULL; + } + } +{ + if (!PyString_Check(_obj1)) { + PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); + return NULL; + } + _arg1 = new wxString(PyString_AsString(_obj1)); +} + wxPyApp_SetVendorName(_arg0,*_arg1); + Py_INCREF(Py_None); + _resultobj = Py_None; +{ + if (_obj1) + delete _arg1; +} + return _resultobj; +} + +#define wxPyApp_AfterMainLoop(_swigobj) (_swigobj->AfterMainLoop()) +static PyObject *_wrap_wxPyApp_AfterMainLoop(PyObject *self, PyObject *args) { + PyObject * _resultobj; + wxPyApp * _arg0; + char * _argc0 = 0; + + self = self; + if(!PyArg_ParseTuple(args,"s:wxPyApp_AfterMainLoop",&_argc0)) + return NULL; + if (_argc0) { + if (SWIG_GetPtr(_argc0,(void **) &_arg0,"_wxPyApp_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxPyApp_AfterMainLoop. Expected _wxPyApp_p."); + return NULL; + } + } + wxPyApp_AfterMainLoop(_arg0); + Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +static PyMethodDef wxpcMethods[] = { + { "wxPyApp_AfterMainLoop", _wrap_wxPyApp_AfterMainLoop, 1 }, + { "wxPyApp_SetVendorName", _wrap_wxPyApp_SetVendorName, 1 }, + { "wxPyApp_SetTopWindow", _wrap_wxPyApp_SetTopWindow, 1 }, + { "wxPyApp_SetPrintMode", _wrap_wxPyApp_SetPrintMode, 1 }, + { "wxPyApp_SetExitOnFrameDelete", _wrap_wxPyApp_SetExitOnFrameDelete, 1 }, + { "wxPyApp_SetClassName", _wrap_wxPyApp_SetClassName, 1 }, + { "wxPyApp_SetAuto3D", _wrap_wxPyApp_SetAuto3D, 1 }, + { "wxPyApp_SetAppName", _wrap_wxPyApp_SetAppName, 1 }, + { "wxPyApp_Pending", _wrap_wxPyApp_Pending, 1 }, + { "wxPyApp_MainLoop", _wrap_wxPyApp_MainLoop, 1 }, + { "wxPyApp_Initialized", _wrap_wxPyApp_Initialized, 1 }, + { "wxPyApp_ExitMainLoop", _wrap_wxPyApp_ExitMainLoop, 1 }, + { "wxPyApp_Dispatch", _wrap_wxPyApp_Dispatch, 1 }, + { "wxPyApp_GetVendorName", _wrap_wxPyApp_GetVendorName, 1 }, + { "wxPyApp_GetTopWindow", _wrap_wxPyApp_GetTopWindow, 1 }, + { "wxPyApp_GetPrintMode", _wrap_wxPyApp_GetPrintMode, 1 }, + { "wxPyApp_GetExitOnFrameDelete", _wrap_wxPyApp_GetExitOnFrameDelete, 1 }, + { "wxPyApp_GetClassName", _wrap_wxPyApp_GetClassName, 1 }, + { "wxPyApp_GetAuto3D", _wrap_wxPyApp_GetAuto3D, 1 }, + { "wxPyApp_GetAppName", _wrap_wxPyApp_GetAppName, 1 }, + { "new_wxPyApp", _wrap_new_wxPyApp, 1 }, + { "_wxSetDictionary", __wxSetDictionary, 1 }, + { "_wxStart", __wxStart, 1 }, + { NULL, NULL } +}; +static PyObject *SWIG_globals; +#ifdef __cplusplus +extern "C" +#endif +SWIGEXPORT(void,initwxpc)() { + PyObject *m, *d; + SWIG_globals = SWIG_newvarlink(); + m = Py_InitModule("wxpc", wxpcMethods); + d = PyModule_GetDict(m); + PyDict_SetItemString(d,"wxMAJOR_VERSION", PyInt_FromLong((long) wxMAJOR_VERSION)); + PyDict_SetItemString(d,"wxMINOR_VERSION", PyInt_FromLong((long) wxMINOR_VERSION)); + PyDict_SetItemString(d,"wxRELEASE_NUMBER", PyInt_FromLong((long) wxRELEASE_NUMBER)); + PyDict_SetItemString(d,"UNKNOWN", PyInt_FromLong((long) UNKNOWN)); + PyDict_SetItemString(d,"NOT_FOUND", PyInt_FromLong((long) NOT_FOUND)); + PyDict_SetItemString(d,"wxVSCROLL", PyInt_FromLong((long) wxVSCROLL)); + PyDict_SetItemString(d,"wxHSCROLL", PyInt_FromLong((long) wxHSCROLL)); + PyDict_SetItemString(d,"wxCAPTION", PyInt_FromLong((long) wxCAPTION)); + PyDict_SetItemString(d,"wxDOUBLE_BORDER", PyInt_FromLong((long) wxDOUBLE_BORDER)); + PyDict_SetItemString(d,"wxSUNKEN_BORDER", PyInt_FromLong((long) wxSUNKEN_BORDER)); + PyDict_SetItemString(d,"wxRAISED_BORDER", PyInt_FromLong((long) wxRAISED_BORDER)); + PyDict_SetItemString(d,"wxBORDER", PyInt_FromLong((long) wxBORDER)); + PyDict_SetItemString(d,"wxSIMPLE_BORDER", PyInt_FromLong((long) wxSIMPLE_BORDER)); + PyDict_SetItemString(d,"wxSTATIC_BORDER", PyInt_FromLong((long) wxSTATIC_BORDER)); + PyDict_SetItemString(d,"wxTRANSPARENT_WINDOW", PyInt_FromLong((long) wxTRANSPARENT_WINDOW)); + PyDict_SetItemString(d,"wxNO_BORDER", PyInt_FromLong((long) wxNO_BORDER)); + PyDict_SetItemString(d,"wxUSER_COLOURS", PyInt_FromLong((long) wxUSER_COLOURS)); + PyDict_SetItemString(d,"wxNO_3D", PyInt_FromLong((long) wxNO_3D)); + PyDict_SetItemString(d,"wxTAB_TRAVERSAL", PyInt_FromLong((long) wxTAB_TRAVERSAL)); + PyDict_SetItemString(d,"wxHORIZONTAL", PyInt_FromLong((long) wxHORIZONTAL)); + PyDict_SetItemString(d,"wxVERTICAL", PyInt_FromLong((long) wxVERTICAL)); + PyDict_SetItemString(d,"wxBOTH", PyInt_FromLong((long) wxBOTH)); + PyDict_SetItemString(d,"wxCENTER_FRAME", PyInt_FromLong((long) wxCENTER_FRAME)); + PyDict_SetItemString(d,"wxSTAY_ON_TOP", PyInt_FromLong((long) wxSTAY_ON_TOP)); + PyDict_SetItemString(d,"wxICONIZE", PyInt_FromLong((long) wxICONIZE)); + PyDict_SetItemString(d,"wxMINIMIZE", PyInt_FromLong((long) wxMINIMIZE)); + PyDict_SetItemString(d,"wxMAXIMIZE", PyInt_FromLong((long) wxMAXIMIZE)); + PyDict_SetItemString(d,"wxTHICK_FRAME", PyInt_FromLong((long) wxTHICK_FRAME)); + PyDict_SetItemString(d,"wxSYSTEM_MENU", PyInt_FromLong((long) wxSYSTEM_MENU)); + PyDict_SetItemString(d,"wxMINIMIZE_BOX", PyInt_FromLong((long) wxMINIMIZE_BOX)); + PyDict_SetItemString(d,"wxMAXIMIZE_BOX", PyInt_FromLong((long) wxMAXIMIZE_BOX)); + PyDict_SetItemString(d,"wxTINY_CAPTION_HORIZ", PyInt_FromLong((long) wxTINY_CAPTION_HORIZ)); + PyDict_SetItemString(d,"wxTINY_CAPTION_VERT", PyInt_FromLong((long) wxTINY_CAPTION_VERT)); + PyDict_SetItemString(d,"wxRESIZE_BOX", PyInt_FromLong((long) wxRESIZE_BOX)); + PyDict_SetItemString(d,"wxRESIZE_BORDER", PyInt_FromLong((long) wxRESIZE_BORDER)); + PyDict_SetItemString(d,"wxDIALOG_MODAL", PyInt_FromLong((long) wxDIALOG_MODAL)); + PyDict_SetItemString(d,"wxDIALOG_MODELESS", PyInt_FromLong((long) wxDIALOG_MODELESS)); + PyDict_SetItemString(d,"wxDEFAULT_FRAME_STYLE", PyInt_FromLong((long) wxDEFAULT_FRAME_STYLE)); + PyDict_SetItemString(d,"wxDEFAULT_DIALOG_STYLE", PyInt_FromLong((long) wxDEFAULT_DIALOG_STYLE)); + PyDict_SetItemString(d,"wxRETAINED", PyInt_FromLong((long) wxRETAINED)); + PyDict_SetItemString(d,"wxBACKINGSTORE", PyInt_FromLong((long) wxBACKINGSTORE)); + PyDict_SetItemString(d,"wxTB_3DBUTTONS", PyInt_FromLong((long) wxTB_3DBUTTONS)); + PyDict_SetItemString(d,"wxTB_HORIZONTAL", PyInt_FromLong((long) wxTB_HORIZONTAL)); + PyDict_SetItemString(d,"wxTB_VERTICAL", PyInt_FromLong((long) wxTB_VERTICAL)); + PyDict_SetItemString(d,"wxCOLOURED", PyInt_FromLong((long) wxCOLOURED)); + PyDict_SetItemString(d,"wxFIXED_LENGTH", PyInt_FromLong((long) wxFIXED_LENGTH)); + PyDict_SetItemString(d,"wxALIGN_LEFT", PyInt_FromLong((long) wxALIGN_LEFT)); + PyDict_SetItemString(d,"wxALIGN_CENTER", PyInt_FromLong((long) wxALIGN_CENTER)); + PyDict_SetItemString(d,"wxALIGN_CENTRE", PyInt_FromLong((long) wxALIGN_CENTRE)); + PyDict_SetItemString(d,"wxALIGN_RIGHT", PyInt_FromLong((long) wxALIGN_RIGHT)); + PyDict_SetItemString(d,"wxLB_NEEDED_SB", PyInt_FromLong((long) wxLB_NEEDED_SB)); + PyDict_SetItemString(d,"wxLB_ALWAYS_SB", PyInt_FromLong((long) wxLB_ALWAYS_SB)); + PyDict_SetItemString(d,"wxLB_SORT", PyInt_FromLong((long) wxLB_SORT)); + PyDict_SetItemString(d,"wxLB_SINGLE", PyInt_FromLong((long) wxLB_SINGLE)); + PyDict_SetItemString(d,"wxLB_MULTIPLE", PyInt_FromLong((long) wxLB_MULTIPLE)); + PyDict_SetItemString(d,"wxLB_EXTENDED", PyInt_FromLong((long) wxLB_EXTENDED)); + PyDict_SetItemString(d,"wxLB_OWNERDRAW", PyInt_FromLong((long) wxLB_OWNERDRAW)); + PyDict_SetItemString(d,"wxLB_HSCROLL", PyInt_FromLong((long) wxLB_HSCROLL)); + PyDict_SetItemString(d,"wxPROCESS_ENTER", PyInt_FromLong((long) wxPROCESS_ENTER)); + PyDict_SetItemString(d,"wxPASSWORD", PyInt_FromLong((long) wxPASSWORD)); + PyDict_SetItemString(d,"wxTE_PROCESS_ENTER", PyInt_FromLong((long) wxTE_PROCESS_ENTER)); + PyDict_SetItemString(d,"wxTE_PASSWORD", PyInt_FromLong((long) wxTE_PASSWORD)); + PyDict_SetItemString(d,"wxTE_READONLY", PyInt_FromLong((long) wxTE_READONLY)); + PyDict_SetItemString(d,"wxTE_MULTILINE", PyInt_FromLong((long) wxTE_MULTILINE)); + PyDict_SetItemString(d,"wxCB_SIMPLE", PyInt_FromLong((long) wxCB_SIMPLE)); + PyDict_SetItemString(d,"wxCB_DROPDOWN", PyInt_FromLong((long) wxCB_DROPDOWN)); + PyDict_SetItemString(d,"wxCB_SORT", PyInt_FromLong((long) wxCB_SORT)); + PyDict_SetItemString(d,"wxCB_READONLY", PyInt_FromLong((long) wxCB_READONLY)); + PyDict_SetItemString(d,"wxRA_HORIZONTAL", PyInt_FromLong((long) wxRA_HORIZONTAL)); + PyDict_SetItemString(d,"wxRA_VERTICAL", PyInt_FromLong((long) wxRA_VERTICAL)); + PyDict_SetItemString(d,"wxRB_GROUP", PyInt_FromLong((long) wxRB_GROUP)); + PyDict_SetItemString(d,"wxGA_PROGRESSBAR", PyInt_FromLong((long) wxGA_PROGRESSBAR)); + PyDict_SetItemString(d,"wxGA_HORIZONTAL", PyInt_FromLong((long) wxGA_HORIZONTAL)); + PyDict_SetItemString(d,"wxGA_VERTICAL", PyInt_FromLong((long) wxGA_VERTICAL)); + PyDict_SetItemString(d,"wxSL_HORIZONTAL", PyInt_FromLong((long) wxSL_HORIZONTAL)); + PyDict_SetItemString(d,"wxSL_VERTICAL", PyInt_FromLong((long) wxSL_VERTICAL)); + PyDict_SetItemString(d,"wxSL_AUTOTICKS", PyInt_FromLong((long) wxSL_AUTOTICKS)); + PyDict_SetItemString(d,"wxSL_LABELS", PyInt_FromLong((long) wxSL_LABELS)); + PyDict_SetItemString(d,"wxSL_LEFT", PyInt_FromLong((long) wxSL_LEFT)); + PyDict_SetItemString(d,"wxSL_TOP", PyInt_FromLong((long) wxSL_TOP)); + PyDict_SetItemString(d,"wxSL_RIGHT", PyInt_FromLong((long) wxSL_RIGHT)); + PyDict_SetItemString(d,"wxSL_BOTTOM", PyInt_FromLong((long) wxSL_BOTTOM)); + PyDict_SetItemString(d,"wxSL_BOTH", PyInt_FromLong((long) wxSL_BOTH)); + PyDict_SetItemString(d,"wxSL_SELRANGE", PyInt_FromLong((long) wxSL_SELRANGE)); + PyDict_SetItemString(d,"wxSB_HORIZONTAL", PyInt_FromLong((long) wxSB_HORIZONTAL)); + PyDict_SetItemString(d,"wxSB_VERTICAL", PyInt_FromLong((long) wxSB_VERTICAL)); + PyDict_SetItemString(d,"wxBU_AUTODRAW", PyInt_FromLong((long) wxBU_AUTODRAW)); + PyDict_SetItemString(d,"wxBU_NOAUTODRAW", PyInt_FromLong((long) wxBU_NOAUTODRAW)); + PyDict_SetItemString(d,"wxTR_HAS_BUTTONS", PyInt_FromLong((long) wxTR_HAS_BUTTONS)); + PyDict_SetItemString(d,"wxTR_EDIT_LABELS", PyInt_FromLong((long) wxTR_EDIT_LABELS)); + PyDict_SetItemString(d,"wxLC_ICON", PyInt_FromLong((long) wxLC_ICON)); + PyDict_SetItemString(d,"wxLC_SMALL_ICON", PyInt_FromLong((long) wxLC_SMALL_ICON)); + PyDict_SetItemString(d,"wxLC_LIST", PyInt_FromLong((long) wxLC_LIST)); + PyDict_SetItemString(d,"wxLC_REPORT", PyInt_FromLong((long) wxLC_REPORT)); + PyDict_SetItemString(d,"wxLC_ALIGN_TOP", PyInt_FromLong((long) wxLC_ALIGN_TOP)); + PyDict_SetItemString(d,"wxLC_ALIGN_LEFT", PyInt_FromLong((long) wxLC_ALIGN_LEFT)); + PyDict_SetItemString(d,"wxLC_AUTOARRANGE", PyInt_FromLong((long) wxLC_AUTOARRANGE)); + PyDict_SetItemString(d,"wxLC_USER_TEXT", PyInt_FromLong((long) wxLC_USER_TEXT)); + PyDict_SetItemString(d,"wxLC_EDIT_LABELS", PyInt_FromLong((long) wxLC_EDIT_LABELS)); + PyDict_SetItemString(d,"wxLC_NO_HEADER", PyInt_FromLong((long) wxLC_NO_HEADER)); + PyDict_SetItemString(d,"wxLC_NO_SORT_HEADER", PyInt_FromLong((long) wxLC_NO_SORT_HEADER)); + PyDict_SetItemString(d,"wxLC_SINGLE_SEL", PyInt_FromLong((long) wxLC_SINGLE_SEL)); + PyDict_SetItemString(d,"wxLC_SORT_ASCENDING", PyInt_FromLong((long) wxLC_SORT_ASCENDING)); + PyDict_SetItemString(d,"wxLC_SORT_DESCENDING", PyInt_FromLong((long) wxLC_SORT_DESCENDING)); + PyDict_SetItemString(d,"wxLC_MASK_TYPE", PyInt_FromLong((long) wxLC_MASK_TYPE)); + PyDict_SetItemString(d,"wxLC_MASK_ALIGN", PyInt_FromLong((long) wxLC_MASK_ALIGN)); + PyDict_SetItemString(d,"wxLC_MASK_SORT", PyInt_FromLong((long) wxLC_MASK_SORT)); + PyDict_SetItemString(d,"wxSP_VERTICAL", PyInt_FromLong((long) wxSP_VERTICAL)); + PyDict_SetItemString(d,"wxSP_HORIZONTAL", PyInt_FromLong((long) wxSP_HORIZONTAL)); + PyDict_SetItemString(d,"wxSP_ARROW_KEYS", PyInt_FromLong((long) wxSP_ARROW_KEYS)); + PyDict_SetItemString(d,"wxSP_WRAP", PyInt_FromLong((long) wxSP_WRAP)); + PyDict_SetItemString(d,"wxSP_NOBORDER", PyInt_FromLong((long) wxSP_NOBORDER)); + PyDict_SetItemString(d,"wxSP_3D", PyInt_FromLong((long) wxSP_3D)); + PyDict_SetItemString(d,"wxSP_BORDER", PyInt_FromLong((long) wxSP_BORDER)); + PyDict_SetItemString(d,"wxTAB_MULTILINE", PyInt_FromLong((long) wxTAB_MULTILINE)); + PyDict_SetItemString(d,"wxTAB_RIGHTJUSTIFY", PyInt_FromLong((long) wxTAB_RIGHTJUSTIFY)); + PyDict_SetItemString(d,"wxTAB_FIXEDWIDTH", PyInt_FromLong((long) wxTAB_FIXEDWIDTH)); + PyDict_SetItemString(d,"wxTAB_OWNERDRAW", PyInt_FromLong((long) wxTAB_OWNERDRAW)); + PyDict_SetItemString(d,"wxFLOOD_SURFACE", PyInt_FromLong((long) wxFLOOD_SURFACE)); + PyDict_SetItemString(d,"wxFLOOD_BORDER", PyInt_FromLong((long) wxFLOOD_BORDER)); + PyDict_SetItemString(d,"wxODDEVEN_RULE", PyInt_FromLong((long) wxODDEVEN_RULE)); + PyDict_SetItemString(d,"wxWINDING_RULE", PyInt_FromLong((long) wxWINDING_RULE)); + PyDict_SetItemString(d,"wxTOOL_TOP", PyInt_FromLong((long) wxTOOL_TOP)); + PyDict_SetItemString(d,"wxTOOL_BOTTOM", PyInt_FromLong((long) wxTOOL_BOTTOM)); + PyDict_SetItemString(d,"wxTOOL_LEFT", PyInt_FromLong((long) wxTOOL_LEFT)); + PyDict_SetItemString(d,"wxTOOL_RIGHT", PyInt_FromLong((long) wxTOOL_RIGHT)); + PyDict_SetItemString(d,"wxOK", PyInt_FromLong((long) wxOK)); + PyDict_SetItemString(d,"wxYES_NO", PyInt_FromLong((long) wxYES_NO)); + PyDict_SetItemString(d,"wxCANCEL", PyInt_FromLong((long) wxCANCEL)); + PyDict_SetItemString(d,"wxYES", PyInt_FromLong((long) wxYES)); + PyDict_SetItemString(d,"wxNO", PyInt_FromLong((long) wxNO)); + PyDict_SetItemString(d,"wxICON_EXCLAMATION", PyInt_FromLong((long) wxICON_EXCLAMATION)); + PyDict_SetItemString(d,"wxICON_HAND", PyInt_FromLong((long) wxICON_HAND)); + PyDict_SetItemString(d,"wxICON_QUESTION", PyInt_FromLong((long) wxICON_QUESTION)); + PyDict_SetItemString(d,"wxICON_INFORMATION", PyInt_FromLong((long) wxICON_INFORMATION)); + PyDict_SetItemString(d,"wxICON_STOP", PyInt_FromLong((long) wxICON_STOP)); + PyDict_SetItemString(d,"wxICON_ASTERISK", PyInt_FromLong((long) wxICON_ASTERISK)); + PyDict_SetItemString(d,"wxICON_MASK", PyInt_FromLong((long) wxICON_MASK)); + PyDict_SetItemString(d,"wxCENTRE", PyInt_FromLong((long) wxCENTRE)); + PyDict_SetItemString(d,"wxCENTER", PyInt_FromLong((long) wxCENTER)); + PyDict_SetItemString(d,"wxSIZE_AUTO_WIDTH", PyInt_FromLong((long) wxSIZE_AUTO_WIDTH)); + PyDict_SetItemString(d,"wxSIZE_AUTO_HEIGHT", PyInt_FromLong((long) wxSIZE_AUTO_HEIGHT)); + PyDict_SetItemString(d,"wxSIZE_AUTO", PyInt_FromLong((long) wxSIZE_AUTO)); + PyDict_SetItemString(d,"wxSIZE_USE_EXISTING", PyInt_FromLong((long) wxSIZE_USE_EXISTING)); + PyDict_SetItemString(d,"wxSIZE_ALLOW_MINUS_ONE", PyInt_FromLong((long) wxSIZE_ALLOW_MINUS_ONE)); + PyDict_SetItemString(d,"wxDF_TEXT", PyInt_FromLong((long) wxDF_TEXT)); + PyDict_SetItemString(d,"wxDF_BITMAP", PyInt_FromLong((long) wxDF_BITMAP)); + PyDict_SetItemString(d,"wxDF_METAFILE", PyInt_FromLong((long) wxDF_METAFILE)); + PyDict_SetItemString(d,"wxDF_DIB", PyInt_FromLong((long) wxDF_DIB)); + PyDict_SetItemString(d,"wxDF_OEMTEXT", PyInt_FromLong((long) wxDF_OEMTEXT)); + PyDict_SetItemString(d,"wxDF_FILENAME", PyInt_FromLong((long) wxDF_FILENAME)); + PyDict_SetItemString(d,"wxPORTRAIT", PyInt_FromLong((long) wxPORTRAIT)); + PyDict_SetItemString(d,"wxLANDSCAPE", PyInt_FromLong((long) wxLANDSCAPE)); + PyDict_SetItemString(d,"wxID_OPEN", PyInt_FromLong((long) wxID_OPEN)); + PyDict_SetItemString(d,"wxID_CLOSE", PyInt_FromLong((long) wxID_CLOSE)); + PyDict_SetItemString(d,"wxID_NEW", PyInt_FromLong((long) wxID_NEW)); + PyDict_SetItemString(d,"wxID_SAVE", PyInt_FromLong((long) wxID_SAVE)); + PyDict_SetItemString(d,"wxID_SAVEAS", PyInt_FromLong((long) wxID_SAVEAS)); + PyDict_SetItemString(d,"wxID_REVERT", PyInt_FromLong((long) wxID_REVERT)); + PyDict_SetItemString(d,"wxID_EXIT", PyInt_FromLong((long) wxID_EXIT)); + PyDict_SetItemString(d,"wxID_UNDO", PyInt_FromLong((long) wxID_UNDO)); + PyDict_SetItemString(d,"wxID_REDO", PyInt_FromLong((long) wxID_REDO)); + PyDict_SetItemString(d,"wxID_HELP", PyInt_FromLong((long) wxID_HELP)); + PyDict_SetItemString(d,"wxID_PRINT", PyInt_FromLong((long) wxID_PRINT)); + PyDict_SetItemString(d,"wxID_PRINT_SETUP", PyInt_FromLong((long) wxID_PRINT_SETUP)); + PyDict_SetItemString(d,"wxID_PREVIEW", PyInt_FromLong((long) wxID_PREVIEW)); + PyDict_SetItemString(d,"wxID_ABOUT", PyInt_FromLong((long) wxID_ABOUT)); + PyDict_SetItemString(d,"wxID_HELP_CONTENTS", PyInt_FromLong((long) wxID_HELP_CONTENTS)); + PyDict_SetItemString(d,"wxID_HELP_COMMANDS", PyInt_FromLong((long) wxID_HELP_COMMANDS)); + PyDict_SetItemString(d,"wxID_HELP_PROCEDURES", PyInt_FromLong((long) wxID_HELP_PROCEDURES)); + PyDict_SetItemString(d,"wxID_HELP_CONTEXT", PyInt_FromLong((long) wxID_HELP_CONTEXT)); + PyDict_SetItemString(d,"wxID_CUT", PyInt_FromLong((long) wxID_CUT)); + PyDict_SetItemString(d,"wxID_COPY", PyInt_FromLong((long) wxID_COPY)); + PyDict_SetItemString(d,"wxID_PASTE", PyInt_FromLong((long) wxID_PASTE)); + PyDict_SetItemString(d,"wxID_CLEAR", PyInt_FromLong((long) wxID_CLEAR)); + PyDict_SetItemString(d,"wxID_FIND", PyInt_FromLong((long) wxID_FIND)); + PyDict_SetItemString(d,"wxID_FILE1", PyInt_FromLong((long) wxID_FILE1)); + PyDict_SetItemString(d,"wxID_FILE2", PyInt_FromLong((long) wxID_FILE2)); + PyDict_SetItemString(d,"wxID_FILE3", PyInt_FromLong((long) wxID_FILE3)); + PyDict_SetItemString(d,"wxID_FILE4", PyInt_FromLong((long) wxID_FILE4)); + PyDict_SetItemString(d,"wxID_FILE5", PyInt_FromLong((long) wxID_FILE5)); + PyDict_SetItemString(d,"wxID_FILE6", PyInt_FromLong((long) wxID_FILE6)); + PyDict_SetItemString(d,"wxID_FILE7", PyInt_FromLong((long) wxID_FILE7)); + PyDict_SetItemString(d,"wxID_FILE8", PyInt_FromLong((long) wxID_FILE8)); + PyDict_SetItemString(d,"wxID_FILE9", PyInt_FromLong((long) wxID_FILE9)); + PyDict_SetItemString(d,"wxID_OK", PyInt_FromLong((long) wxID_OK)); + PyDict_SetItemString(d,"wxID_CANCEL", PyInt_FromLong((long) wxID_CANCEL)); + PyDict_SetItemString(d,"wxID_APPLY", PyInt_FromLong((long) wxID_APPLY)); + PyDict_SetItemString(d,"wxID_YES", PyInt_FromLong((long) wxID_YES)); + PyDict_SetItemString(d,"wxID_NO", PyInt_FromLong((long) wxID_NO)); + PyDict_SetItemString(d,"wxBITMAP_TYPE_BMP", PyInt_FromLong((long) wxBITMAP_TYPE_BMP)); + PyDict_SetItemString(d,"wxBITMAP_TYPE_BMP_RESOURCE", PyInt_FromLong((long) wxBITMAP_TYPE_BMP_RESOURCE)); + PyDict_SetItemString(d,"wxBITMAP_TYPE_ICO", PyInt_FromLong((long) wxBITMAP_TYPE_ICO)); + PyDict_SetItemString(d,"wxBITMAP_TYPE_ICO_RESOURCE", PyInt_FromLong((long) wxBITMAP_TYPE_ICO_RESOURCE)); + PyDict_SetItemString(d,"wxBITMAP_TYPE_CUR", PyInt_FromLong((long) wxBITMAP_TYPE_CUR)); + PyDict_SetItemString(d,"wxBITMAP_TYPE_CUR_RESOURCE", PyInt_FromLong((long) wxBITMAP_TYPE_CUR_RESOURCE)); + PyDict_SetItemString(d,"wxBITMAP_TYPE_XBM", PyInt_FromLong((long) wxBITMAP_TYPE_XBM)); + PyDict_SetItemString(d,"wxBITMAP_TYPE_XBM_DATA", PyInt_FromLong((long) wxBITMAP_TYPE_XBM_DATA)); + PyDict_SetItemString(d,"wxBITMAP_TYPE_XPM", PyInt_FromLong((long) wxBITMAP_TYPE_XPM)); + PyDict_SetItemString(d,"wxBITMAP_TYPE_XPM_DATA", PyInt_FromLong((long) wxBITMAP_TYPE_XPM_DATA)); + PyDict_SetItemString(d,"wxBITMAP_TYPE_TIF", PyInt_FromLong((long) wxBITMAP_TYPE_TIF)); + PyDict_SetItemString(d,"wxBITMAP_TYPE_TIF_RESOURCE", PyInt_FromLong((long) wxBITMAP_TYPE_TIF_RESOURCE)); + PyDict_SetItemString(d,"wxBITMAP_TYPE_GIF", PyInt_FromLong((long) wxBITMAP_TYPE_GIF)); + PyDict_SetItemString(d,"wxBITMAP_TYPE_GIF_RESOURCE", PyInt_FromLong((long) wxBITMAP_TYPE_GIF_RESOURCE)); + PyDict_SetItemString(d,"wxBITMAP_TYPE_PNG", PyInt_FromLong((long) wxBITMAP_TYPE_PNG)); + PyDict_SetItemString(d,"wxBITMAP_TYPE_PNG_RESOURCE", PyInt_FromLong((long) wxBITMAP_TYPE_PNG_RESOURCE)); + PyDict_SetItemString(d,"wxBITMAP_TYPE_ANY", PyInt_FromLong((long) wxBITMAP_TYPE_ANY)); + PyDict_SetItemString(d,"wxBITMAP_TYPE_RESOURCE", PyInt_FromLong((long) wxBITMAP_TYPE_RESOURCE)); + PyDict_SetItemString(d,"wxOPEN", PyInt_FromLong((long) wxOPEN)); + PyDict_SetItemString(d,"wxSAVE", PyInt_FromLong((long) wxSAVE)); + PyDict_SetItemString(d,"wxHIDE_READONLY", PyInt_FromLong((long) wxHIDE_READONLY)); + PyDict_SetItemString(d,"wxOVERWRITE_PROMPT", PyInt_FromLong((long) wxOVERWRITE_PROMPT)); + PyDict_SetItemString(d,"wxACCEL_ALT", PyInt_FromLong((long) wxACCEL_ALT)); + PyDict_SetItemString(d,"wxACCEL_CTRL", PyInt_FromLong((long) wxACCEL_CTRL)); + PyDict_SetItemString(d,"wxACCEL_SHIFT", PyInt_FromLong((long) wxACCEL_SHIFT)); + PyDict_SetItemString(d,"ERR_PARAM", PyInt_FromLong((long) ERR_PARAM)); + PyDict_SetItemString(d,"ERR_NODATA", PyInt_FromLong((long) ERR_NODATA)); + PyDict_SetItemString(d,"ERR_CANCEL", PyInt_FromLong((long) ERR_CANCEL)); + PyDict_SetItemString(d,"ERR_SUCCESS", PyInt_FromLong((long) ERR_SUCCESS)); + PyDict_SetItemString(d,"wxDEFAULT", PyInt_FromLong((long) wxDEFAULT)); + PyDict_SetItemString(d,"wxDECORATIVE", PyInt_FromLong((long) wxDECORATIVE)); + PyDict_SetItemString(d,"wxROMAN", PyInt_FromLong((long) wxROMAN)); + PyDict_SetItemString(d,"wxSCRIPT", PyInt_FromLong((long) wxSCRIPT)); + PyDict_SetItemString(d,"wxSWISS", PyInt_FromLong((long) wxSWISS)); + PyDict_SetItemString(d,"wxMODERN", PyInt_FromLong((long) wxMODERN)); + PyDict_SetItemString(d,"wxTELETYPE", PyInt_FromLong((long) wxTELETYPE)); + PyDict_SetItemString(d,"wxVARIABLE", PyInt_FromLong((long) wxVARIABLE)); + PyDict_SetItemString(d,"wxFIXED", PyInt_FromLong((long) wxFIXED)); + PyDict_SetItemString(d,"wxNORMAL", PyInt_FromLong((long) wxNORMAL)); + PyDict_SetItemString(d,"wxLIGHT", PyInt_FromLong((long) wxLIGHT)); + PyDict_SetItemString(d,"wxBOLD", PyInt_FromLong((long) wxBOLD)); + PyDict_SetItemString(d,"wxITALIC", PyInt_FromLong((long) wxITALIC)); + PyDict_SetItemString(d,"wxSLANT", PyInt_FromLong((long) wxSLANT)); + PyDict_SetItemString(d,"wxSOLID", PyInt_FromLong((long) wxSOLID)); + PyDict_SetItemString(d,"wxDOT", PyInt_FromLong((long) wxDOT)); + PyDict_SetItemString(d,"wxLONG_DASH", PyInt_FromLong((long) wxLONG_DASH)); + PyDict_SetItemString(d,"wxSHORT_DASH", PyInt_FromLong((long) wxSHORT_DASH)); + PyDict_SetItemString(d,"wxDOT_DASH", PyInt_FromLong((long) wxDOT_DASH)); + PyDict_SetItemString(d,"wxUSER_DASH", PyInt_FromLong((long) wxUSER_DASH)); + PyDict_SetItemString(d,"wxTRANSPARENT", PyInt_FromLong((long) wxTRANSPARENT)); + PyDict_SetItemString(d,"wxSTIPPLE", PyInt_FromLong((long) wxSTIPPLE)); + PyDict_SetItemString(d,"wxBDIAGONAL_HATCH", PyInt_FromLong((long) wxBDIAGONAL_HATCH)); + PyDict_SetItemString(d,"wxCROSSDIAG_HATCH", PyInt_FromLong((long) wxCROSSDIAG_HATCH)); + PyDict_SetItemString(d,"wxFDIAGONAL_HATCH", PyInt_FromLong((long) wxFDIAGONAL_HATCH)); + PyDict_SetItemString(d,"wxCROSS_HATCH", PyInt_FromLong((long) wxCROSS_HATCH)); + PyDict_SetItemString(d,"wxHORIZONTAL_HATCH", PyInt_FromLong((long) wxHORIZONTAL_HATCH)); + PyDict_SetItemString(d,"wxVERTICAL_HATCH", PyInt_FromLong((long) wxVERTICAL_HATCH)); + PyDict_SetItemString(d,"wxJOIN_BEVEL", PyInt_FromLong((long) wxJOIN_BEVEL)); + PyDict_SetItemString(d,"wxJOIN_MITER", PyInt_FromLong((long) wxJOIN_MITER)); + PyDict_SetItemString(d,"wxJOIN_ROUND", PyInt_FromLong((long) wxJOIN_ROUND)); + PyDict_SetItemString(d,"wxCAP_ROUND", PyInt_FromLong((long) wxCAP_ROUND)); + PyDict_SetItemString(d,"wxCAP_PROJECTING", PyInt_FromLong((long) wxCAP_PROJECTING)); + PyDict_SetItemString(d,"wxCAP_BUTT", PyInt_FromLong((long) wxCAP_BUTT)); + PyDict_SetItemString(d,"wxCLEAR", PyInt_FromLong((long) wxCLEAR)); + PyDict_SetItemString(d,"wxXOR", PyInt_FromLong((long) wxXOR)); + PyDict_SetItemString(d,"wxINVERT", PyInt_FromLong((long) wxINVERT)); + PyDict_SetItemString(d,"wxOR_REVERSE", PyInt_FromLong((long) wxOR_REVERSE)); + PyDict_SetItemString(d,"wxAND_REVERSE", PyInt_FromLong((long) wxAND_REVERSE)); + PyDict_SetItemString(d,"wxCOPY", PyInt_FromLong((long) wxCOPY)); + PyDict_SetItemString(d,"wxAND", PyInt_FromLong((long) wxAND)); + PyDict_SetItemString(d,"wxAND_INVERT", PyInt_FromLong((long) wxAND_INVERT)); + PyDict_SetItemString(d,"wxNO_OP", PyInt_FromLong((long) wxNO_OP)); + PyDict_SetItemString(d,"wxNOR", PyInt_FromLong((long) wxNOR)); + PyDict_SetItemString(d,"wxEQUIV", PyInt_FromLong((long) wxEQUIV)); + PyDict_SetItemString(d,"wxSRC_INVERT", PyInt_FromLong((long) wxSRC_INVERT)); + PyDict_SetItemString(d,"wxOR_INVERT", PyInt_FromLong((long) wxOR_INVERT)); + PyDict_SetItemString(d,"wxNAND", PyInt_FromLong((long) wxNAND)); + PyDict_SetItemString(d,"wxOR", PyInt_FromLong((long) wxOR)); + PyDict_SetItemString(d,"wxSET", PyInt_FromLong((long) wxSET)); + PyDict_SetItemString(d,"wxSRC_OR", PyInt_FromLong((long) wxSRC_OR)); + PyDict_SetItemString(d,"wxSRC_AND", PyInt_FromLong((long) wxSRC_AND)); + PyDict_SetItemString(d,"WXK_BACK", PyInt_FromLong((long) WXK_BACK)); + PyDict_SetItemString(d,"WXK_TAB", PyInt_FromLong((long) WXK_TAB)); + PyDict_SetItemString(d,"WXK_RETURN", PyInt_FromLong((long) WXK_RETURN)); + PyDict_SetItemString(d,"WXK_ESCAPE", PyInt_FromLong((long) WXK_ESCAPE)); + PyDict_SetItemString(d,"WXK_SPACE", PyInt_FromLong((long) WXK_SPACE)); + PyDict_SetItemString(d,"WXK_DELETE", PyInt_FromLong((long) WXK_DELETE)); + PyDict_SetItemString(d,"WXK_START", PyInt_FromLong((long) WXK_START)); + PyDict_SetItemString(d,"WXK_LBUTTON", PyInt_FromLong((long) WXK_LBUTTON)); + PyDict_SetItemString(d,"WXK_RBUTTON", PyInt_FromLong((long) WXK_RBUTTON)); + PyDict_SetItemString(d,"WXK_CANCEL", PyInt_FromLong((long) WXK_CANCEL)); + PyDict_SetItemString(d,"WXK_MBUTTON", PyInt_FromLong((long) WXK_MBUTTON)); + PyDict_SetItemString(d,"WXK_CLEAR", PyInt_FromLong((long) WXK_CLEAR)); + PyDict_SetItemString(d,"WXK_SHIFT", PyInt_FromLong((long) WXK_SHIFT)); + PyDict_SetItemString(d,"WXK_CONTROL", PyInt_FromLong((long) WXK_CONTROL)); + PyDict_SetItemString(d,"WXK_MENU", PyInt_FromLong((long) WXK_MENU)); + PyDict_SetItemString(d,"WXK_PAUSE", PyInt_FromLong((long) WXK_PAUSE)); + PyDict_SetItemString(d,"WXK_CAPITAL", PyInt_FromLong((long) WXK_CAPITAL)); + PyDict_SetItemString(d,"WXK_PRIOR", PyInt_FromLong((long) WXK_PRIOR)); + PyDict_SetItemString(d,"WXK_NEXT", PyInt_FromLong((long) WXK_NEXT)); + PyDict_SetItemString(d,"WXK_END", PyInt_FromLong((long) WXK_END)); + PyDict_SetItemString(d,"WXK_HOME", PyInt_FromLong((long) WXK_HOME)); + PyDict_SetItemString(d,"WXK_LEFT", PyInt_FromLong((long) WXK_LEFT)); + PyDict_SetItemString(d,"WXK_UP", PyInt_FromLong((long) WXK_UP)); + PyDict_SetItemString(d,"WXK_RIGHT", PyInt_FromLong((long) WXK_RIGHT)); + PyDict_SetItemString(d,"WXK_DOWN", PyInt_FromLong((long) WXK_DOWN)); + PyDict_SetItemString(d,"WXK_SELECT", PyInt_FromLong((long) WXK_SELECT)); + PyDict_SetItemString(d,"WXK_PRINT", PyInt_FromLong((long) WXK_PRINT)); + PyDict_SetItemString(d,"WXK_EXECUTE", PyInt_FromLong((long) WXK_EXECUTE)); + PyDict_SetItemString(d,"WXK_SNAPSHOT", PyInt_FromLong((long) WXK_SNAPSHOT)); + PyDict_SetItemString(d,"WXK_INSERT", PyInt_FromLong((long) WXK_INSERT)); + PyDict_SetItemString(d,"WXK_HELP", PyInt_FromLong((long) WXK_HELP)); + PyDict_SetItemString(d,"WXK_NUMPAD0", PyInt_FromLong((long) WXK_NUMPAD0)); + PyDict_SetItemString(d,"WXK_NUMPAD1", PyInt_FromLong((long) WXK_NUMPAD1)); + PyDict_SetItemString(d,"WXK_NUMPAD2", PyInt_FromLong((long) WXK_NUMPAD2)); + PyDict_SetItemString(d,"WXK_NUMPAD3", PyInt_FromLong((long) WXK_NUMPAD3)); + PyDict_SetItemString(d,"WXK_NUMPAD4", PyInt_FromLong((long) WXK_NUMPAD4)); + PyDict_SetItemString(d,"WXK_NUMPAD5", PyInt_FromLong((long) WXK_NUMPAD5)); + PyDict_SetItemString(d,"WXK_NUMPAD6", PyInt_FromLong((long) WXK_NUMPAD6)); + PyDict_SetItemString(d,"WXK_NUMPAD7", PyInt_FromLong((long) WXK_NUMPAD7)); + PyDict_SetItemString(d,"WXK_NUMPAD8", PyInt_FromLong((long) WXK_NUMPAD8)); + PyDict_SetItemString(d,"WXK_NUMPAD9", PyInt_FromLong((long) WXK_NUMPAD9)); + PyDict_SetItemString(d,"WXK_MULTIPLY", PyInt_FromLong((long) WXK_MULTIPLY)); + PyDict_SetItemString(d,"WXK_ADD", PyInt_FromLong((long) WXK_ADD)); + PyDict_SetItemString(d,"WXK_SEPARATOR", PyInt_FromLong((long) WXK_SEPARATOR)); + PyDict_SetItemString(d,"WXK_SUBTRACT", PyInt_FromLong((long) WXK_SUBTRACT)); + PyDict_SetItemString(d,"WXK_DECIMAL", PyInt_FromLong((long) WXK_DECIMAL)); + PyDict_SetItemString(d,"WXK_DIVIDE", PyInt_FromLong((long) WXK_DIVIDE)); + PyDict_SetItemString(d,"WXK_F1", PyInt_FromLong((long) WXK_F1)); + PyDict_SetItemString(d,"WXK_F2", PyInt_FromLong((long) WXK_F2)); + PyDict_SetItemString(d,"WXK_F3", PyInt_FromLong((long) WXK_F3)); + PyDict_SetItemString(d,"WXK_F4", PyInt_FromLong((long) WXK_F4)); + PyDict_SetItemString(d,"WXK_F5", PyInt_FromLong((long) WXK_F5)); + PyDict_SetItemString(d,"WXK_F6", PyInt_FromLong((long) WXK_F6)); + PyDict_SetItemString(d,"WXK_F7", PyInt_FromLong((long) WXK_F7)); + PyDict_SetItemString(d,"WXK_F8", PyInt_FromLong((long) WXK_F8)); + PyDict_SetItemString(d,"WXK_F9", PyInt_FromLong((long) WXK_F9)); + PyDict_SetItemString(d,"WXK_F10", PyInt_FromLong((long) WXK_F10)); + PyDict_SetItemString(d,"WXK_F11", PyInt_FromLong((long) WXK_F11)); + PyDict_SetItemString(d,"WXK_F12", PyInt_FromLong((long) WXK_F12)); + PyDict_SetItemString(d,"WXK_F13", PyInt_FromLong((long) WXK_F13)); + PyDict_SetItemString(d,"WXK_F14", PyInt_FromLong((long) WXK_F14)); + PyDict_SetItemString(d,"WXK_F15", PyInt_FromLong((long) WXK_F15)); + PyDict_SetItemString(d,"WXK_F16", PyInt_FromLong((long) WXK_F16)); + PyDict_SetItemString(d,"WXK_F17", PyInt_FromLong((long) WXK_F17)); + PyDict_SetItemString(d,"WXK_F18", PyInt_FromLong((long) WXK_F18)); + PyDict_SetItemString(d,"WXK_F19", PyInt_FromLong((long) WXK_F19)); + PyDict_SetItemString(d,"WXK_F20", PyInt_FromLong((long) WXK_F20)); + PyDict_SetItemString(d,"WXK_F21", PyInt_FromLong((long) WXK_F21)); + PyDict_SetItemString(d,"WXK_F22", PyInt_FromLong((long) WXK_F22)); + PyDict_SetItemString(d,"WXK_F23", PyInt_FromLong((long) WXK_F23)); + PyDict_SetItemString(d,"WXK_F24", PyInt_FromLong((long) WXK_F24)); + PyDict_SetItemString(d,"WXK_NUMLOCK", PyInt_FromLong((long) WXK_NUMLOCK)); + PyDict_SetItemString(d,"WXK_SCROLL", PyInt_FromLong((long) WXK_SCROLL)); + PyDict_SetItemString(d,"WXK_PAGEUP", PyInt_FromLong((long) WXK_PAGEUP)); + PyDict_SetItemString(d,"WXK_PAGEDOWN", PyInt_FromLong((long) WXK_PAGEDOWN)); + PyDict_SetItemString(d,"wxCURSOR_ARROW", PyInt_FromLong((long) wxCURSOR_ARROW)); + PyDict_SetItemString(d,"wxCURSOR_BULLSEYE", PyInt_FromLong((long) wxCURSOR_BULLSEYE)); + PyDict_SetItemString(d,"wxCURSOR_CHAR", PyInt_FromLong((long) wxCURSOR_CHAR)); + PyDict_SetItemString(d,"wxCURSOR_CROSS", PyInt_FromLong((long) wxCURSOR_CROSS)); + PyDict_SetItemString(d,"wxCURSOR_HAND", PyInt_FromLong((long) wxCURSOR_HAND)); + PyDict_SetItemString(d,"wxCURSOR_IBEAM", PyInt_FromLong((long) wxCURSOR_IBEAM)); + PyDict_SetItemString(d,"wxCURSOR_LEFT_BUTTON", PyInt_FromLong((long) wxCURSOR_LEFT_BUTTON)); + PyDict_SetItemString(d,"wxCURSOR_MAGNIFIER", PyInt_FromLong((long) wxCURSOR_MAGNIFIER)); + PyDict_SetItemString(d,"wxCURSOR_MIDDLE_BUTTON", PyInt_FromLong((long) wxCURSOR_MIDDLE_BUTTON)); + PyDict_SetItemString(d,"wxCURSOR_NO_ENTRY", PyInt_FromLong((long) wxCURSOR_NO_ENTRY)); + PyDict_SetItemString(d,"wxCURSOR_PAINT_BRUSH", PyInt_FromLong((long) wxCURSOR_PAINT_BRUSH)); + PyDict_SetItemString(d,"wxCURSOR_PENCIL", PyInt_FromLong((long) wxCURSOR_PENCIL)); + PyDict_SetItemString(d,"wxCURSOR_POINT_LEFT", PyInt_FromLong((long) wxCURSOR_POINT_LEFT)); + PyDict_SetItemString(d,"wxCURSOR_POINT_RIGHT", PyInt_FromLong((long) wxCURSOR_POINT_RIGHT)); + PyDict_SetItemString(d,"wxCURSOR_QUESTION_ARROW", PyInt_FromLong((long) wxCURSOR_QUESTION_ARROW)); + PyDict_SetItemString(d,"wxCURSOR_RIGHT_BUTTON", PyInt_FromLong((long) wxCURSOR_RIGHT_BUTTON)); + PyDict_SetItemString(d,"wxCURSOR_SIZENESW", PyInt_FromLong((long) wxCURSOR_SIZENESW)); + PyDict_SetItemString(d,"wxCURSOR_SIZENS", PyInt_FromLong((long) wxCURSOR_SIZENS)); + PyDict_SetItemString(d,"wxCURSOR_SIZENWSE", PyInt_FromLong((long) wxCURSOR_SIZENWSE)); + PyDict_SetItemString(d,"wxCURSOR_SIZEWE", PyInt_FromLong((long) wxCURSOR_SIZEWE)); + PyDict_SetItemString(d,"wxCURSOR_SIZING", PyInt_FromLong((long) wxCURSOR_SIZING)); + PyDict_SetItemString(d,"wxCURSOR_SPRAYCAN", PyInt_FromLong((long) wxCURSOR_SPRAYCAN)); + PyDict_SetItemString(d,"wxCURSOR_WAIT", PyInt_FromLong((long) wxCURSOR_WAIT)); + PyDict_SetItemString(d,"wxCURSOR_WATCH", PyInt_FromLong((long) wxCURSOR_WATCH)); + PyDict_SetItemString(d,"wxCURSOR_BLANK", PyInt_FromLong((long) wxCURSOR_BLANK)); + PyDict_SetItemString(d,"FALSE", PyInt_FromLong((long) 0)); + PyDict_SetItemString(d,"false", PyInt_FromLong((long) 0)); + PyDict_SetItemString(d,"TRUE", PyInt_FromLong((long) 1)); + PyDict_SetItemString(d,"true", PyInt_FromLong((long) 1)); + PyDict_SetItemString(d,"wxEVT_NULL", PyInt_FromLong((long) wxEVT_NULL)); + PyDict_SetItemString(d,"wxEVT_FIRST", PyInt_FromLong((long) wxEVT_FIRST)); + PyDict_SetItemString(d,"wxEVT_COMMAND_BUTTON_CLICKED", PyInt_FromLong((long) wxEVT_COMMAND_BUTTON_CLICKED)); + PyDict_SetItemString(d,"wxEVT_COMMAND_CHECKBOX_CLICKED", PyInt_FromLong((long) wxEVT_COMMAND_CHECKBOX_CLICKED)); + PyDict_SetItemString(d,"wxEVT_COMMAND_CHOICE_SELECTED", PyInt_FromLong((long) wxEVT_COMMAND_CHOICE_SELECTED)); + PyDict_SetItemString(d,"wxEVT_COMMAND_LISTBOX_SELECTED", PyInt_FromLong((long) wxEVT_COMMAND_LISTBOX_SELECTED)); + PyDict_SetItemString(d,"wxEVT_COMMAND_LISTBOX_DOUBLECLICKED", PyInt_FromLong((long) wxEVT_COMMAND_LISTBOX_DOUBLECLICKED)); + PyDict_SetItemString(d,"wxEVT_COMMAND_CHECKLISTBOX_TOGGLED", PyInt_FromLong((long) wxEVT_COMMAND_CHECKLISTBOX_TOGGLED)); + PyDict_SetItemString(d,"wxEVT_COMMAND_TEXT_UPDATED", PyInt_FromLong((long) wxEVT_COMMAND_TEXT_UPDATED)); + PyDict_SetItemString(d,"wxEVT_COMMAND_TEXT_ENTER", PyInt_FromLong((long) wxEVT_COMMAND_TEXT_ENTER)); + PyDict_SetItemString(d,"wxEVT_COMMAND_MENU_SELECTED", PyInt_FromLong((long) wxEVT_COMMAND_MENU_SELECTED)); + PyDict_SetItemString(d,"wxEVT_COMMAND_SLIDER_UPDATED", PyInt_FromLong((long) wxEVT_COMMAND_SLIDER_UPDATED)); + PyDict_SetItemString(d,"wxEVT_COMMAND_RADIOBOX_SELECTED", PyInt_FromLong((long) wxEVT_COMMAND_RADIOBOX_SELECTED)); + PyDict_SetItemString(d,"wxEVT_COMMAND_RADIOBUTTON_SELECTED", PyInt_FromLong((long) wxEVT_COMMAND_RADIOBUTTON_SELECTED)); + PyDict_SetItemString(d,"wxEVT_COMMAND_SCROLLBAR_UPDATED", PyInt_FromLong((long) wxEVT_COMMAND_SCROLLBAR_UPDATED)); + PyDict_SetItemString(d,"wxEVT_COMMAND_VLBOX_SELECTED", PyInt_FromLong((long) wxEVT_COMMAND_VLBOX_SELECTED)); + PyDict_SetItemString(d,"wxEVT_COMMAND_COMBOBOX_SELECTED", PyInt_FromLong((long) wxEVT_COMMAND_COMBOBOX_SELECTED)); + PyDict_SetItemString(d,"wxEVT_COMMAND_TOOL_CLICKED", PyInt_FromLong((long) wxEVT_COMMAND_TOOL_CLICKED)); + PyDict_SetItemString(d,"wxEVT_COMMAND_TOOL_RCLICKED", PyInt_FromLong((long) wxEVT_COMMAND_TOOL_RCLICKED)); + PyDict_SetItemString(d,"wxEVT_COMMAND_TOOL_ENTER", PyInt_FromLong((long) wxEVT_COMMAND_TOOL_ENTER)); + PyDict_SetItemString(d,"wxEVT_SET_FOCUS", PyInt_FromLong((long) wxEVT_SET_FOCUS)); + PyDict_SetItemString(d,"wxEVT_KILL_FOCUS", PyInt_FromLong((long) wxEVT_KILL_FOCUS)); + PyDict_SetItemString(d,"wxEVT_LEFT_DOWN", PyInt_FromLong((long) wxEVT_LEFT_DOWN)); + PyDict_SetItemString(d,"wxEVT_LEFT_UP", PyInt_FromLong((long) wxEVT_LEFT_UP)); + PyDict_SetItemString(d,"wxEVT_MIDDLE_DOWN", PyInt_FromLong((long) wxEVT_MIDDLE_DOWN)); + PyDict_SetItemString(d,"wxEVT_MIDDLE_UP", PyInt_FromLong((long) wxEVT_MIDDLE_UP)); + PyDict_SetItemString(d,"wxEVT_RIGHT_DOWN", PyInt_FromLong((long) wxEVT_RIGHT_DOWN)); + PyDict_SetItemString(d,"wxEVT_RIGHT_UP", PyInt_FromLong((long) wxEVT_RIGHT_UP)); + PyDict_SetItemString(d,"wxEVT_MOTION", PyInt_FromLong((long) wxEVT_MOTION)); + PyDict_SetItemString(d,"wxEVT_ENTER_WINDOW", PyInt_FromLong((long) wxEVT_ENTER_WINDOW)); + PyDict_SetItemString(d,"wxEVT_LEAVE_WINDOW", PyInt_FromLong((long) wxEVT_LEAVE_WINDOW)); + PyDict_SetItemString(d,"wxEVT_LEFT_DCLICK", PyInt_FromLong((long) wxEVT_LEFT_DCLICK)); + PyDict_SetItemString(d,"wxEVT_MIDDLE_DCLICK", PyInt_FromLong((long) wxEVT_MIDDLE_DCLICK)); + PyDict_SetItemString(d,"wxEVT_RIGHT_DCLICK", PyInt_FromLong((long) wxEVT_RIGHT_DCLICK)); + PyDict_SetItemString(d,"wxEVT_NC_LEFT_DOWN", PyInt_FromLong((long) wxEVT_NC_LEFT_DOWN)); + PyDict_SetItemString(d,"wxEVT_NC_LEFT_UP", PyInt_FromLong((long) wxEVT_NC_LEFT_UP)); + PyDict_SetItemString(d,"wxEVT_NC_MIDDLE_DOWN", PyInt_FromLong((long) wxEVT_NC_MIDDLE_DOWN)); + PyDict_SetItemString(d,"wxEVT_NC_MIDDLE_UP", PyInt_FromLong((long) wxEVT_NC_MIDDLE_UP)); + PyDict_SetItemString(d,"wxEVT_NC_RIGHT_DOWN", PyInt_FromLong((long) wxEVT_NC_RIGHT_DOWN)); + PyDict_SetItemString(d,"wxEVT_NC_RIGHT_UP", PyInt_FromLong((long) wxEVT_NC_RIGHT_UP)); + PyDict_SetItemString(d,"wxEVT_NC_MOTION", PyInt_FromLong((long) wxEVT_NC_MOTION)); + PyDict_SetItemString(d,"wxEVT_NC_ENTER_WINDOW", PyInt_FromLong((long) wxEVT_NC_ENTER_WINDOW)); + PyDict_SetItemString(d,"wxEVT_NC_LEAVE_WINDOW", PyInt_FromLong((long) wxEVT_NC_LEAVE_WINDOW)); + PyDict_SetItemString(d,"wxEVT_NC_LEFT_DCLICK", PyInt_FromLong((long) wxEVT_NC_LEFT_DCLICK)); + PyDict_SetItemString(d,"wxEVT_NC_MIDDLE_DCLICK", PyInt_FromLong((long) wxEVT_NC_MIDDLE_DCLICK)); + PyDict_SetItemString(d,"wxEVT_NC_RIGHT_DCLICK", PyInt_FromLong((long) wxEVT_NC_RIGHT_DCLICK)); + PyDict_SetItemString(d,"wxEVT_CHAR", PyInt_FromLong((long) wxEVT_CHAR)); + PyDict_SetItemString(d,"wxEVT_SCROLL_TOP", PyInt_FromLong((long) wxEVT_SCROLL_TOP)); + PyDict_SetItemString(d,"wxEVT_SCROLL_BOTTOM", PyInt_FromLong((long) wxEVT_SCROLL_BOTTOM)); + PyDict_SetItemString(d,"wxEVT_SCROLL_LINEUP", PyInt_FromLong((long) wxEVT_SCROLL_LINEUP)); + PyDict_SetItemString(d,"wxEVT_SCROLL_LINEDOWN", PyInt_FromLong((long) wxEVT_SCROLL_LINEDOWN)); + PyDict_SetItemString(d,"wxEVT_SCROLL_PAGEUP", PyInt_FromLong((long) wxEVT_SCROLL_PAGEUP)); + PyDict_SetItemString(d,"wxEVT_SCROLL_PAGEDOWN", PyInt_FromLong((long) wxEVT_SCROLL_PAGEDOWN)); + PyDict_SetItemString(d,"wxEVT_SCROLL_THUMBTRACK", PyInt_FromLong((long) wxEVT_SCROLL_THUMBTRACK)); + PyDict_SetItemString(d,"wxEVT_SIZE", PyInt_FromLong((long) wxEVT_SIZE)); + PyDict_SetItemString(d,"wxEVT_MOVE", PyInt_FromLong((long) wxEVT_MOVE)); + PyDict_SetItemString(d,"wxEVT_CLOSE_WINDOW", PyInt_FromLong((long) wxEVT_CLOSE_WINDOW)); + PyDict_SetItemString(d,"wxEVT_END_SESSION", PyInt_FromLong((long) wxEVT_END_SESSION)); + PyDict_SetItemString(d,"wxEVT_QUERY_END_SESSION", PyInt_FromLong((long) wxEVT_QUERY_END_SESSION)); + PyDict_SetItemString(d,"wxEVT_ACTIVATE_APP", PyInt_FromLong((long) wxEVT_ACTIVATE_APP)); + PyDict_SetItemString(d,"wxEVT_POWER", PyInt_FromLong((long) wxEVT_POWER)); + PyDict_SetItemString(d,"wxEVT_CHAR_HOOK", PyInt_FromLong((long) wxEVT_CHAR_HOOK)); + PyDict_SetItemString(d,"wxEVT_KEY_UP", PyInt_FromLong((long) wxEVT_KEY_UP)); + PyDict_SetItemString(d,"wxEVT_ACTIVATE", PyInt_FromLong((long) wxEVT_ACTIVATE)); + PyDict_SetItemString(d,"wxEVT_CREATE", PyInt_FromLong((long) wxEVT_CREATE)); + PyDict_SetItemString(d,"wxEVT_DESTROY", PyInt_FromLong((long) wxEVT_DESTROY)); + PyDict_SetItemString(d,"wxEVT_SHOW", PyInt_FromLong((long) wxEVT_SHOW)); + PyDict_SetItemString(d,"wxEVT_ICONIZE", PyInt_FromLong((long) wxEVT_ICONIZE)); + PyDict_SetItemString(d,"wxEVT_MAXIMIZE", PyInt_FromLong((long) wxEVT_MAXIMIZE)); + PyDict_SetItemString(d,"wxEVT_MOUSE_CAPTURE_CHANGED", PyInt_FromLong((long) wxEVT_MOUSE_CAPTURE_CHANGED)); + PyDict_SetItemString(d,"wxEVT_PAINT", PyInt_FromLong((long) wxEVT_PAINT)); + PyDict_SetItemString(d,"wxEVT_ERASE_BACKGROUND", PyInt_FromLong((long) wxEVT_ERASE_BACKGROUND)); + PyDict_SetItemString(d,"wxEVT_NC_PAINT", PyInt_FromLong((long) wxEVT_NC_PAINT)); + PyDict_SetItemString(d,"wxEVT_PAINT_ICON", PyInt_FromLong((long) wxEVT_PAINT_ICON)); + PyDict_SetItemString(d,"wxEVT_MENU_CHAR", PyInt_FromLong((long) wxEVT_MENU_CHAR)); + PyDict_SetItemString(d,"wxEVT_MENU_INIT", PyInt_FromLong((long) wxEVT_MENU_INIT)); + PyDict_SetItemString(d,"wxEVT_MENU_HIGHLIGHT", PyInt_FromLong((long) wxEVT_MENU_HIGHLIGHT)); + PyDict_SetItemString(d,"wxEVT_POPUP_MENU_INIT", PyInt_FromLong((long) wxEVT_POPUP_MENU_INIT)); + PyDict_SetItemString(d,"wxEVT_CONTEXT_MENU", PyInt_FromLong((long) wxEVT_CONTEXT_MENU)); + PyDict_SetItemString(d,"wxEVT_SYS_COLOUR_CHANGED", PyInt_FromLong((long) wxEVT_SYS_COLOUR_CHANGED)); + PyDict_SetItemString(d,"wxEVT_SETTING_CHANGED", PyInt_FromLong((long) wxEVT_SETTING_CHANGED)); + PyDict_SetItemString(d,"wxEVT_QUERY_NEW_PALETTE", PyInt_FromLong((long) wxEVT_QUERY_NEW_PALETTE)); + PyDict_SetItemString(d,"wxEVT_PALETTE_CHANGED", PyInt_FromLong((long) wxEVT_PALETTE_CHANGED)); + PyDict_SetItemString(d,"wxEVT_JOY_BUTTON_DOWN", PyInt_FromLong((long) wxEVT_JOY_BUTTON_DOWN)); + PyDict_SetItemString(d,"wxEVT_JOY_BUTTON_UP", PyInt_FromLong((long) wxEVT_JOY_BUTTON_UP)); + PyDict_SetItemString(d,"wxEVT_JOY_MOVE", PyInt_FromLong((long) wxEVT_JOY_MOVE)); + PyDict_SetItemString(d,"wxEVT_JOY_ZMOVE", PyInt_FromLong((long) wxEVT_JOY_ZMOVE)); + PyDict_SetItemString(d,"wxEVT_DROP_FILES", PyInt_FromLong((long) wxEVT_DROP_FILES)); + PyDict_SetItemString(d,"wxEVT_DRAW_ITEM", PyInt_FromLong((long) wxEVT_DRAW_ITEM)); + PyDict_SetItemString(d,"wxEVT_MEASURE_ITEM", PyInt_FromLong((long) wxEVT_MEASURE_ITEM)); + PyDict_SetItemString(d,"wxEVT_COMPARE_ITEM", PyInt_FromLong((long) wxEVT_COMPARE_ITEM)); + PyDict_SetItemString(d,"wxEVT_INIT_DIALOG", PyInt_FromLong((long) wxEVT_INIT_DIALOG)); + PyDict_SetItemString(d,"wxEVT_IDLE", PyInt_FromLong((long) wxEVT_IDLE)); + PyDict_SetItemString(d,"wxEVT_UPDATE_UI", PyInt_FromLong((long) wxEVT_UPDATE_UI)); + PyDict_SetItemString(d,"wxEVT_COMMAND_LEFT_CLICK", PyInt_FromLong((long) wxEVT_COMMAND_LEFT_CLICK)); + PyDict_SetItemString(d,"wxEVT_COMMAND_LEFT_DCLICK", PyInt_FromLong((long) wxEVT_COMMAND_LEFT_DCLICK)); + PyDict_SetItemString(d,"wxEVT_COMMAND_RIGHT_CLICK", PyInt_FromLong((long) wxEVT_COMMAND_RIGHT_CLICK)); + PyDict_SetItemString(d,"wxEVT_COMMAND_RIGHT_DCLICK", PyInt_FromLong((long) wxEVT_COMMAND_RIGHT_DCLICK)); + PyDict_SetItemString(d,"wxEVT_COMMAND_SET_FOCUS", PyInt_FromLong((long) wxEVT_COMMAND_SET_FOCUS)); + PyDict_SetItemString(d,"wxEVT_COMMAND_KILL_FOCUS", PyInt_FromLong((long) wxEVT_COMMAND_KILL_FOCUS)); + PyDict_SetItemString(d,"wxEVT_COMMAND_ENTER", PyInt_FromLong((long) wxEVT_COMMAND_ENTER)); + PyDict_SetItemString(d,"wxEVT_COMMAND_TREE_BEGIN_DRAG", PyInt_FromLong((long) wxEVT_COMMAND_TREE_BEGIN_DRAG)); + PyDict_SetItemString(d,"wxEVT_COMMAND_TREE_BEGIN_RDRAG", PyInt_FromLong((long) wxEVT_COMMAND_TREE_BEGIN_RDRAG)); + PyDict_SetItemString(d,"wxEVT_COMMAND_TREE_BEGIN_LABEL_EDIT", PyInt_FromLong((long) wxEVT_COMMAND_TREE_BEGIN_LABEL_EDIT)); + PyDict_SetItemString(d,"wxEVT_COMMAND_TREE_END_LABEL_EDIT", PyInt_FromLong((long) wxEVT_COMMAND_TREE_END_LABEL_EDIT)); + PyDict_SetItemString(d,"wxEVT_COMMAND_TREE_DELETE_ITEM", PyInt_FromLong((long) wxEVT_COMMAND_TREE_DELETE_ITEM)); + PyDict_SetItemString(d,"wxEVT_COMMAND_TREE_GET_INFO", PyInt_FromLong((long) wxEVT_COMMAND_TREE_GET_INFO)); + PyDict_SetItemString(d,"wxEVT_COMMAND_TREE_SET_INFO", PyInt_FromLong((long) wxEVT_COMMAND_TREE_SET_INFO)); + PyDict_SetItemString(d,"wxEVT_COMMAND_TREE_ITEM_EXPANDED", PyInt_FromLong((long) wxEVT_COMMAND_TREE_ITEM_EXPANDED)); + PyDict_SetItemString(d,"wxEVT_COMMAND_TREE_ITEM_EXPANDING", PyInt_FromLong((long) wxEVT_COMMAND_TREE_ITEM_EXPANDING)); + PyDict_SetItemString(d,"wxEVT_COMMAND_TREE_SEL_CHANGED", PyInt_FromLong((long) wxEVT_COMMAND_TREE_SEL_CHANGED)); + PyDict_SetItemString(d,"wxEVT_COMMAND_TREE_SEL_CHANGING", PyInt_FromLong((long) wxEVT_COMMAND_TREE_SEL_CHANGING)); + PyDict_SetItemString(d,"wxEVT_COMMAND_TREE_KEY_DOWN", PyInt_FromLong((long) wxEVT_COMMAND_TREE_KEY_DOWN)); + PyDict_SetItemString(d,"wxEVT_COMMAND_LIST_BEGIN_DRAG", PyInt_FromLong((long) wxEVT_COMMAND_LIST_BEGIN_DRAG)); + PyDict_SetItemString(d,"wxEVT_COMMAND_LIST_BEGIN_RDRAG", PyInt_FromLong((long) wxEVT_COMMAND_LIST_BEGIN_RDRAG)); + PyDict_SetItemString(d,"wxEVT_COMMAND_LIST_BEGIN_LABEL_EDIT", PyInt_FromLong((long) wxEVT_COMMAND_LIST_BEGIN_LABEL_EDIT)); + PyDict_SetItemString(d,"wxEVT_COMMAND_LIST_END_LABEL_EDIT", PyInt_FromLong((long) wxEVT_COMMAND_LIST_END_LABEL_EDIT)); + PyDict_SetItemString(d,"wxEVT_COMMAND_LIST_DELETE_ITEM", PyInt_FromLong((long) wxEVT_COMMAND_LIST_DELETE_ITEM)); + PyDict_SetItemString(d,"wxEVT_COMMAND_LIST_DELETE_ALL_ITEMS", PyInt_FromLong((long) wxEVT_COMMAND_LIST_DELETE_ALL_ITEMS)); + PyDict_SetItemString(d,"wxEVT_COMMAND_LIST_GET_INFO", PyInt_FromLong((long) wxEVT_COMMAND_LIST_GET_INFO)); + PyDict_SetItemString(d,"wxEVT_COMMAND_LIST_SET_INFO", PyInt_FromLong((long) wxEVT_COMMAND_LIST_SET_INFO)); + PyDict_SetItemString(d,"wxEVT_COMMAND_LIST_ITEM_SELECTED", PyInt_FromLong((long) wxEVT_COMMAND_LIST_ITEM_SELECTED)); + PyDict_SetItemString(d,"wxEVT_COMMAND_LIST_ITEM_DESELECTED", PyInt_FromLong((long) wxEVT_COMMAND_LIST_ITEM_DESELECTED)); + PyDict_SetItemString(d,"wxEVT_COMMAND_LIST_KEY_DOWN", PyInt_FromLong((long) wxEVT_COMMAND_LIST_KEY_DOWN)); + PyDict_SetItemString(d,"wxEVT_COMMAND_LIST_INSERT_ITEM", PyInt_FromLong((long) wxEVT_COMMAND_LIST_INSERT_ITEM)); + PyDict_SetItemString(d,"wxEVT_COMMAND_LIST_COL_CLICK", PyInt_FromLong((long) wxEVT_COMMAND_LIST_COL_CLICK)); + PyDict_SetItemString(d,"wxEVT_COMMAND_TAB_SEL_CHANGED", PyInt_FromLong((long) wxEVT_COMMAND_TAB_SEL_CHANGED)); + PyDict_SetItemString(d,"wxEVT_COMMAND_TAB_SEL_CHANGING", PyInt_FromLong((long) wxEVT_COMMAND_TAB_SEL_CHANGING)); + PyDict_SetItemString(d,"wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED", PyInt_FromLong((long) wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED)); + PyDict_SetItemString(d,"wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING", PyInt_FromLong((long) wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING)); + PyDict_SetItemString(d,"__version__", PyString_FromString("0.3.1")); + PyDict_SetItemString(d,"cvar", SWIG_globals); + SWIG_addvarlink(SWIG_globals,"wxPyDefaultPosition",_wrap_wxPyDefaultPosition_get, _wrap_wxPyDefaultPosition_set); + SWIG_addvarlink(SWIG_globals,"wxPyDefaultSize",_wrap_wxPyDefaultSize_get, _wrap_wxPyDefaultSize_set); + + // We don't want to run the wxEntry or OnInit yet, so we just do the + // beginings of what it would have done... See __wxStart() for the + // rest. +#ifdef __WXMSW__ + wxApp::Initialize((WXHINSTANCE)wxhInstance); +#endif +#ifdef __WXGTK__ + wxApp::CommonInit(); +#endif + + +// wxPyWindows = new wxHashTable(wxKEY_INTEGER, 100); + + // Since these modules are all linked together, initialize them now + // because python won't be able to find their shared library files, + // (since there isn't any.) + initwindowsc(); + initwindows2c(); + initeventsc(); + initmiscc(); + initgdic(); + initmdic(); + initcontrolsc(); + initcontrols2c(); + initcmndlgsc(); +/* + * These are the pointer type-equivalency mappings. + * (Used by the SWIG pointer type-checker). + */ + SWIG_RegisterMapping("_wxAcceleratorTable","_class_wxAcceleratorTable",0); + SWIG_RegisterMapping("_wxEvent","_class_wxEvent",0); + SWIG_RegisterMapping("_class_wxActivateEvent","_wxActivateEvent",0); + SWIG_RegisterMapping("_signed_long","_long",0); + SWIG_RegisterMapping("_wxMenuEvent","_class_wxMenuEvent",0); + SWIG_RegisterMapping("_wxFontData","_class_wxFontData",0); + SWIG_RegisterMapping("_class_wxMenuBar","_wxMenuBar",0); + SWIG_RegisterMapping("_class_wxEvtHandler","_class_wxPyApp",SwigwxPyAppTowxEvtHandler); + SWIG_RegisterMapping("_class_wxEvtHandler","_wxPyApp",SwigwxPyAppTowxEvtHandler); + SWIG_RegisterMapping("_class_wxEvtHandler","_wxEvtHandler",0); + SWIG_RegisterMapping("_wxPaintEvent","_class_wxPaintEvent",0); + SWIG_RegisterMapping("_wxIndividualLayoutConstraint","_class_wxIndividualLayoutConstraint",0); + SWIG_RegisterMapping("_wxCursor","_class_wxCursor",0); + SWIG_RegisterMapping("_class_wxTreeCtrl","_wxTreeCtrl",0); + SWIG_RegisterMapping("_wxMask","_class_wxMask",0); + SWIG_RegisterMapping("_wxGrid","_class_wxGrid",0); + SWIG_RegisterMapping("_wxPageSetupData","_class_wxPageSetupData",0); + SWIG_RegisterMapping("_wxPyMenu","_class_wxPyMenu",0); + SWIG_RegisterMapping("_class_wxColourData","_wxColourData",0); + SWIG_RegisterMapping("_wxPen","_class_wxPen",0); + SWIG_RegisterMapping("_wxUpdateUIEvent","_class_wxUpdateUIEvent",0); + SWIG_RegisterMapping("_byte","_unsigned_char",0); + SWIG_RegisterMapping("_wxStaticBox","_class_wxStaticBox",0); + SWIG_RegisterMapping("_wxChoice","_class_wxChoice",0); + SWIG_RegisterMapping("_wxSlider","_class_wxSlider",0); + SWIG_RegisterMapping("_wxNotebookEvent","_class_wxNotebookEvent",0); + SWIG_RegisterMapping("_long","_wxDash",0); + SWIG_RegisterMapping("_long","_unsigned_long",0); + SWIG_RegisterMapping("_long","_signed_long",0); + SWIG_RegisterMapping("_wxDropFilesEvent","_class_wxDropFilesEvent",0); + SWIG_RegisterMapping("_wxBitmapButton","_class_wxBitmapButton",0); + SWIG_RegisterMapping("_class_wxAcceleratorTable","_wxAcceleratorTable",0); + SWIG_RegisterMapping("_class_wxGauge","_wxGauge",0); + SWIG_RegisterMapping("_wxDC","_class_wxDC",0); + SWIG_RegisterMapping("_wxListEvent","_class_wxListEvent",0); + SWIG_RegisterMapping("_class_wxSingleChoiceDialog","_wxSingleChoiceDialog",0); + SWIG_RegisterMapping("_class_wxRealPoint","_wxRealPoint",0); + SWIG_RegisterMapping("_wxPrinterDC","_class_wxPrinterDC",0); + SWIG_RegisterMapping("_class_wxMenuItem","_wxMenuItem",0); + SWIG_RegisterMapping("_class_wxPaintEvent","_wxPaintEvent",0); + SWIG_RegisterMapping("_wxSysColourChangedEvent","_class_wxSysColourChangedEvent",0); + SWIG_RegisterMapping("_class_wxPostScriptDC","_wxPostScriptDC",0); + SWIG_RegisterMapping("_wxPanel","_class_wxPanel",0); + SWIG_RegisterMapping("_wxInitDialogEvent","_class_wxInitDialogEvent",0); + SWIG_RegisterMapping("_wxCheckBox","_class_wxCheckBox",0); + SWIG_RegisterMapping("_wxTextCtrl","_class_wxTextCtrl",0); + SWIG_RegisterMapping("_class_wxMask","_wxMask",0); + SWIG_RegisterMapping("_class_wxKeyEvent","_wxKeyEvent",0); + SWIG_RegisterMapping("_class_wxGrid","_wxGrid",0); + SWIG_RegisterMapping("_class_wxPageSetupData","_wxPageSetupData",0); + SWIG_RegisterMapping("_wxColour","_class_wxColour",0); + SWIG_RegisterMapping("_class_wxDialog","_wxDialog",0); + SWIG_RegisterMapping("_wxPageSetupDialog","_class_wxPageSetupDialog",0); + SWIG_RegisterMapping("_wxIdleEvent","_class_wxIdleEvent",0); + SWIG_RegisterMapping("_class_wxUpdateUIEvent","_wxUpdateUIEvent",0); + SWIG_RegisterMapping("_wxBrush","_class_wxBrush",0); + SWIG_RegisterMapping("_wxMiniFrame","_class_wxMiniFrame",0); + SWIG_RegisterMapping("_class_wxNotebookEvent","_wxNotebookEvent",0); + SWIG_RegisterMapping("_wxShowEvent","_class_wxShowEvent",0); + SWIG_RegisterMapping("_uint","_unsigned_int",0); + SWIG_RegisterMapping("_uint","_int",0); + SWIG_RegisterMapping("_uint","_wxWindowID",0); + SWIG_RegisterMapping("_class_wxEvent","_wxEvent",0); + SWIG_RegisterMapping("_wxRect","_class_wxRect",0); + SWIG_RegisterMapping("_wxCommandEvent","_class_wxCommandEvent",0); + SWIG_RegisterMapping("_wxSizeEvent","_class_wxSizeEvent",0); + SWIG_RegisterMapping("_wxPoint","_class_wxPoint",0); + SWIG_RegisterMapping("_class_wxButton","_wxButton",0); + SWIG_RegisterMapping("_wxRadioBox","_class_wxRadioBox",0); + SWIG_RegisterMapping("_class_wxFontData","_wxFontData",0); + SWIG_RegisterMapping("_wxBitmap","_class_wxBitmap",0); + SWIG_RegisterMapping("_wxPrintDialog","_class_wxPrintDialog",0); + SWIG_RegisterMapping("_wxPyTimer","_class_wxPyTimer",0); + SWIG_RegisterMapping("_wxScrollBar","_class_wxScrollBar",0); + SWIG_RegisterMapping("_wxSpinButton","_class_wxSpinButton",0); + SWIG_RegisterMapping("_wxColourDialog","_class_wxColourDialog",0); + SWIG_RegisterMapping("_wxPrintData","_class_wxPrintData",0); + SWIG_RegisterMapping("_class_wxIndividualLayoutConstraint","_wxIndividualLayoutConstraint",0); + SWIG_RegisterMapping("_wxMessageDialog","_class_wxMessageDialog",0); + SWIG_RegisterMapping("_wxTextEntryDialog","_class_wxTextEntryDialog",0); + SWIG_RegisterMapping("_class_wxIconizeEvent","_wxIconizeEvent",0); + SWIG_RegisterMapping("_class_wxStaticBitmap","_wxStaticBitmap",0); + SWIG_RegisterMapping("_wxMDIChildFrame","_class_wxMDIChildFrame",0); + SWIG_RegisterMapping("_wxListItem","_class_wxListItem",0); + SWIG_RegisterMapping("_wxScrollEvent","_class_wxScrollEvent",0); + SWIG_RegisterMapping("_EBool","_signed_int",0); + SWIG_RegisterMapping("_EBool","_int",0); + SWIG_RegisterMapping("_EBool","_wxWindowID",0); + SWIG_RegisterMapping("_class_wxDropFilesEvent","_wxDropFilesEvent",0); + SWIG_RegisterMapping("_wxStaticText","_class_wxStaticText",0); + SWIG_RegisterMapping("_wxFont","_class_wxFont",0); + SWIG_RegisterMapping("_wxCloseEvent","_class_wxCloseEvent",0); + SWIG_RegisterMapping("_wxNotebook","_class_wxNotebook",0); + SWIG_RegisterMapping("_unsigned_long","_wxDash",0); + SWIG_RegisterMapping("_unsigned_long","_long",0); + SWIG_RegisterMapping("_class_wxRect","_wxRect",0); + SWIG_RegisterMapping("_class_wxDC","_wxDC",0); + SWIG_RegisterMapping("_wxPyApp","_class_wxPyApp",0); + SWIG_RegisterMapping("_wxMDIParentFrame","_class_wxMDIParentFrame",0); + SWIG_RegisterMapping("_class_wxTreeEvent","_wxTreeEvent",0); + SWIG_RegisterMapping("_class_wxDirDialog","_wxDirDialog",0); + SWIG_RegisterMapping("_class_wxPyTimer","_wxPyTimer",0); + SWIG_RegisterMapping("_wxFocusEvent","_class_wxFocusEvent",0); + SWIG_RegisterMapping("_wxMaximizeEvent","_class_wxMaximizeEvent",0); + SWIG_RegisterMapping("_class_wxSpinButton","_wxSpinButton",0); + SWIG_RegisterMapping("_wxAcceleratorEntry","_class_wxAcceleratorEntry",0); + SWIG_RegisterMapping("_class_wxPanel","_wxPanel",0); + SWIG_RegisterMapping("_class_wxCheckBox","_wxCheckBox",0); + SWIG_RegisterMapping("_wxComboBox","_class_wxComboBox",0); + SWIG_RegisterMapping("_wxRadioButton","_class_wxRadioButton",0); + SWIG_RegisterMapping("_class_wxMessageDialog","_wxMessageDialog",0); + SWIG_RegisterMapping("_signed_int","_EBool",0); + SWIG_RegisterMapping("_signed_int","_wxWindowID",0); + SWIG_RegisterMapping("_signed_int","_int",0); + SWIG_RegisterMapping("_class_wxTextCtrl","_wxTextCtrl",0); + SWIG_RegisterMapping("_wxLayoutConstraints","_class_wxLayoutConstraints",0); + SWIG_RegisterMapping("_wxMetaFileDC","_class_wxMetaFileDC",0); + SWIG_RegisterMapping("_wxMenu","_class_wxMenu",0); + SWIG_RegisterMapping("_class_wxMoveEvent","_wxMoveEvent",0); + SWIG_RegisterMapping("_wxListBox","_class_wxListBox",0); + SWIG_RegisterMapping("_wxScreenDC","_class_wxScreenDC",0); + SWIG_RegisterMapping("_class_wxMDIChildFrame","_wxMDIChildFrame",0); + SWIG_RegisterMapping("_WXTYPE","_short",0); + SWIG_RegisterMapping("_WXTYPE","_signed_short",0); + SWIG_RegisterMapping("_WXTYPE","_unsigned_short",0); + SWIG_RegisterMapping("_wxFileDialog","_class_wxFileDialog",0); + SWIG_RegisterMapping("_class_wxMDIClientWindow","_wxMDIClientWindow",0); + SWIG_RegisterMapping("_class_wxBrush","_wxBrush",0); + SWIG_RegisterMapping("_unsigned_short","_WXTYPE",0); + SWIG_RegisterMapping("_unsigned_short","_short",0); + SWIG_RegisterMapping("_class_wxWindow","_wxWindow",0); + SWIG_RegisterMapping("_class_wxStaticText","_wxStaticText",0); + SWIG_RegisterMapping("_class_wxFont","_wxFont",0); + SWIG_RegisterMapping("_class_wxCloseEvent","_wxCloseEvent",0); + SWIG_RegisterMapping("_wxTreeItem","_class_wxTreeItem",0); + SWIG_RegisterMapping("_class_wxMenuEvent","_wxMenuEvent",0); + SWIG_RegisterMapping("_wxClientDC","_class_wxClientDC",0); + SWIG_RegisterMapping("_wxMouseEvent","_class_wxMouseEvent",0); + SWIG_RegisterMapping("_wxListCtrl","_class_wxListCtrl",0); + SWIG_RegisterMapping("_wxSingleChoiceDialog","_class_wxSingleChoiceDialog",0); + SWIG_RegisterMapping("_class_wxPoint","_wxPoint",0); + SWIG_RegisterMapping("_wxRealPoint","_class_wxRealPoint",0); + SWIG_RegisterMapping("_class_wxRadioBox","_wxRadioBox",0); + SWIG_RegisterMapping("_wxGridCell","_class_wxGridCell",0); + SWIG_RegisterMapping("_signed_short","_WXTYPE",0); + SWIG_RegisterMapping("_signed_short","_short",0); + SWIG_RegisterMapping("_wxMemoryDC","_class_wxMemoryDC",0); + SWIG_RegisterMapping("_class_wxPrintDialog","_wxPrintDialog",0); + SWIG_RegisterMapping("_wxPaintDC","_class_wxPaintDC",0); + SWIG_RegisterMapping("_class_wxFocusEvent","_wxFocusEvent",0); + SWIG_RegisterMapping("_class_wxMaximizeEvent","_wxMaximizeEvent",0); + SWIG_RegisterMapping("_class_wxAcceleratorEntry","_wxAcceleratorEntry",0); + SWIG_RegisterMapping("_class_wxCursor","_wxCursor",0); + SWIG_RegisterMapping("_wxPostScriptDC","_class_wxPostScriptDC",0); + SWIG_RegisterMapping("_wxScrolledWindow","_class_wxScrolledWindow",0); + SWIG_RegisterMapping("_unsigned_char","_byte",0); + SWIG_RegisterMapping("_class_wxMetaFileDC","_wxMetaFileDC",0); + SWIG_RegisterMapping("_class_wxMenu","_wxMenu",0); + SWIG_RegisterMapping("_wxControl","_class_wxControl",0); + SWIG_RegisterMapping("_class_wxListBox","_wxListBox",0); + SWIG_RegisterMapping("_wxTabCtrl","_class_wxTabCtrl",0); + SWIG_RegisterMapping("_unsigned_int","_uint",0); + SWIG_RegisterMapping("_unsigned_int","_wxWindowID",0); + SWIG_RegisterMapping("_unsigned_int","_int",0); + SWIG_RegisterMapping("_wxIcon","_class_wxIcon",0); + SWIG_RegisterMapping("_wxDialog","_class_wxDialog",0); + SWIG_RegisterMapping("_class_wxPyMenu","_wxPyMenu",0); + SWIG_RegisterMapping("_class_wxListItem","_wxListItem",0); + SWIG_RegisterMapping("_class_wxPen","_wxPen",0); + SWIG_RegisterMapping("_class_wxFileDialog","_wxFileDialog",0); + SWIG_RegisterMapping("_short","_WXTYPE",0); + SWIG_RegisterMapping("_short","_unsigned_short",0); + SWIG_RegisterMapping("_short","_signed_short",0); + SWIG_RegisterMapping("_class_wxStaticBox","_wxStaticBox",0); + SWIG_RegisterMapping("_class_wxScrollEvent","_wxScrollEvent",0); + SWIG_RegisterMapping("_wxJoystickEvent","_class_wxJoystickEvent",0); + SWIG_RegisterMapping("_class_wxChoice","_wxChoice",0); + SWIG_RegisterMapping("_class_wxSlider","_wxSlider",0); + SWIG_RegisterMapping("_class_wxBitmapButton","_wxBitmapButton",0); + SWIG_RegisterMapping("_wxTabEvent","_class_wxTabEvent",0); + SWIG_RegisterMapping("_wxFrame","_class_wxFrame",0); + SWIG_RegisterMapping("_class_wxNotebook","_wxNotebook",0); + SWIG_RegisterMapping("_wxWindowID","_EBool",0); + SWIG_RegisterMapping("_wxWindowID","_uint",0); + SWIG_RegisterMapping("_wxWindowID","_int",0); + SWIG_RegisterMapping("_wxWindowID","_signed_int",0); + SWIG_RegisterMapping("_wxWindowID","_unsigned_int",0); + SWIG_RegisterMapping("_int","_EBool",0); + SWIG_RegisterMapping("_int","_uint",0); + SWIG_RegisterMapping("_int","_wxWindowID",0); + SWIG_RegisterMapping("_int","_unsigned_int",0); + SWIG_RegisterMapping("_int","_signed_int",0); + SWIG_RegisterMapping("_class_wxMouseEvent","_wxMouseEvent",0); + SWIG_RegisterMapping("_class_wxListEvent","_wxListEvent",0); + SWIG_RegisterMapping("_wxButton","_class_wxButton",0); + SWIG_RegisterMapping("_class_wxPyApp","_wxPyApp",0); + SWIG_RegisterMapping("_wxSize","_class_wxSize",0); + SWIG_RegisterMapping("_class_wxPrinterDC","_wxPrinterDC",0); + SWIG_RegisterMapping("_class_wxMDIParentFrame","_wxMDIParentFrame",0); + SWIG_RegisterMapping("_class_wxPaintDC","_wxPaintDC",0); + SWIG_RegisterMapping("_class_wxSysColourChangedEvent","_wxSysColourChangedEvent",0); + SWIG_RegisterMapping("_class_wxInitDialogEvent","_wxInitDialogEvent",0); + SWIG_RegisterMapping("_class_wxComboBox","_wxComboBox",0); + SWIG_RegisterMapping("_class_wxRadioButton","_wxRadioButton",0); + SWIG_RegisterMapping("_wxTreeCtrl","_class_wxTreeCtrl",0); + SWIG_RegisterMapping("_class_wxLayoutConstraints","_wxLayoutConstraints",0); + SWIG_RegisterMapping("_wxIconizeEvent","_class_wxIconizeEvent",0); + SWIG_RegisterMapping("_class_wxControl","_wxControl",0); + SWIG_RegisterMapping("_wxStaticBitmap","_class_wxStaticBitmap",0); + SWIG_RegisterMapping("_class_wxTabCtrl","_wxTabCtrl",0); + SWIG_RegisterMapping("_class_wxIcon","_wxIcon",0); + SWIG_RegisterMapping("_class_wxColour","_wxColour",0); + SWIG_RegisterMapping("_class_wxScreenDC","_wxScreenDC",0); + SWIG_RegisterMapping("_class_wxPageSetupDialog","_wxPageSetupDialog",0); + SWIG_RegisterMapping("_class_wxIdleEvent","_wxIdleEvent",0); + SWIG_RegisterMapping("_wxEraseEvent","_class_wxEraseEvent",0); + SWIG_RegisterMapping("_class_wxMiniFrame","_wxMiniFrame",0); + SWIG_RegisterMapping("_class_wxJoystickEvent","_wxJoystickEvent",0); + SWIG_RegisterMapping("_wxFontDialog","_class_wxFontDialog",0); + SWIG_RegisterMapping("_class_wxShowEvent","_wxShowEvent",0); + SWIG_RegisterMapping("_wxActivateEvent","_class_wxActivateEvent",0); + SWIG_RegisterMapping("_wxGauge","_class_wxGauge",0); + SWIG_RegisterMapping("_class_wxTreeItem","_wxTreeItem",0); + SWIG_RegisterMapping("_class_wxCommandEvent","_wxCommandEvent",0); + SWIG_RegisterMapping("_class_wxClientDC","_wxClientDC",0); + SWIG_RegisterMapping("_class_wxSizeEvent","_wxSizeEvent",0); + SWIG_RegisterMapping("_class_wxListCtrl","_wxListCtrl",0); + SWIG_RegisterMapping("_class_wxGridCell","_wxGridCell",0); + SWIG_RegisterMapping("_class_wxSize","_wxSize",0); + SWIG_RegisterMapping("_class_wxBitmap","_wxBitmap",0); + SWIG_RegisterMapping("_class_wxMemoryDC","_wxMemoryDC",0); + SWIG_RegisterMapping("_wxMenuBar","_class_wxMenuBar",0); + SWIG_RegisterMapping("_wxTreeEvent","_class_wxTreeEvent",0); + SWIG_RegisterMapping("_wxDirDialog","_class_wxDirDialog",0); + SWIG_RegisterMapping("_wxEvtHandler","_class_wxPyApp",SwigwxPyAppTowxEvtHandler); + SWIG_RegisterMapping("_wxEvtHandler","_wxPyApp",SwigwxPyAppTowxEvtHandler); + SWIG_RegisterMapping("_wxEvtHandler","_class_wxEvtHandler",0); + SWIG_RegisterMapping("_wxMenuItem","_class_wxMenuItem",0); + SWIG_RegisterMapping("_class_wxScrollBar","_wxScrollBar",0); + SWIG_RegisterMapping("_class_wxColourDialog","_wxColourDialog",0); + SWIG_RegisterMapping("_class_wxPrintData","_wxPrintData",0); + SWIG_RegisterMapping("_wxDash","_unsigned_long",0); + SWIG_RegisterMapping("_wxDash","_long",0); + SWIG_RegisterMapping("_class_wxScrolledWindow","_wxScrolledWindow",0); + SWIG_RegisterMapping("_class_wxTextEntryDialog","_wxTextEntryDialog",0); + SWIG_RegisterMapping("_wxKeyEvent","_class_wxKeyEvent",0); + SWIG_RegisterMapping("_wxMoveEvent","_class_wxMoveEvent",0); + SWIG_RegisterMapping("_wxColourData","_class_wxColourData",0); + SWIG_RegisterMapping("_class_wxEraseEvent","_wxEraseEvent",0); + SWIG_RegisterMapping("_wxMDIClientWindow","_class_wxMDIClientWindow",0); + SWIG_RegisterMapping("_class_wxFontDialog","_wxFontDialog",0); + SWIG_RegisterMapping("_wxWindow","_class_wxWindow",0); + SWIG_RegisterMapping("_class_wxTabEvent","_wxTabEvent",0); + SWIG_RegisterMapping("_class_wxFrame","_wxFrame",0); +} diff --git a/utils/wxPython/tests/test1.py b/utils/wxPython/tests/test1.py index 90e68ee2de..16b35fdca8 100644 --- a/utils/wxPython/tests/test1.py +++ b/utils/wxPython/tests/test1.py @@ -12,9 +12,16 @@ #---------------------------------------------------------------------------- +<<<<<<< test1.py +<<<<<<< test1.py +#from wxPython import * +from wxpc import * +======= +======= ## import all of the wxPython GUI package +>>>>>>> 1.4 from wxPython.wx import * - +>>>>>>> 1.3 #--------------------------------------------------------------------------- @@ -54,7 +61,11 @@ class MyFrame(wxFrame): #--------------------------------------------------------------------------- + +<<<<<<< test1.py +======= # Every wxWindows application must have a class derived from wxApp +>>>>>>> 1.4 class MyApp(wxApp): # wxWindows calls this method to initialize the application @@ -72,12 +83,67 @@ class MyApp(wxApp): #--------------------------------------------------------------------------- +<<<<<<< test1.py + +def main(): + app = MyApp(0) + app.MainLoop() + + +def t(): + import pdb + pdb.run('main()') +======= +>>>>>>> 1.4 +<<<<<<< test1.py +if __name__ == '__main__': + main() +======= app = MyApp(0) # Create an instance of the application class app.MainLoop() # Tell it to start processing events +>>>>>>> 1.4 print 'done!' + #---------------------------------------------------------------------------- # +# $Log$ +# Revision 1.6 1999/06/28 21:39:48 VZ +# 1. wxStaticLine implemented (generic (ugly) and MSW versions) +# 2. wxTextDialog looks fine under MSW again +# 3. startup tips added: code, sample, docs +# 4. read-only text controls don't participate in TAB traversal +# +# Revision 1.3 1998/12/15 20:44:34 RD +# Changed the import semantics from "from wxPython import *" to "from +# wxPython.wx import *" This is for people who are worried about +# namespace pollution, they can use "from wxPython import wx" and then +# prefix all the wxPython identifiers with "wx." +# +# Added wxTaskbarIcon for wxMSW. +# +# Made the events work for wxGrid. +# +# Added wxConfig. +# +# Added wxMiniFrame for wxGTK, (untested.) +# +# Changed many of the args and return values that were pointers to gdi +# objects to references to reflect changes in the wxWindows API. +# +<<<<<<< test1.py +# Other assorted fixes and additions. +# +# Revision 1.2 1998/10/02 06:42:27 RD +# +# Version 0.4 of wxPython for MSW. +# +# Revision 1.1 1998/08/09 08:28:05 RD +# Initial version +# +# +======= +>>>>>>> 1.4 diff --git a/utils/wxprop/src/prop.cpp b/utils/wxprop/src/prop.cpp new file mode 100644 index 0000000000..59802962de --- /dev/null +++ b/utils/wxprop/src/prop.cpp @@ -0,0 +1,1119 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: prop.cpp +// Purpose: Propert sheet classes implementation +// Author: Julian Smart +// Modified by: +// Created: 04/01/98 +// RCS-ID: $Id$ +// Copyright: (c) Julian Smart +// Licence: wxWindows license +///////////////////////////////////////////////////////////////////////////// + +#ifdef __GNUG__ +#pragma implementation "prop.h" +#endif + +// For compilers that support precompilation, includes "wx/wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ +#pragma hdrstop +#endif + +#ifndef WX_PRECOMP +#include "wx/wx.h" +#endif + +#include +#include +#include +#include + +#if wxUSE_IOSTREAMH +#if defined(__WXMSW__) && !defined(__GNUWIN32__) +#include +#else +#include +#endif +#else +#include +#endif + +#include "wx/window.h" +#include "wx/utils.h" +#include "wx/list.h" +#include "prop.h" + +IMPLEMENT_DYNAMIC_CLASS(wxPropertyValue, wxObject) + +wxPropertyValue::wxPropertyValue(void) +{ + m_type = wxPropertyValueNull; + m_next = NULL; + m_last = NULL; + m_value.first = NULL; + m_clientData = NULL; + m_modifiedFlag = FALSE; +} + +wxPropertyValue::wxPropertyValue(const wxPropertyValue& copyFrom) +{ + m_modifiedFlag = FALSE; + Copy((wxPropertyValue& )copyFrom); +} + +wxPropertyValue::wxPropertyValue(const char *val) +{ + m_modifiedFlag = FALSE; + m_type = wxPropertyValueString; + + m_value.string = copystring(val); + m_clientData = NULL; + m_next = NULL; + m_last = NULL; +} + +wxPropertyValue::wxPropertyValue(const wxString& val) +{ + m_modifiedFlag = FALSE; + m_type = wxPropertyValueString; + + m_value.string = copystring((const char *)val); + m_clientData = NULL; + m_next = NULL; + m_last = NULL; +} + +wxPropertyValue::wxPropertyValue(long the_integer) +{ + m_modifiedFlag = FALSE; + m_type = wxPropertyValueInteger; + m_value.integer = the_integer; + m_clientData = NULL; + m_next = NULL; +} + +wxPropertyValue::wxPropertyValue(bool val) +{ + m_modifiedFlag = FALSE; + m_type = wxPropertyValuebool; + m_value.integer = val; + m_clientData = NULL; + m_next = NULL; +} + +wxPropertyValue::wxPropertyValue(float the_real) +{ + m_modifiedFlag = FALSE; + m_type = wxPropertyValueReal; + m_value.real = the_real; + m_clientData = NULL; + m_next = NULL; +} + +wxPropertyValue::wxPropertyValue(double the_real) +{ + m_modifiedFlag = FALSE; + m_type = wxPropertyValueReal; + m_value.real = (float)the_real; + m_clientData = NULL; + m_next = NULL; +} + +// Pointer versions: we have a pointer to the real C++ value. +wxPropertyValue::wxPropertyValue(char **val) +{ + m_modifiedFlag = FALSE; + m_type = wxPropertyValueStringPtr; + + m_value.stringPtr = val; + m_clientData = NULL; + m_next = NULL; + m_last = NULL; +} + +wxPropertyValue::wxPropertyValue(long *val) +{ + m_modifiedFlag = FALSE; + m_type = wxPropertyValueIntegerPtr; + m_value.integerPtr = val; + m_clientData = NULL; + m_next = NULL; +} + +wxPropertyValue::wxPropertyValue(bool *val) +{ + m_modifiedFlag = FALSE; + m_type = wxPropertyValueboolPtr; + m_value.boolPtr = val; + m_clientData = NULL; + m_next = NULL; +} + +wxPropertyValue::wxPropertyValue(float *val) +{ + m_modifiedFlag = FALSE; + m_type = wxPropertyValueRealPtr; + m_value.realPtr = val; + m_clientData = NULL; + m_next = NULL; +} + +wxPropertyValue::wxPropertyValue(wxList *the_list) +{ + m_modifiedFlag = FALSE; + m_type = wxPropertyValueList; + m_clientData = NULL; + m_last = NULL; + m_value.first = NULL; + + wxNode *node = the_list->First(); + while (node) + { + wxPropertyValue *expr = (wxPropertyValue *)node->Data(); + Append(expr); + node = node->Next(); + } + + delete the_list; +} + +wxPropertyValue::wxPropertyValue(wxStringList *the_list) +{ + m_modifiedFlag = FALSE; + m_type = wxPropertyValueList; + m_clientData = NULL; + m_last = NULL; + m_value.first = NULL; + + wxNode *node = the_list->First(); + while (node) + { + char *s = (char *)node->Data(); + Append(new wxPropertyValue(s)); + node = node->Next(); + } + delete the_list; +} + +wxPropertyValue::~wxPropertyValue(void) +{ + switch (m_type) + { + case wxPropertyValueInteger: + case wxPropertyValuebool: + case wxPropertyValueReal: + { + break; + } + case wxPropertyValueString: + { + delete[] m_value.string; + break; + } + case wxPropertyValueList: + { + wxPropertyValue *expr = m_value.first; + while (expr) + { + wxPropertyValue *expr1 = expr->m_next; + + delete expr; + expr = expr1; + } + break; + } + default: + case wxPropertyValueNull: break; + } +} + +void wxPropertyValue::Append(wxPropertyValue *expr) +{ + m_modifiedFlag = TRUE; + if (!m_value.first) + m_value.first = expr; + + if (m_last) + m_last->m_next = expr; + m_last = expr; +} + +void wxPropertyValue::Insert(wxPropertyValue *expr) +{ + m_modifiedFlag = TRUE; + expr->m_next = m_value.first; + m_value.first = expr; + + if (!m_last) + m_last = expr; +} + +// Delete from list +void wxPropertyValue::Delete(wxPropertyValue *node) +{ + wxPropertyValue *expr = GetFirst(); + + wxPropertyValue *previous = NULL; + while (expr && (expr != node)) + { + previous = expr; + expr = expr->GetNext(); + } + + if (expr) + { + if (previous) + previous->m_next = expr->m_next; + + // If node was the first in the list, + // make the list point to the NEXT one. + if (GetFirst() == expr) + { + m_value.first = expr->m_next; + } + + // If node was the last in the list, + // make the list 'last' pointer point to the PREVIOUS one. + if (GetLast() == expr) + { + if (previous) + m_last = previous; + else + m_last = NULL; + } + m_modifiedFlag = TRUE; + delete expr; + } + +} + +void wxPropertyValue::ClearList(void) +{ + wxPropertyValue *val = GetFirst(); + if (val) + m_modifiedFlag = TRUE; + + while (val) + { + wxPropertyValue *next = val->GetNext(); + delete val; + val = next; + } + m_value.first = NULL; + m_last = NULL; +} + +wxPropertyValue *wxPropertyValue::NewCopy(void) const +{ + switch (m_type) + { + case wxPropertyValueInteger: + return new wxPropertyValue(m_value.integer); + case wxPropertyValuebool: + return new wxPropertyValue((bool) (m_value.integer != 0)); + case wxPropertyValueReal: + return new wxPropertyValue(m_value.real); + case wxPropertyValueString: + return new wxPropertyValue(m_value.string); + case wxPropertyValueList: + { + wxPropertyValue *expr = m_value.first; + wxPropertyValue *new_list = new wxPropertyValue; + new_list->SetType(wxPropertyValueList); + while (expr) + { + wxPropertyValue *expr2 = expr->NewCopy(); + new_list->Append(expr2); + expr = expr->m_next; + } + return new_list; + } + case wxPropertyValueIntegerPtr: + return new wxPropertyValue(m_value.integerPtr); + case wxPropertyValueRealPtr: + return new wxPropertyValue(m_value.realPtr); + case wxPropertyValueboolPtr: + return new wxPropertyValue(m_value.boolPtr); + case wxPropertyValueStringPtr: + return new wxPropertyValue(m_value.stringPtr); + + case wxPropertyValueNull: +#ifdef __X__ + cerr << "Should never get here!\n"; +#endif + break; + } + return NULL; +} + +void wxPropertyValue::Copy(wxPropertyValue& copyFrom) +{ + m_type = copyFrom.Type(); + + switch (m_type) + { + case wxPropertyValueInteger: + (*this) = copyFrom.IntegerValue(); + return ; + + case wxPropertyValueReal: + (*this) = copyFrom.RealValue(); + return ; + + case wxPropertyValueString: + (*this) = wxString(copyFrom.StringValue()); + return ; + + case wxPropertyValuebool: + (*this) = copyFrom.BoolValue(); + return ; + + // Pointers + case wxPropertyValueboolPtr: + (*this) = copyFrom.BoolValuePtr(); + return ; + case wxPropertyValueRealPtr: + (*this) = copyFrom.RealValuePtr(); + return ; + case wxPropertyValueIntegerPtr: + (*this) = copyFrom.IntegerValuePtr(); + return ; + case wxPropertyValueStringPtr: + { + char** s = copyFrom.StringValuePtr(); + (*this) = s != 0; + return ; + } + + case wxPropertyValueList: + { + m_value.first = NULL; + m_next = NULL; + m_last = NULL; + wxPropertyValue *expr = copyFrom.m_value.first; + while (expr) + { + wxPropertyValue *expr2 = expr->NewCopy(); + Append(expr2); + expr = expr->m_next; + } + return; + } + case wxPropertyValueNull: +#ifdef __X__ + cerr << "Should never get here!\n"; +#endif + break; + } +} + +// Return nth argument of a clause (starting from 1) +wxPropertyValue *wxPropertyValue::Arg(wxPropertyValueType type, int arg) const +{ + wxPropertyValue *expr = m_value.first; + for (int i = 1; i < arg; i++) + if (expr) + expr = expr->m_next; + + if (expr && (expr->m_type == type)) + return expr; + else + return NULL; +} + +// Return nth argument of a list expression (starting from zero) +wxPropertyValue *wxPropertyValue::Nth(int arg) const +{ + if (m_type != wxPropertyValueList) + return NULL; + + wxPropertyValue *expr = m_value.first; + for (int i = 0; i < arg; i++) + if (expr) + expr = expr->m_next; + else return NULL; + + if (expr) + return expr; + else + return NULL; +} + + // Returns the number of elements in a list expression +int wxPropertyValue::Number(void) const +{ + if (m_type != wxPropertyValueList) + return 0; + + int i = 0; + wxPropertyValue *expr = m_value.first; + while (expr) + { + expr = expr->m_next; + i ++; + } + return i; +} + +void wxPropertyValue::WritePropertyClause(ostream& stream) // Write this expression as a top-level clause +{ + if (m_type != wxPropertyValueList) + return; + + wxPropertyValue *node = m_value.first; + if (node) + { + node->WritePropertyType(stream); + stream << "("; + node = node->m_next; + bool first = TRUE; + while (node) + { + if (!first) + stream << " "; + node->WritePropertyType(stream); + node = node->m_next; + if (node) stream << ",\n"; + first = FALSE; + } + stream << ").\n\n"; + } +} + +void wxPropertyValue::WritePropertyType(ostream& stream) // Write as any other subexpression +{ + switch (m_type) + { + case wxPropertyValueInteger: + { + stream << m_value.integer; + break; + } + case wxPropertyValueIntegerPtr: + { + stream << *m_value.integerPtr; + break; + } + case wxPropertyValuebool: + { + if (m_value.integer) + stream << "True"; + else + stream << "False"; + break; + } + case wxPropertyValueboolPtr: + { + if (*m_value.integerPtr) + stream << "True"; + else + stream << "False"; + break; + } + case wxPropertyValueReal: + { + float f = m_value.real; + sprintf(wxBuffer, "%.6g", (double)f); + stream << wxBuffer; + break; + } + case wxPropertyValueRealPtr: + { + float f = *m_value.realPtr; +/* Now the parser can cope with this. + // Prevent printing in 'e' notation. Any better way? + if (fabs(f) < 0.00001) + f = 0.0; +*/ + sprintf(wxBuffer, "%.6g", f); + stream << wxBuffer; + break; + } + case wxPropertyValueString: + { +// stream << "\""; + int i; + int len = strlen(m_value.string); + for (i = 0; i < len; i++) + { + char ch = m_value.string[i]; +// if (ch == '"' || ch == '\\') +// stream << "\\"; + stream << ch; + } + +// stream << "\""; + break; + } + case wxPropertyValueStringPtr: + { + int i; + int len = strlen(*(m_value.stringPtr)); + for (i = 0; i < len; i++) + { + char ch = *(m_value.stringPtr)[i]; + + } + break; + } + case wxPropertyValueList: + { + if (!m_value.first) + stream << "[]"; + else + { + wxPropertyValue *expr = m_value.first; + + stream << "["; + while (expr) + { + expr->WritePropertyType(stream); + expr = expr->m_next; + if (expr) stream << ", "; + } + stream << "]"; + } + break; + } + case wxPropertyValueNull: break; + } +} + +wxString wxPropertyValue::GetStringRepresentation(void) +{ + char buf[500]; + buf[0] = 0; + + ostrstream str((char *)buf, (int)500, ios::out); + WritePropertyType(str); + str << '\0'; + str.flush(); + + wxString theString(buf); + return theString; +} + +void wxPropertyValue::operator=(const wxPropertyValue& val) +{ + m_modifiedFlag = TRUE; + Copy((wxPropertyValue&)val); +} + +// void wxPropertyValue::operator=(const char *val) +void wxPropertyValue::operator=(const wxString& val1) +{ + const char *val = (const char *)val1; + + m_modifiedFlag = TRUE; + if (m_type == wxPropertyValueNull) + m_type = wxPropertyValueString; + + if (m_type == wxPropertyValueString) + { + if (val) + m_value.string = copystring(val); + else + m_value.string = NULL; + } + else if (m_type == wxPropertyValueStringPtr) + { + if (*m_value.stringPtr) + delete[] *m_value.stringPtr; + if (val) + *m_value.stringPtr = copystring(val); + else + *m_value.stringPtr = NULL; + } + + m_clientData = NULL; + m_next = NULL; + m_last = NULL; + +} + +void wxPropertyValue::operator=(const long val) +{ + m_modifiedFlag = TRUE; + if (m_type == wxPropertyValueNull) + m_type = wxPropertyValueInteger; + + if (m_type == wxPropertyValueInteger) + m_value.integer = val; + else if (m_type == wxPropertyValueIntegerPtr) + *m_value.integerPtr = val; + else if (m_type == wxPropertyValueReal) + m_value.real = (float)val; + else if (m_type == wxPropertyValueRealPtr) + *m_value.realPtr = (float)val; + + m_clientData = NULL; + m_next = NULL; +} + +void wxPropertyValue::operator=(const bool val) +{ + m_modifiedFlag = TRUE; + if (m_type == wxPropertyValueNull) + m_type = wxPropertyValuebool; + + if (m_type == wxPropertyValuebool) + m_value.integer = (long)val; + else if (m_type == wxPropertyValueboolPtr) + *m_value.boolPtr = val; + + m_clientData = NULL; + m_next = NULL; +} + +void wxPropertyValue::operator=(const float val) +{ + m_modifiedFlag = TRUE; + if (m_type == wxPropertyValueNull) + m_type = wxPropertyValueReal; + + if (m_type == wxPropertyValueInteger) + m_value.integer = (long)val; + else if (m_type == wxPropertyValueIntegerPtr) + *m_value.integerPtr = (long)val; + else if (m_type == wxPropertyValueReal) + m_value.real = val; + else if (m_type == wxPropertyValueRealPtr) + *m_value.realPtr = val; + + m_clientData = NULL; + m_next = NULL; +} + +void wxPropertyValue::operator=(const char **val) +{ + m_modifiedFlag = TRUE; + m_type = wxPropertyValueStringPtr; + + if (val) + m_value.stringPtr = (char **)val; + else + m_value.stringPtr = NULL; + m_clientData = NULL; + m_next = NULL; + m_last = NULL; + +} + +void wxPropertyValue::operator=(const long *val) +{ + m_modifiedFlag = TRUE; + m_type = wxPropertyValueIntegerPtr; + m_value.integerPtr = (long *)val; + m_clientData = NULL; + m_next = NULL; +} + +void wxPropertyValue::operator=(const bool *val) +{ + m_modifiedFlag = TRUE; + m_type = wxPropertyValueboolPtr; + m_value.boolPtr = (bool *)val; + m_clientData = NULL; + m_next = NULL; +} + +void wxPropertyValue::operator=(const float *val) +{ + m_modifiedFlag = TRUE; + m_type = wxPropertyValueRealPtr; + m_value.realPtr = (float *)val; + m_clientData = NULL; + m_next = NULL; +} + +long wxPropertyValue::IntegerValue(void) const + { + if (m_type == wxPropertyValueInteger) + return m_value.integer; + else if (m_type == wxPropertyValueReal) + return (long)m_value.real; + else if (m_type == wxPropertyValueIntegerPtr) + return *m_value.integerPtr; + else if (m_type == wxPropertyValueRealPtr) + return (long)(*m_value.realPtr); + else return 0; + } + +long *wxPropertyValue::IntegerValuePtr(void) const +{ + return m_value.integerPtr; +} + +float wxPropertyValue::RealValue(void) const { + if (m_type == wxPropertyValueReal) + return m_value.real; + else if (m_type == wxPropertyValueRealPtr) + return *m_value.realPtr; + else if (m_type == wxPropertyValueInteger) + return (float)m_value.integer; + else if (m_type == wxPropertyValueIntegerPtr) + return (float)*(m_value.integerPtr); + else return 0.0; + } + +float *wxPropertyValue::RealValuePtr(void) const +{ + return m_value.realPtr; +} + +bool wxPropertyValue::BoolValue(void) const { + if (m_type == wxPropertyValueReal) + return (m_value.real != 0.0); + if (m_type == wxPropertyValueRealPtr) + return (*(m_value.realPtr) != 0.0); + else if (m_type == wxPropertyValueInteger) + return (m_value.integer != 0); + else if (m_type == wxPropertyValueIntegerPtr) + return (*(m_value.integerPtr) != 0); + else if (m_type == wxPropertyValuebool) + return (m_value.integer != 0); + else if (m_type == wxPropertyValueboolPtr) + return (*(m_value.boolPtr) != 0); + else return FALSE; + } + +bool *wxPropertyValue::BoolValuePtr(void) const +{ + return m_value.boolPtr; +} + +char *wxPropertyValue::StringValue(void) const { + if (m_type == wxPropertyValueString) + return m_value.string; + else if (m_type == wxPropertyValueStringPtr) + return *(m_value.stringPtr); + else return NULL; + } + +char **wxPropertyValue::StringValuePtr(void) const +{ + return m_value.stringPtr; +} + +/* + * A property (name plus value) + */ + +IMPLEMENT_DYNAMIC_CLASS(wxProperty, wxObject) + +wxProperty::wxProperty(void) +{ + m_propertyRole = (char *)NULL; + m_propertyValidator = NULL; + m_propertyWindow = NULL; + m_enabled = TRUE; +} + +wxProperty::wxProperty(wxProperty& copyFrom) +{ + m_value = copyFrom.GetValue(); + m_name = copyFrom.GetName(); + m_propertyRole = copyFrom.GetRole(); + m_propertyValidator = copyFrom.GetValidator(); + m_enabled = copyFrom.IsEnabled(); + m_propertyWindow = NULL; +} + +wxProperty::wxProperty(wxString nm, wxString role, wxPropertyValidator *ed):m_name(nm), m_propertyRole(role) +{ + m_propertyValidator = ed; + m_propertyWindow = NULL; + m_enabled = TRUE; +} + +wxProperty::wxProperty(wxString nm, const wxPropertyValue& val, wxString role, wxPropertyValidator *ed): + m_name(nm), m_value(val), m_propertyRole(role) +{ + m_propertyValidator = ed; + m_propertyWindow = NULL; + m_enabled = TRUE; +} + +wxProperty::~wxProperty(void) +{ + if (m_propertyValidator) + delete m_propertyValidator; +} + +wxPropertyValue& wxProperty::GetValue(void) const +{ + return (wxPropertyValue&) m_value; +} + +wxPropertyValidator *wxProperty::GetValidator(void) const +{ + return m_propertyValidator; +} + +wxString& wxProperty::GetName(void) const +{ + return (wxString&) m_name; +} + +wxString& wxProperty::GetRole(void) const +{ + return (wxString&) m_propertyRole; +} + +void wxProperty::SetValue(const wxPropertyValue& val) +{ + m_value = val; +} + +void wxProperty::SetValidator(wxPropertyValidator *ed) +{ + m_propertyValidator = ed; +} + +void wxProperty::SetRole(wxString& role) +{ + m_propertyRole = role; +} + +void wxProperty::SetName(wxString& nm) +{ + m_name = nm; +} + +void wxProperty::operator=(const wxPropertyValue& val) +{ + m_value = val; +} + +/* + * Base property view class + */ + +IMPLEMENT_DYNAMIC_CLASS(wxPropertyView, wxEvtHandler) + +wxPropertyView::wxPropertyView(long flags) +{ + m_buttonFlags = flags; + m_propertySheet = NULL; + m_currentValidator = NULL; + m_currentProperty = NULL; +} + +wxPropertyView::~wxPropertyView(void) +{ +} + +void wxPropertyView::AddRegistry(wxPropertyValidatorRegistry *registry) +{ + m_validatorRegistryList.Append(registry); +} + +wxPropertyValidator *wxPropertyView::FindPropertyValidator(wxProperty *property) +{ + if (property->GetValidator()) + return property->GetValidator(); + + wxNode *node = m_validatorRegistryList.First(); + while (node) + { + wxPropertyValidatorRegistry *registry = (wxPropertyValidatorRegistry *)node->Data(); + wxPropertyValidator *validator = registry->GetValidator(property->GetRole()); + if (validator) + return validator; + node = node->Next(); + } + return NULL; +/* + if (!wxDefaultPropertyValidator) + wxDefaultPropertyValidator = new wxPropertyListValidator; + return wxDefaultPropertyValidator; +*/ +} + +/* + * Property sheet + */ + +IMPLEMENT_DYNAMIC_CLASS(wxPropertySheet, wxObject) + +wxPropertySheet::wxPropertySheet(void):m_properties(wxKEY_STRING) +{ +} + +wxPropertySheet::~wxPropertySheet(void) +{ + Clear(); +} + +bool wxPropertySheet::Save( ostream& WXUNUSED(str) ) +{ + return FALSE; +} + +bool wxPropertySheet::Load( ostream& WXUNUSED(str) ) +{ + return FALSE; +} + +void wxPropertySheet::UpdateAllViews( wxPropertyView *WXUNUSED(thisView) ) +{ +} + +// Add a property +void wxPropertySheet::AddProperty(wxProperty *property) +{ + m_properties.Append((const char*) property->GetName(), property); +} + +// Get property by name +wxProperty *wxPropertySheet::GetProperty(wxString name) +{ + wxNode *node = m_properties.Find((const char*) name); + if (!node) + return NULL; + else + return (wxProperty *)node->Data(); +} + +// Clear all properties +void wxPropertySheet::Clear(void) +{ + wxNode *node = m_properties.First(); + while (node) + { + wxProperty *prop = (wxProperty *)node->Data(); + wxNode *next = node->Next(); + delete prop; + delete node; + node = next; + } +} + +// Sets/clears the modified flag for each property value +void wxPropertySheet::SetAllModified(bool flag) +{ + wxNode *node = m_properties.First(); + while (node) + { + wxProperty *prop = (wxProperty *)node->Data(); + prop->GetValue().SetModified(flag); + node = node->Next(); + } +} + +/* + * Property validator registry + * + */ + +IMPLEMENT_DYNAMIC_CLASS(wxPropertyValidatorRegistry, wxHashTable) + +wxPropertyValidatorRegistry::wxPropertyValidatorRegistry(void):wxHashTable(wxKEY_STRING) +{ +} + +wxPropertyValidatorRegistry::~wxPropertyValidatorRegistry(void) +{ + ClearRegistry(); +} + +void wxPropertyValidatorRegistry::RegisterValidator(const wxString& typeName, wxPropertyValidator *validator) +{ + Put((const char*) typeName, validator); +} + +wxPropertyValidator *wxPropertyValidatorRegistry::GetValidator(const wxString& typeName) +{ + return (wxPropertyValidator *)Get((const char*) typeName); +} + +void wxPropertyValidatorRegistry::ClearRegistry(void) +{ + BeginFind(); + wxNode *node; + while (node = Next()) + { + delete (wxPropertyValidator *)node->Data(); + } +} + + /* + * Property validator + */ + + +IMPLEMENT_ABSTRACT_CLASS(wxPropertyValidator, wxEvtHandler) + +wxPropertyValidator::wxPropertyValidator(long flags) +{ + m_validatorFlags = flags; + m_validatorProperty = NULL; +} + +wxPropertyValidator::~wxPropertyValidator(void) +{} + +bool wxPropertyValidator::StringToFloat (char *s, float *number) { + double num; + bool ok = StringToDouble (s, &num); + *number = (float) num; + return ok; +} + +bool wxPropertyValidator::StringToDouble (char *s, double *number) { + bool ok = TRUE; + char *value_ptr; + *number = strtod (s, &value_ptr); + if (value_ptr) { + int len = strlen (value_ptr); + for (int i = 0; i < len; i++) { + ok = (isspace (value_ptr[i]) != 0); + if (!ok) return FALSE; + } + } + return ok; +} + +bool wxPropertyValidator::StringToInt (char *s, int *number) { + long num; + bool ok = StringToLong (s, &num); + *number = (int) num; + return ok; +} + +bool wxPropertyValidator::StringToLong (char *s, long *number) { + bool ok = TRUE; + char *value_ptr; + *number = strtol (s, &value_ptr, 10); + if (value_ptr) { + int len = strlen (value_ptr); + for (int i = 0; i < len; i++) { + ok = (isspace (value_ptr[i]) != 0); + if (!ok) return FALSE; + } + } + return ok; +} + +char *wxPropertyValidator::FloatToString (float number) { + static char buf[20]; + sprintf (buf, "%.6g", number); + return buf; +} + +char *wxPropertyValidator::DoubleToString (double number) { + static char buf[20]; + sprintf (buf, "%.6g", number); + return buf; +} + +char *wxPropertyValidator::IntToString (int number) { + return ::IntToString (number); +} + +char *wxPropertyValidator::LongToString (long number) { + return ::LongToString (number); + } + + -- 2.45.2