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
This commit is contained in:
Vadim Zeitlin
1999-06-28 21:39:49 +00:00
parent b6bff3019e
commit c50f1fb922
61 changed files with 5596 additions and 1092 deletions

View File

@@ -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 parameter, or (in MS Windows or Motif) the wrong window frame may be brought to
the front when the dialog box is popped up. 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}
<wx/tipdlg.h>
\membersection{::wxFileSelector}\label{wxfileselector} \membersection{::wxFileSelector}\label{wxfileselector}
\func{wxString}{wxFileSelector}{\param{const wxString\& }{message}, \param{const wxString\& }{default\_path = ""},\\ \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.
<wx/msgdlg.h> <wx/msgdlg.h>
\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}
<wx/tipdlg.h>
\section{GDI functions}\label{gdifunctions} \section{GDI functions}\label{gdifunctions}
The following are relevant to the GDI (Graphics Device Interface). The following are relevant to the GDI (Graphics Device Interface).

View File

@@ -19,10 +19,14 @@ streambuf\\
\twocolwidtha{5cm} \twocolwidtha{5cm}
\begin{twocollist}\itemsep=0pt \begin{twocollist}\itemsep=0pt
\twocolitem{\windowstyle{wxTE\_PROCESS\_ENTER}}{The callback function will \twocolitem{\windowstyle{wxTE\_PROCESS\_ENTER}}{The control will generate
receive the message wxEVENT\_TYPE\_TEXT\_ENTER\_COMMAND. Note the message wxEVENT\_TYPE\_TEXT\_ENTER\_COMMAND (otherwise pressing <Enter> is
that this will break tab traversal for this panel item under either processed internally by the control or used for navigation between
Windows.} 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\_MULTILINE}}{The text control allows multiple lines.}
\twocolitem{\windowstyle{wxTE\_PASSWORD}}{The text will be echoed as asterisks.} \twocolitem{\windowstyle{wxTE\_PASSWORD}}{The text will be echoed as asterisks.}
\twocolitem{\windowstyle{wxTE\_READONLY}}{The text will not be user-editable.} \twocolitem{\windowstyle{wxTE\_READONLY}}{The text will not be user-editable.}

52
docs/latex/wx/tipprov.tex Normal file
View File

@@ -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}
<wx/tipdlg.h>
\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.

View File

@@ -42,3 +42,4 @@ This chapter contains a selection of topic overviews.
\input ti18n.tex \input ti18n.tex
\input tstream.tex \input tstream.tex
\input tusage.tex \input tusage.tex
\input ttips.tex

42
docs/latex/wx/ttips.tex Normal file
View File

@@ -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.

View File

@@ -1,18 +1,59 @@
#ifndef _WX_DIALOG_H_BASE_ #ifndef _WX_DIALOG_H_BASE_
#define _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__) #if defined(__WXMSW__)
#include "wx/msw/dialog.h" #include "wx/msw/dialog.h"
#elif defined(__WXMOTIF__) #elif defined(__WXMOTIF__)
#include "wx/motif/dialog.h" #include "wx/motif/dialog.h"
#elif defined(__WXGTK__) #elif defined(__WXGTK__)
#include "wx/gtk/dialog.h" #include "wx/gtk/dialog.h"
#elif defined(__WXQT__) #elif defined(__WXQT__)
#include "wx/qt/dialog.h" #include "wx/qt/dialog.h"
#elif defined(__WXMAC__) #elif defined(__WXMAC__)
#include "wx/mac/dialog.h" #include "wx/mac/dialog.h"
#elif defined(__WXSTUBS__) #elif defined(__WXSTUBS__)
#include "wx/stubs/dialog.h" #include "wx/stubs/dialog.h"
#endif #endif
#endif #endif

View File

@@ -6,7 +6,7 @@
// Created: 01/02/97 // Created: 01/02/97
// RCS-ID: $Id$ // RCS-ID: $Id$
// Copyright: (c) // Copyright: (c)
// Licence: wxWindows licence // Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
#ifndef __CHOICEDLGH_G__ #ifndef __CHOICEDLGH_G__
@@ -79,7 +79,6 @@ public:
void OnListBoxDClick(wxCommandEvent& event); void OnListBoxDClick(wxCommandEvent& event);
protected: protected:
long m_dialogStyle;
int m_selection; int m_selection;
wxString m_stringSelection; wxString m_stringSelection;
void *m_clientData; void *m_clientData;

View File

@@ -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_

View File

@@ -6,46 +6,58 @@
// Created: 01/02/97 // Created: 01/02/97
// RCS-ID: $Id$ // RCS-ID: $Id$
// Copyright: (c) Julian Smart and Markus Holzem // Copyright: (c) Julian Smart and Markus Holzem
// Licence: wxWindows license // Licence: wxWindows license
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
#ifndef __TEXTDLGH_G__ #ifndef __TEXTDLGH_G__
#define __TEXTDLGH_G__ #define __TEXTDLGH_G__
#ifdef __GNUG__ #ifdef __GNUG__
#pragma interface "textdlgg.h" #pragma interface "textdlgg.h"
#endif #endif
#include "wx/setup.h" #include "wx/defs.h"
#include "wx/dialog.h" #include "wx/dialog.h"
// Handy dialog functions (will be converted into classes at some point) // Handy dialog functions (will be converted into classes at some point)
WXDLLEXPORT_DATA(extern const wxChar*) wxGetTextFromUserPromptStr; WXDLLEXPORT_DATA(extern const wxChar*) wxGetTextFromUserPromptStr;
WXDLLEXPORT_DATA(extern const wxChar*) wxEmptyString; WXDLLEXPORT_DATA(extern const wxChar*) wxEmptyString;
#define wxID_TEXT 3000 class WXDLLEXPORT wxTextEntryDialog : public wxDialog
class WXDLLEXPORT wxTextEntryDialog: public wxDialog
{ {
DECLARE_DYNAMIC_CLASS(wxTextEntryDialog) DECLARE_DYNAMIC_CLASS(wxTextEntryDialog)
protected:
long m_dialogStyle;
wxString m_value;
public: public:
wxTextEntryDialog(wxWindow *parent, const wxString& message, const wxString& caption = wxGetTextFromUserPromptStr, wxTextEntryDialog(wxWindow *parent,
const wxString& value = wxEmptyString, long style = wxOK|wxCANCEL|wxCENTRE, const wxPoint& pos = wxDefaultPosition); 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; } void SetValue(const wxString& val) { m_value = val; }
inline wxString GetValue(void) const { return m_value; } wxString GetValue() const { return m_value; }
// implementation only
void OnOK(wxCommandEvent& event); 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, wxString WXDLLEXPORT
const wxString& default_value = wxEmptyString, wxWindow *parent = (wxWindow *) NULL, wxGetTextFromUser(const wxString& message,
int x = -1, int y = -1, bool centre = TRUE); const wxString& caption = wxGetTextFromUserPromptStr,
const wxString& default_value = wxEmptyString,
wxWindow *parent = (wxWindow *) NULL,
int x = -1,
int y = -1,
bool centre = TRUE);
#endif #endif
// __TEXTDLGH_G__ // __TEXTDLGH_G__

View File

@@ -35,7 +35,7 @@ extern const wxChar *wxDialogNameStr;
// wxDialog // wxDialog
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
class wxDialog: public wxPanel class wxDialog: public wxDialogBase
{ {
DECLARE_DYNAMIC_CLASS(wxDialog) DECLARE_DYNAMIC_CLASS(wxDialog)

View File

@@ -4,7 +4,7 @@
// Author: Robert Roebling // Author: Robert Roebling
// Id: $Id$ // Id: $Id$
// Copyright: (c) 1998 Robert Roebling // Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence // Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
@@ -12,12 +12,12 @@
#define __GTKSTATICLINEH__ #define __GTKSTATICLINEH__
#ifdef __GNUG__ #ifdef __GNUG__
#pragma interface #pragma interface
#endif #endif
#include "wx/defs.h" #if !wxUSE_STATLINE
#error "This file should only be included if wxUSE_STATLINE == 1"
#if wxUSE_STATLINE #endif
#include "wx/object.h" #include "wx/object.h"
#include "wx/list.h" #include "wx/list.h"
@@ -29,32 +29,24 @@
class wxStaticLine; class wxStaticLine;
//-----------------------------------------------------------------------------
// global data
//-----------------------------------------------------------------------------
extern const char *wxStaticTextNameStr;
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// wxStaticLine // wxStaticLine
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
class wxStaticLine: public wxControl class wxStaticLine : public wxStaticLineBase
{ {
DECLARE_DYNAMIC_CLASS(wxStaticLine) DECLARE_DYNAMIC_CLASS(wxStaticLine)
public: public:
wxStaticLine();
wxStaticLine(void);
wxStaticLine( wxWindow *parent, wxWindowID id, wxStaticLine( wxWindow *parent, wxWindowID id,
const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize,
long style = wxLI_HORIZONTAL, const wxString &name = wxStaticTextNameStr ); long style = wxLI_HORIZONTAL, const wxString &name = wxStaticTextNameStr );
bool Create( wxWindow *parent, wxWindowID id, bool Create( wxWindow *parent, wxWindowID id,
const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize,
long style = wxLI_HORIZONTAL, const wxString &name = wxStaticTextNameStr ); long style = wxLI_HORIZONTAL, const wxString &name = wxStaticTextNameStr );
}; };
#endif #endif // wxUSE_STATLINE
#endif // __GTKSTATICLINEH__ #endif // __GTKSTATICLINEH__

View File

@@ -35,7 +35,7 @@ extern const wxChar *wxDialogNameStr;
// wxDialog // wxDialog
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
class wxDialog: public wxPanel class wxDialog: public wxDialogBase
{ {
DECLARE_DYNAMIC_CLASS(wxDialog) DECLARE_DYNAMIC_CLASS(wxDialog)

View File

@@ -4,7 +4,7 @@
// Author: Robert Roebling // Author: Robert Roebling
// Id: $Id$ // Id: $Id$
// Copyright: (c) 1998 Robert Roebling // Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence // Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
@@ -12,12 +12,12 @@
#define __GTKSTATICLINEH__ #define __GTKSTATICLINEH__
#ifdef __GNUG__ #ifdef __GNUG__
#pragma interface #pragma interface
#endif #endif
#include "wx/defs.h" #if !wxUSE_STATLINE
#error "This file should only be included if wxUSE_STATLINE == 1"
#if wxUSE_STATLINE #endif
#include "wx/object.h" #include "wx/object.h"
#include "wx/list.h" #include "wx/list.h"
@@ -29,32 +29,24 @@
class wxStaticLine; class wxStaticLine;
//-----------------------------------------------------------------------------
// global data
//-----------------------------------------------------------------------------
extern const char *wxStaticTextNameStr;
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// wxStaticLine // wxStaticLine
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
class wxStaticLine: public wxControl class wxStaticLine : public wxStaticLineBase
{ {
DECLARE_DYNAMIC_CLASS(wxStaticLine) DECLARE_DYNAMIC_CLASS(wxStaticLine)
public: public:
wxStaticLine();
wxStaticLine(void);
wxStaticLine( wxWindow *parent, wxWindowID id, wxStaticLine( wxWindow *parent, wxWindowID id,
const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize,
long style = wxLI_HORIZONTAL, const wxString &name = wxStaticTextNameStr ); long style = wxLI_HORIZONTAL, const wxString &name = wxStaticTextNameStr );
bool Create( wxWindow *parent, wxWindowID id, bool Create( wxWindow *parent, wxWindowID id,
const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize,
long style = wxLI_HORIZONTAL, const wxString &name = wxStaticTextNameStr ); long style = wxLI_HORIZONTAL, const wxString &name = wxStaticTextNameStr );
}; };
#endif #endif // wxUSE_STATLINE
#endif // __GTKSTATICLINEH__ #endif // __GTKSTATICLINEH__

View File

@@ -6,20 +6,24 @@
// Created: 31/7/98 // Created: 31/7/98
// RCS-ID: $Id$ // RCS-ID: $Id$
// Copyright: (c) Julian Smart // Copyright: (c) Julian Smart
// Licence: wxWindows licence // Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
#ifndef _WX_ACCEL_H_ #ifndef _WX_ACCEL_H_
#define _WX_ACCEL_H_ #define _WX_ACCEL_H_
#ifdef __GNUG__ #ifdef __GNUG__
#pragma interface "accel.h" #pragma interface "accel.h"
#endif #endif
#include "wx/object.h" #include "wx/object.h"
class WXDLLEXPORT wxAcceleratorTable; class WXDLLEXPORT wxAcceleratorTable;
// ----------------------------------------------------------------------------
// constants
// ----------------------------------------------------------------------------
// Hold Ctrl key down // Hold Ctrl key down
#define wxACCEL_ALT 0x01 #define wxACCEL_ALT 0x01
@@ -32,27 +36,38 @@ class WXDLLEXPORT wxAcceleratorTable;
// Hold no other key // Hold no other key
#define wxACCEL_NORMAL 0x00 #define wxACCEL_NORMAL 0x00
// ----------------------------------------------------------------------------
// an entry in wxAcceleratorTable corresponds to one accelerator
// ----------------------------------------------------------------------------
class WXDLLEXPORT wxAcceleratorEntry class WXDLLEXPORT wxAcceleratorEntry
{ {
public: public:
wxAcceleratorEntry(int flags = 0, int keyCode = 0, int cmd = 0) wxAcceleratorEntry(int flags = 0, int keyCode = 0, int cmd = 0)
{
Set(flags, keyCode, cmd);
}
void Set(int flags, int keyCode, int cmd)
{ {
m_flags = flags; m_keyCode = keyCode; m_command = cmd; m_flags = flags; m_keyCode = keyCode; m_command = cmd;
} }
inline void Set(int flags, int keyCode, int cmd) int GetFlags() const { return m_flags; }
{ m_flags = flags; m_keyCode = keyCode; m_command = cmd; } int GetKeyCode() const { return m_keyCode; }
int GetCommand() const { return m_command; }
inline int GetFlags() const { return m_flags; } //private:
inline int GetKeyCode() const { return m_keyCode; } int m_flags;
inline int GetCommand() const { return m_command; } int m_keyCode; // ASCII or virtual keycode
int m_command; // Command id to generate
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) DECLARE_DYNAMIC_CLASS(wxAcceleratorTable)
public: public:
@@ -61,18 +76,25 @@ public:
wxAcceleratorTable(int n, const wxAcceleratorEntry entries[]); // Load from array wxAcceleratorTable(int n, const wxAcceleratorEntry entries[]); // Load from array
// Copy constructors // Copy constructors
inline wxAcceleratorTable(const wxAcceleratorTable& accel) { Ref(accel); } wxAcceleratorTable(const wxAcceleratorTable& accel)
inline wxAcceleratorTable(const wxAcceleratorTable* accel) { if (accel) Ref(*accel); } { Ref(accel); }
~wxAcceleratorTable(); ~wxAcceleratorTable();
inline wxAcceleratorTable& operator = (const wxAcceleratorTable& accel) { if (*this == accel) return (*this); Ref(accel); return *this; } wxAcceleratorTable& operator = (const wxAcceleratorTable& accel)
inline bool operator == (const wxAcceleratorTable& accel) { return m_refData == accel.m_refData; } { if ( *this != accel ) Ref(accel); return *this; }
inline bool operator != (const wxAcceleratorTable& accel) { return m_refData != accel.m_refData; }
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); void SetHACCEL(WXHACCEL hAccel);
WXHACCEL GetHACCEL() const; WXHACCEL GetHACCEL() const;
// translate the accelerator, return TRUE if done
bool Translate(wxWindow *window, WXMSG *msg) const;
}; };
WXDLLEXPORT_DATA(extern wxAcceleratorTable) wxNullAcceleratorTable; WXDLLEXPORT_DATA(extern wxAcceleratorTable) wxNullAcceleratorTable;

View File

@@ -21,7 +21,7 @@
WXDLLEXPORT_DATA(extern const wxChar*) wxDialogNameStr; WXDLLEXPORT_DATA(extern const wxChar*) wxDialogNameStr;
// Dialog boxes // Dialog boxes
class WXDLLEXPORT wxDialog : public wxPanel class WXDLLEXPORT wxDialog : public wxDialogBase
{ {
DECLARE_DYNAMIC_CLASS(wxDialog) DECLARE_DYNAMIC_CLASS(wxDialog)

View File

@@ -207,20 +207,27 @@ extern LONG APIENTRY _EXPORT
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// macros to make casting between WXFOO and FOO a bit easier: the GetFoo() // 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 // returns Foo cast to the Windows type for oruselves, while GetFooOf() takes
// an argument which should be a pointer to wxFoo (is this really clear?) // 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 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 GetHdc() ((HDC)GetHDC())
#define GetHdcOf(dc) ((HDC)(dc).GetHDC())
#define GetHicon() ((HICON)GetHICON()) #define GetHicon() ((HICON)GetHICON())
#define GetIconHicon(icon) ((HICON)(icon).GetHICON()) #define GetHiconOf(icon) ((HICON)(icon).GetHICON())
#define GetHaccel() ((HACCEL)GetHACCEL()) #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 // global data

View File

@@ -86,6 +86,9 @@
#define wxUSE_SPINBTN 1 #define wxUSE_SPINBTN 1
// Define 1 to compile spin button // Define 1 to compile spin button
// use wxStaticLine class (separator line in the dialog)?
#define wxUSE_STATLINE 1
#define wxUSE_CHECKLISTBOX 1 #define wxUSE_CHECKLISTBOX 1
// Define 1 to compile check listbox // Define 1 to compile check listbox
@@ -104,6 +107,9 @@
#define wxUSE_WX_RESOURCES 1 #define wxUSE_WX_RESOURCES 1
// Use .wxr resource mechanism (requires PrologIO library) // 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 // BC++/Win16 can't cope with the amount of data in resource.cpp
#if defined(__WIN16__) && defined(__BORLANDC__) #if defined(__WIN16__) && defined(__BORLANDC__)
#undef wxUSE_WX_RESOURCES #undef wxUSE_WX_RESOURCES

50
include/wx/msw/statline.h Normal file
View File

@@ -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_

View File

@@ -182,6 +182,8 @@ public:
virtual void AdoptAttributesFromHWND(); virtual void AdoptAttributesFromHWND();
virtual void SetupColours(); virtual void SetupColours();
virtual bool AcceptsFocus() const;
protected: protected:
#if wxUSE_RICHEDIT #if wxUSE_RICHEDIT
bool m_isRich; // Are we using rich text edit to implement this? bool m_isRich; // Are we using rich text edit to implement this?

BIN
include/wx/msw/tip.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 766 B

View File

@@ -114,6 +114,7 @@ wxICON_QUESTION ICON "wx/msw/question.ico"
wxICON_WARNING ICON "wx/msw/warning.ico" wxICON_WARNING ICON "wx/msw/warning.ico"
wxICON_ERROR ICON "wx/msw/error.ico" wxICON_ERROR ICON "wx/msw/error.ico"
wxICON_INFO ICON "wx/msw/info.ico" wxICON_INFO ICON "wx/msw/info.ico"
wxICON_TIP ICON "wx/msw/tip.ico"
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// //

View File

@@ -1,19 +1,74 @@
#ifndef _WX_STATLINE_H_BASE_ #ifndef _WX_STATLINE_H_BASE_
#define _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__) #if defined(__WXMSW__)
#include "wx/msw/statline.h" #include "wx/msw/statline.h"
#elif defined(__WXMOTIF__)
#include "wx/motif/statline.h"
#elif defined(__WXGTK__) #elif defined(__WXGTK__)
#include "wx/gtk/statline.h" #include "wx/gtk/statline.h"
#elif defined(__WXQT__) #else // use generic implementation for all other platforms
#include "wx/qt/statline.h" #include "wx/generic/statline.h"
#elif defined(__WXMAC__)
#include "wx/mac/statline.h"
#elif defined(__WXSTUBS__)
#include "wx/stubs/statline.h"
#endif #endif
#endif // wxUSE_STATLINE
#endif #endif
// _WX_STATLINE_H_BASE_ // _WX_STATLINE_H_BASE_

View File

@@ -769,7 +769,6 @@ void MyPanel::OnShowProgress( wxCommandEvent& WXUNUSED(event) )
{ {
cont = dialog.Update(i); cont = dialog.Update(i);
} }
wxYield();
} }
if ( !cont ) if ( !cont )

View File

@@ -6,7 +6,7 @@
// Created: 04/01/98 // Created: 04/01/98
// RCS-ID: $Id$ // RCS-ID: $Id$
// Copyright: (c) Julian Smart and Markus Holzem // Copyright: (c) Julian Smart and Markus Holzem
// Licence: wxWindows license // Licence: wxWindows license
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__ #ifdef __GNUG__
@@ -30,6 +30,7 @@
#include <wx/dirdlg.h> #include <wx/dirdlg.h>
#include <wx/fontdlg.h> #include <wx/fontdlg.h>
#include <wx/choicdlg.h> #include <wx/choicdlg.h>
#include <wx/tipdlg.h>
#define wxTEST_GENERIC_DIALOGS_IN_MSW 0 #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_TEXT_ENTRY, "Text &entry");
file_menu->Append(DIALOGS_SINGLE_CHOICE, "&Single choice"); file_menu->Append(DIALOGS_SINGLE_CHOICE, "&Single choice");
file_menu->AppendSeparator(); 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_OPEN, "&Open file");
file_menu->Append(DIALOGS_FILE_SAVE, "Sa&ve file"); file_menu->Append(DIALOGS_FILE_SAVE, "Sa&ve file");
file_menu->Append(DIALOGS_DIR_CHOOSE, "&Choose a directory"); 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) ) 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", 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(); dialog.ShowModal();
::wxMessageBox("MsgBox with a really long long string",
"this is the text", wxYES_NO|wxICON_EXCLAMATION);
} }
void MyFrame::TextEntry(wxCommandEvent& WXUNUSED(event) ) void MyFrame::TextEntry(wxCommandEvent& WXUNUSED(event) )
{ {
wxTextEntryDialog dialog(this, "This is a small sample\nA long, long string to test out the text entrybox", 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) if (dialog.ShowModal() == wxID_OK)
{ {
wxMessageDialog dialog2(this, dialog.GetValue(), "Got string"); wxMessageDialog dialog2(this, dialog.GetValue(), "Got string");
dialog2.ShowModal(); dialog2.ShowModal();
} }
} }
@@ -229,10 +229,10 @@ void MyFrame::SingleChoice(wxCommandEvent& WXUNUSED(event) )
void MyFrame::FileOpen(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; wxString info;
info.Printf(_T("Full file name: %s\n") info.Printf(_T("Full file name: %s\n")
_T("Path: %s\n") _T("Path: %s\n")
@@ -240,45 +240,72 @@ void MyFrame::FileOpen(wxCommandEvent& WXUNUSED(event) )
dialog.GetPath().c_str(), dialog.GetPath().c_str(),
dialog.GetDirectory().c_str(), dialog.GetDirectory().c_str(),
dialog.GetFilename().c_str()); dialog.GetFilename().c_str());
wxMessageDialog dialog2(this, info, "Selected file"); wxMessageDialog dialog2(this, info, "Selected file");
dialog2.ShowModal(); dialog2.ShowModal();
} }
} }
void MyFrame::FileSave(wxCommandEvent& WXUNUSED(event) ) void MyFrame::FileSave(wxCommandEvent& WXUNUSED(event) )
{ {
wxFileDialog dialog(this, "Testing save file dialog", "", "", wxFileDialog dialog(this, "Testing save file dialog", "", "",
"Text files (*.txt)|*.txt|Document files (*.doc)|*.doc", "Text files (*.txt)|*.txt|Document files (*.doc)|*.doc",
wxSAVE|wxOVERWRITE_PROMPT); wxSAVE|wxOVERWRITE_PROMPT);
if (dialog.ShowModal() == wxID_OK) if (dialog.ShowModal() == wxID_OK)
{ {
wxChar buf[400]; wxChar buf[400];
wxSprintf(buf, _T("%s, filter %d"), (const wxChar*)dialog.GetPath(), dialog.GetFilterIndex()); wxSprintf(buf, _T("%s, filter %d"), (const wxChar*)dialog.GetPath(), dialog.GetFilterIndex());
wxMessageDialog dialog2(this, wxString(buf), "Selected path"); wxMessageDialog dialog2(this, wxString(buf), "Selected path");
dialog2.ShowModal(); dialog2.ShowModal();
} }
} }
void MyFrame::DirChoose(wxCommandEvent& WXUNUSED(event) ) void MyFrame::DirChoose(wxCommandEvent& WXUNUSED(event) )
{ {
wxDirDialog dialog(this, "Testing directory picker", ""); wxDirDialog dialog(this, "Testing directory picker", "");
if (dialog.ShowModal() == wxID_OK) if (dialog.ShowModal() == wxID_OK)
{ {
wxMessageDialog dialog2(this, dialog.GetPath(), "Selected path"); wxMessageDialog dialog2(this, dialog.GetPath(), "Selected path");
dialog2.ShowModal(); 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);
}
s_index = tipProvider->GetCurrentTip();
delete tipProvider;
} }
void MyFrame::OnExit(wxCommandEvent& WXUNUSED(event) ) void MyFrame::OnExit(wxCommandEvent& WXUNUSED(event) )
{ {
Close(TRUE); Close(TRUE);
} }
void MyCanvas::OnPaint(wxPaintEvent& WXUNUSED(event) ) void MyCanvas::OnPaint(wxPaintEvent& WXUNUSED(event) )
{ {
wxPaintDC dc(this); wxPaintDC dc(this);
dc.SetFont(wxGetApp().m_canvasFont); dc.SetFont(wxGetApp().m_canvasFont);
dc.SetTextForeground(wxGetApp().m_canvasTextColour); dc.SetTextForeground(wxGetApp().m_canvasTextColour);
dc.SetBackgroundMode(wxTRANSPARENT); dc.SetBackgroundMode(wxTRANSPARENT);
@@ -286,22 +313,23 @@ void MyCanvas::OnPaint(wxPaintEvent& WXUNUSED(event) )
} }
BEGIN_EVENT_TABLE(MyCanvas, wxScrolledWindow) BEGIN_EVENT_TABLE(MyCanvas, wxScrolledWindow)
EVT_PAINT(MyCanvas::OnPaint) EVT_PAINT(MyCanvas::OnPaint)
END_EVENT_TABLE() END_EVENT_TABLE()
BEGIN_EVENT_TABLE(MyFrame, wxFrame) BEGIN_EVENT_TABLE(MyFrame, wxFrame)
EVT_MENU(DIALOGS_CHOOSE_COLOUR, MyFrame::ChooseColour) EVT_MENU(DIALOGS_CHOOSE_COLOUR, MyFrame::ChooseColour)
EVT_MENU(DIALOGS_CHOOSE_FONT, MyFrame::ChooseFont) EVT_MENU(DIALOGS_CHOOSE_FONT, MyFrame::ChooseFont)
EVT_MENU(DIALOGS_MESSAGE_BOX, MyFrame::MessageBox) EVT_MENU(DIALOGS_MESSAGE_BOX, MyFrame::MessageBox)
EVT_MENU(DIALOGS_TEXT_ENTRY, MyFrame::TextEntry) EVT_MENU(DIALOGS_TEXT_ENTRY, MyFrame::TextEntry)
EVT_MENU(DIALOGS_SINGLE_CHOICE, MyFrame::SingleChoice) EVT_MENU(DIALOGS_SINGLE_CHOICE, MyFrame::SingleChoice)
EVT_MENU(DIALOGS_FILE_OPEN, MyFrame::FileOpen) EVT_MENU(DIALOGS_FILE_OPEN, MyFrame::FileOpen)
EVT_MENU(DIALOGS_FILE_SAVE, MyFrame::FileSave) EVT_MENU(DIALOGS_FILE_SAVE, MyFrame::FileSave)
EVT_MENU(DIALOGS_DIR_CHOOSE, MyFrame::DirChoose) EVT_MENU(DIALOGS_DIR_CHOOSE, MyFrame::DirChoose)
EVT_MENU(DIALOGS_TIP, MyFrame::ShowTip)
#if defined(__WXMSW__) && wxTEST_GENERIC_DIALOGS_IN_MSW #if defined(__WXMSW__) && wxTEST_GENERIC_DIALOGS_IN_MSW
EVT_MENU(DIALOGS_CHOOSE_COLOUR_GENERIC, MyFrame::ChooseColourGeneric) EVT_MENU(DIALOGS_CHOOSE_COLOUR_GENERIC, MyFrame::ChooseColourGeneric)
EVT_MENU(DIALOGS_CHOOSE_FONT_GENERIC, MyFrame::ChooseFontGeneric) EVT_MENU(DIALOGS_CHOOSE_FONT_GENERIC, MyFrame::ChooseFontGeneric)
#endif #endif
EVT_MENU(wxID_EXIT, MyFrame::OnExit) EVT_MENU(wxID_EXIT, MyFrame::OnExit)
END_EVENT_TABLE() END_EVENT_TABLE()

View File

@@ -35,6 +35,7 @@ class MyFrame: public wxFrame
void FileOpen(wxCommandEvent& event); void FileOpen(wxCommandEvent& event);
void FileSave(wxCommandEvent& event); void FileSave(wxCommandEvent& event);
void DirChoose(wxCommandEvent& event); void DirChoose(wxCommandEvent& event);
void ShowTip(wxCommandEvent& event);
#if !defined(__WXMSW__) || wxTEST_GENERIC_DIALOGS_IN_MSW #if !defined(__WXMSW__) || wxTEST_GENERIC_DIALOGS_IN_MSW
void ChooseColourGeneric(wxCommandEvent& event); void ChooseColourGeneric(wxCommandEvent& event);
@@ -67,6 +68,7 @@ DECLARE_EVENT_TABLE()
#define DIALOGS_FILE_OPEN 8 #define DIALOGS_FILE_OPEN 8
#define DIALOGS_FILE_SAVE 9 #define DIALOGS_FILE_SAVE 9
#define DIALOGS_DIR_CHOOSE 10 #define DIALOGS_DIR_CHOOSE 10
#define DIALOGS_TIP 11
#endif #endif

5
samples/dialogs/tips.txt Normal file
View File

@@ -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.

View File

@@ -9,29 +9,31 @@
// Licence: wxWindows licence // Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
#include <wx/wxprec.h> #include "wx/wxprec.h"
#ifdef __BORLANDC__ #ifdef __BORLANDC__
#pragma hdrstop #pragma hdrstop
#endif #endif
#ifndef WX_PRECOMP #ifndef WX_PRECOMP
#include <wx/wx.h> #include "wx/wx.h"
#endif #endif
#include <wx/intl.h> #include "wx/intl.h"
#include <wx/log.h> #include "wx/log.h"
#include <wx/dnd.h> #include "wx/dnd.h"
#ifdef __WXMOTIF__ #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 #endif
#if defined(__WXGTK__) || defined(__WXMOTIF__) #if defined(__WXGTK__) || defined(__WXMOTIF__)
#include "mondrian.xpm" #include "mondrian.xpm"
#endif #endif
#include "wx/clipbrd.h"
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// Derive two simple classes which just put in the listbox the strings (text or // Derive two simple classes which just put in the listbox the strings (text or
// file names) we drop on them // file names) we drop on them
@@ -47,24 +49,25 @@
class DnDText : public wxTextDropTarget class DnDText : public wxTextDropTarget
{ {
public: 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: private:
wxListBox *m_pOwner; wxListBox *m_pOwner;
}; };
class DnDFile : public wxFileDropTarget class DnDFile : public wxFileDropTarget
{ {
public: public:
DnDFile(wxListBox *pOwner) { m_pOwner = pOwner; } DnDFile(wxListBox *pOwner) { m_pOwner = pOwner; }
virtual bool OnDropFiles(wxDropPointCoord x, wxDropPointCoord y, virtual bool OnDropFiles(wxDropPointCoord x, wxDropPointCoord y,
size_t nFiles, const wxChar* const aszFiles[] ); size_t nFiles, const wxChar* const aszFiles[] );
private: private:
wxListBox *m_pOwner; wxListBox *m_pOwner;
}; };
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@@ -74,7 +77,7 @@ private:
class DnDApp : public wxApp class DnDApp : public wxApp
{ {
public: public:
bool OnInit(); bool OnInit();
}; };
IMPLEMENT_APP(DnDApp); IMPLEMENT_APP(DnDApp);
@@ -85,29 +88,31 @@ IMPLEMENT_APP(DnDApp);
class DnDFrame : public wxFrame class DnDFrame : public wxFrame
{ {
public: public:
DnDFrame(wxFrame *frame, char *title, int x, int y, int w, int h); DnDFrame(wxFrame *frame, char *title, int x, int y, int w, int h);
~DnDFrame(); ~DnDFrame();
void OnPaint(wxPaintEvent& event); void OnPaint(wxPaintEvent& event);
void OnQuit (wxCommandEvent& event); void OnQuit (wxCommandEvent& event);
void OnAbout(wxCommandEvent& event); void OnAbout(wxCommandEvent& event);
void OnDrag (wxCommandEvent& event); void OnDrag (wxCommandEvent& event);
void OnHelp (wxCommandEvent& event); void OnHelp (wxCommandEvent& event);
void OnLogClear(wxCommandEvent& event); void OnLogClear(wxCommandEvent& event);
void OnCopy(wxCommandEvent& event);
void OnPaste(wxCommandEvent& event);
void OnLeftDown(wxMouseEvent& event); void OnLeftDown(wxMouseEvent& event);
void OnRightDown(wxMouseEvent& event); void OnRightDown(wxMouseEvent& event);
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
private: private:
wxListBox *m_ctrlFile, wxListBox *m_ctrlFile,
*m_ctrlText; *m_ctrlText;
wxTextCtrl *m_ctrlLog; 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 enum
{ {
Menu_Quit = 1, Menu_Quit = 1,
Menu_Drag, Menu_Drag,
Menu_About = 101, Menu_About = 101,
Menu_Help, Menu_Help,
Menu_Clear, Menu_Clear,
Menu_Copy,
Menu_Paste
}; };
BEGIN_EVENT_TABLE(DnDFrame, wxFrame) BEGIN_EVENT_TABLE(DnDFrame, wxFrame)
EVT_MENU(Menu_Quit, DnDFrame::OnQuit) EVT_MENU(Menu_Quit, DnDFrame::OnQuit)
EVT_MENU(Menu_About, DnDFrame::OnAbout) EVT_MENU(Menu_About, DnDFrame::OnAbout)
EVT_MENU(Menu_Drag, DnDFrame::OnDrag) EVT_MENU(Menu_Drag, DnDFrame::OnDrag)
EVT_MENU(Menu_Help, DnDFrame::OnHelp) EVT_MENU(Menu_Help, DnDFrame::OnHelp)
EVT_MENU(Menu_Clear, DnDFrame::OnLogClear) EVT_MENU(Menu_Clear, DnDFrame::OnLogClear)
EVT_LEFT_DOWN( DnDFrame::OnLeftDown) EVT_MENU(Menu_Copy, DnDFrame::OnCopy)
EVT_RIGHT_DOWN( DnDFrame::OnRightDown) EVT_MENU(Menu_Paste, DnDFrame::OnPaste)
EVT_PAINT( DnDFrame::OnPaint)
EVT_LEFT_DOWN( DnDFrame::OnLeftDown)
EVT_RIGHT_DOWN( DnDFrame::OnRightDown)
EVT_PAINT( DnDFrame::OnPaint)
END_EVENT_TABLE() 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() bool DnDApp::OnInit()
{ {
// create the main frame window // create the main frame window
DnDFrame *frame = new DnDFrame((wxFrame *) NULL, "Drag & Drop wxWindows App", DnDFrame *frame = new DnDFrame((wxFrame *) NULL,
50, 50, 450, 340); "Drag-and-Drop/Clipboard wxWindows Sample",
50, 50, 450, 340);
// activate it // activate it
frame->Show(TRUE); 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) 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 :-)") m_strText("wxWindows drag & drop works :-)")
{ {
// SetBackgroundColour(* wxWHITE); // frame icon and status bar
SetIcon(wxICON(mondrian));
// frame icon and status bar CreateStatusBar();
SetIcon(wxICON(mondrian));
// const int widths[] = { -1 }; // construct menu
CreateStatusBar(); 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 // construct menu
wxMenu *file_menu = new wxMenu; 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 */) void DnDFrame::OnQuit(wxCommandEvent& /* event */)
{ {
Close(TRUE); Close(TRUE);
} }
void DnDFrame::OnPaint(wxPaintEvent& /*event*/) void DnDFrame::OnPaint(wxPaintEvent& /*event*/)
{ {
int w = 0; int w = 0;
int h = 0; int h = 0;
GetClientSize( &w, &h ); GetClientSize( &w, &h );
wxPaintDC dc(this); wxPaintDC dc(this);
dc.SetFont( wxFont( 24, wxDECORATIVE, wxNORMAL, wxNORMAL, FALSE, "charter" ) ); dc.SetFont( wxFont( 24, wxDECORATIVE, wxNORMAL, wxNORMAL, FALSE, "charter" ) );
dc.DrawText( "Drag text from here!", 20, h-35 ); dc.DrawText( "Drag text from here!", 20, h-35 );
} }
void DnDFrame::OnDrag(wxCommandEvent& /* event */) void DnDFrame::OnDrag(wxCommandEvent& /* event */)
{ {
wxString strText = wxGetTextFromUser wxString strText = wxGetTextFromUser
( (
"After you enter text in this dialog, press any mouse\n" "After you enter text in this dialog, press any mouse\n"
"button in the bottom (empty) part of the frame and \n" "button in the bottom (empty) part of the frame and \n"
"drag it anywhere - you will be in fact dragging the\n" "drag it anywhere - you will be in fact dragging the\n"
"text object containing this text", "text object containing this text",
"Please enter some text", m_strText, this "Please enter some text", m_strText, this
); );
m_strText = strText; m_strText = strText;
} }
void DnDFrame::OnAbout(wxCommandEvent& /* event */) void DnDFrame::OnAbout(wxCommandEvent& /* event */)
{ {
wxMessageDialog dialog(this, wxMessageBox("Drag-&-Drop Demo\n"
"Drag-&-Drop Demo\n" "Please see \"Help|Help...\" for details\n"
"Please see \"Help|Help...\" for details\n" "Copyright (c) 1998 Vadim Zeitlin",
"Copyright (c) 1998 Vadim Zeitlin", "About wxDnD",
"About wxDnD"); wxICON_INFORMATION | wxOK,
this);
dialog.ShowModal();
} }
void DnDFrame::OnHelp(wxCommandEvent& /* event */) void DnDFrame::OnHelp(wxCommandEvent& /* event */)
{ {
wxMessageDialog dialog(this, wxMessageDialog dialog(this,
"This small program demonstrates drag & drop support in wxWindows. The program window\n" "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" "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" "going on inside. The top part is split into 2 listboxes, the left one accepts files\n"
"and the right one accepts text.\n" "and the right one accepts text.\n"
"\n" "\n"
"To test wxDropTarget: open wordpad (write.exe), select some text in it and drag it to\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" "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" "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" "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" "work with files) and see what changes.\n"
"\n" "\n"
"To test wxDropSource: just press any mouse button on the empty zone of the window and drag\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" "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" "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" "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" "dragged in in \"File|Test drag...\" dialog.\n"
"\n" "\n"
"\n" "\n"
"Please send all questions/bug reports/suggestions &c to \n" "Please send all questions/bug reports/suggestions &c to \n"
"Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>", "Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>",
"wxDnD Help"); "wxDnD Help");
dialog.ShowModal(); dialog.ShowModal();
} }
void DnDFrame::OnLogClear(wxCommandEvent& /* event */ ) void DnDFrame::OnLogClear(wxCommandEvent& /* event */ )
{ {
m_ctrlLog->Clear(); m_ctrlLog->Clear();
} }
void DnDFrame::OnLeftDown(wxMouseEvent &WXUNUSED(event) ) void DnDFrame::OnLeftDown(wxMouseEvent &WXUNUSED(event) )
{ {
if ( !m_strText.IsEmpty() ) if ( !m_strText.IsEmpty() )
{
// start drag operation
#ifdef __WXMSW__
wxTextDataObject textData(m_strText);
wxDropSource dragSource( textData, this );
#else
wxDropSource dragSource( new wxTextDataObject (m_strText), this, wxIcon(mondrian_xpm) );
#endif
const char *pc;
switch ( dragSource.DoDragDrop(TRUE) )
{ {
case wxDragError: pc = "Error!"; break; // start drag operation
case wxDragNone: pc = "Nothing"; break; #ifdef __WXMSW__
case wxDragCopy: pc = "Copied"; break; wxTextDataObject textData(m_strText);
case wxDragMove: pc = "Moved"; break; wxDropSource dragSource( textData, this );
case wxDragCancel: pc = "Cancelled"; break; #else
default: pc = "Huh?"; break; wxDropSource dragSource( new wxTextDataObject (m_strText), this, wxIcon(mondrian_xpm) );
} #endif
const char *pc;
SetStatusText(wxString("Drag result: ") + 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);
}
} }
void DnDFrame::OnRightDown(wxMouseEvent &event ) void DnDFrame::OnRightDown(wxMouseEvent &event )
{ {
wxMenu *menu = new wxMenu; wxMenu *menu = new wxMenu;
menu->Append(Menu_Drag, "&Test drag..."); menu->Append(Menu_Drag, "&Test drag...");
menu->Append(Menu_About, "&About"); menu->Append(Menu_About, "&About");
menu->Append(Menu_Quit, "E&xit"); menu->Append(Menu_Quit, "E&xit");
PopupMenu( menu, event.GetX(), event.GetY() ); PopupMenu( menu, event.GetX(), event.GetY() );
} }
DnDFrame::~DnDFrame() DnDFrame::~DnDFrame()
{ {
if ( m_pLog != NULL ) { if ( m_pLog != NULL ) {
if ( wxLog::SetActiveTarget(m_pLogPrev) == m_pLog ) if ( wxLog::SetActiveTarget(m_pLogPrev) == m_pLog )
delete 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 ) 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, bool DnDFile::OnDropFiles( wxDropPointCoord, wxDropPointCoord, size_t nFiles,
const wxChar* const aszFiles[]) const wxChar* const aszFiles[])
{ {
wxString str; wxString str;
str.Printf( _T("%d files dropped"), nFiles); str.Printf( _T("%d files dropped"), nFiles);
m_pOwner->Append(str); m_pOwner->Append(str);
for ( size_t n = 0; n < nFiles; n++ ) { for ( size_t n = 0; n < nFiles; n++ ) {
m_pOwner->Append(aszFiles[n]); m_pOwner->Append(aszFiles[n]);
} }
return TRUE; return TRUE;
} }

View File

@@ -235,6 +235,7 @@ void MyFrame::OnListView(wxCommandEvent& WXUNUSED(event))
void MyFrame::OnReportView(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnReportView(wxCommandEvent& WXUNUSED(event))
{ {
m_listCtrl->DeleteAllItems(); m_listCtrl->DeleteAllItems();
m_listCtrl->DeleteAllColumns();
m_logWindow->Clear(); m_logWindow->Clear();
m_listCtrl->SetSingleStyle(wxLC_REPORT); m_listCtrl->SetSingleStyle(wxLC_REPORT);

View File

@@ -69,6 +69,9 @@ public:
// event handlers (these functions should _not_ be virtual) // event handlers (these functions should _not_ be virtual)
void OnQuit(wxCommandEvent& event); void OnQuit(wxCommandEvent& event);
void OnAbout(wxCommandEvent& event); void OnAbout(wxCommandEvent& event);
void OnTest(wxCommandEvent& event);
void OnPaint(wxPaintEvent& event);
private: private:
// any class wishing to process wxWindows events must use this macro // any class wishing to process wxWindows events must use this macro
@@ -85,8 +88,7 @@ enum
// menu items // menu items
Minimal_Quit = 1, Minimal_Quit = 1,
Minimal_About, Minimal_About,
Minimal_Test1, Minimal_Test,
Minimal_Test2,
// controls start here (the numbers are, of course, arbitrary) // controls start here (the numbers are, of course, arbitrary)
Minimal_Text = 1000, Minimal_Text = 1000,
@@ -102,6 +104,10 @@ enum
BEGIN_EVENT_TABLE(MyFrame, wxFrame) BEGIN_EVENT_TABLE(MyFrame, wxFrame)
EVT_MENU(Minimal_Quit, MyFrame::OnQuit) EVT_MENU(Minimal_Quit, MyFrame::OnQuit)
EVT_MENU(Minimal_About, MyFrame::OnAbout) EVT_MENU(Minimal_About, MyFrame::OnAbout)
EVT_BUTTON(-1, MyFrame::OnTest)
EVT_PAINT(MyFrame::OnPaint)
END_EVENT_TABLE() END_EVENT_TABLE()
// Create a new application object: this macro will allow wxWindows to create // 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 // ... and attach this menu bar to the frame
SetMenuBar(menuBar); SetMenuBar(menuBar);
#if wxUSE_STATUSBAR
// create a status bar just for fun (by default with 1 pane only) // create a status bar just for fun (by default with 1 pane only)
CreateStatusBar(2); CreateStatusBar(2);
SetStatusText("Welcome to wxWindows!"); 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); 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);
}

View File

@@ -238,7 +238,7 @@ MyFrame::AddSampleText(wxLayoutList *llist)
void void
MyFrame::Clear(void) MyFrame::Clear(void)
{ {
wxColour colBg(0, 255, 255); wxColour colBg(0, 0, 0);
m_lwin->Clear(wxROMAN,16,wxNORMAL,wxNORMAL, false, wxRED, &colBg); m_lwin->Clear(wxROMAN,16,wxNORMAL,wxNORMAL, false, wxRED, &colBg);
} }

View File

@@ -28,21 +28,19 @@
#include "wx/listbox.h" #include "wx/listbox.h"
#include "wx/stattext.h" #include "wx/stattext.h"
#include "wx/intl.h" #include "wx/intl.h"
#include "wx/dcclient.h"
#include "wx/settings.h"
#endif #endif
#if wxUSE_STATLINE #if wxUSE_STATLINE
#include "wx/statline.h" #include "wx/statline.h"
#endif #endif
#include "wx/generic/choicdgg.h" #include "wx/generic/choicdgg.h"
#define wxID_LISTBOX 3000 #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, const wxString *choices, wxWindow *parent,
int WXUNUSED(x), int WXUNUSED(y), bool WXUNUSED(centre), int WXUNUSED(x), int WXUNUSED(y), bool WXUNUSED(centre),
int WXUNUSED(width), int WXUNUSED(height) ) int WXUNUSED(width), int WXUNUSED(height) )
{ {
wxSingleChoiceDialog dialog(parent, message, caption, n, choices); wxSingleChoiceDialog dialog(parent, message, caption, n, choices);
@@ -53,9 +51,9 @@ wxString wxGetSingleChoice( const wxString& message, const wxString& caption, in
} }
// Overloaded for backward compatibility // Overloaded for backward compatibility
wxString wxGetSingleChoice( const wxString& message, const wxString& caption, int n, wxString wxGetSingleChoice( const wxString& message, const wxString& caption, int n,
char *choices[], wxWindow *parent, char *choices[], wxWindow *parent,
int x, int y, bool centre, int x, int y, bool centre,
int width, int height ) int width, int height )
{ {
wxString *strings = new wxString[n]; wxString *strings = new wxString[n];
@@ -70,9 +68,9 @@ wxString wxGetSingleChoice( const wxString& message, const wxString& caption, in
return ans; return ans;
} }
int wxGetSingleChoiceIndex( const wxString& message, const wxString& caption, int n, int wxGetSingleChoiceIndex( const wxString& message, const wxString& caption, int n,
const wxString *choices, wxWindow *parent, const wxString *choices, wxWindow *parent,
int WXUNUSED(x), int WXUNUSED(y), bool WXUNUSED(centre), int WXUNUSED(x), int WXUNUSED(y), bool WXUNUSED(centre),
int WXUNUSED(width), int WXUNUSED(height) ) int WXUNUSED(width), int WXUNUSED(height) )
{ {
wxSingleChoiceDialog dialog(parent, message, caption, n, choices); wxSingleChoiceDialog dialog(parent, message, caption, n, choices);
@@ -83,9 +81,9 @@ int wxGetSingleChoiceIndex( const wxString& message, const wxString& caption, in
} }
// Overloaded for backward compatibility // Overloaded for backward compatibility
int wxGetSingleChoiceIndex( const wxString& message, const wxString& caption, int n, int wxGetSingleChoiceIndex( const wxString& message, const wxString& caption, int n,
wxChar *choices[], wxWindow *parent, wxChar *choices[], wxWindow *parent,
int x, int y, bool centre, int x, int y, bool centre,
int width, int height ) int width, int height )
{ {
wxString *strings = new wxString[n]; wxString *strings = new wxString[n];
@@ -99,7 +97,7 @@ int wxGetSingleChoiceIndex( const wxString& message, const wxString& caption, in
wxChar *wxGetSingleChoiceData( const wxString& message, const wxString& caption, int n, wxChar *wxGetSingleChoiceData( const wxString& message, const wxString& caption, int n,
const wxString *choices, wxChar **client_data, wxWindow *parent, const wxString *choices, wxChar **client_data, wxWindow *parent,
int WXUNUSED(x), int WXUNUSED(y), bool WXUNUSED(centre), int WXUNUSED(x), int WXUNUSED(y), bool WXUNUSED(centre),
int WXUNUSED(width), int WXUNUSED(height) ) int WXUNUSED(width), int WXUNUSED(height) )
{ {
wxSingleChoiceDialog dialog(parent, message, caption, n, choices, client_data); wxSingleChoiceDialog dialog(parent, message, caption, n, choices, client_data);
@@ -110,9 +108,9 @@ wxChar *wxGetSingleChoiceData( const wxString& message, const wxString& caption,
} }
// Overloaded for backward compatibility // Overloaded for backward compatibility
wxChar *wxGetSingleChoiceData( const wxString& message, const wxString& caption, int n, wxChar *wxGetSingleChoiceData( const wxString& message, const wxString& caption, int n,
wxChar *choices[], wxChar **client_data, wxWindow *parent, wxChar *choices[], wxChar **client_data, wxWindow *parent,
int x, int y, bool centre, int x, int y, bool centre,
int width, int height ) int width, int height )
{ {
wxString *strings = new wxString[n]; wxString *strings = new wxString[n];
@@ -173,7 +171,7 @@ IMPLEMENT_CLASS(wxSingleChoiceDialog, wxDialog)
wxSingleChoiceDialog::wxSingleChoiceDialog(wxWindow *parent, wxSingleChoiceDialog::wxSingleChoiceDialog(wxWindow *parent,
const wxString& message, const wxString& message,
const wxString& caption, const wxString& caption,
int n, int n,
const wxString *choices, const wxString *choices,
char **clientData, char **clientData,
long style, long style,
@@ -187,9 +185,9 @@ wxSingleChoiceDialog::wxSingleChoiceDialog(wxWindow *parent,
wxSingleChoiceDialog::wxSingleChoiceDialog(wxWindow *parent, wxSingleChoiceDialog::wxSingleChoiceDialog(wxWindow *parent,
const wxString& message, const wxString& message,
const wxString& caption, const wxString& caption,
const wxStringList& choices, const wxStringList& choices,
wxChar **clientData, wxChar **clientData,
long style, long style,
const wxPoint& pos) const wxPoint& pos)
: wxDialog(parent, -1, caption, pos, wxDefaultSize, : wxDialog(parent, -1, caption, pos, wxDefaultSize,
wxCHOICEDLG_DIALOG_STYLE) wxCHOICEDLG_DIALOG_STYLE)
@@ -217,92 +215,41 @@ bool wxSingleChoiceDialog::Create(wxWindow *parent,
} }
bool wxSingleChoiceDialog::Create( wxWindow *WXUNUSED(parent), bool wxSingleChoiceDialog::Create( wxWindow *WXUNUSED(parent),
const wxString& message, const wxString& message,
const wxString& WXUNUSED(caption), const wxString& WXUNUSED(caption),
int n, int n,
const wxString *choices, const wxString *choices,
char **clientData, char **clientData,
long style, long style,
const wxPoint& WXUNUSED(pos) ) const wxPoint& WXUNUSED(pos) )
{ {
m_dialogStyle = style;
m_selection = 0; m_selection = 0;
m_clientData = NULL; 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 // 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; wxArrayString lines;
wxString curLine; wxSize sizeText = SplitTextMessage(message, &lines);
long height, width, heightTextMax = 0, widthTextMax = 0; long heightTextMax = sizeText.GetHeight(),
for ( const char *pc = message; ; pc++ ) { widthTextMax = sizeText.GetWidth();
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;
}
}
size_t nLineCount = lines.Count(); size_t nLineCount = lines.Count();
long hTotalMsg = heightTextMax*nLineCount; long hTotalMsg = heightTextMax*nLineCount;
// calc the button size // calc the button size
// -------------------- // --------------------
bool hasCancel = FALSE;
// always create the OK button - the code below supposes we do have buttons // 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 // and besides the user should have some way to close this dialog
wxASSERT_MSG( style & wxOK, _T("this dialog should have OK button") ); wxASSERT_MSG( style & wxOK, _T("this dialog should have OK button") );
wxString labelOk(_("OK")); bool hasCancel = (style & wxCANCEL) != 0;
long wButton = 0;
dc.GetTextExtent(labelOk, &width, NULL);
if ( width > wButton )
wButton = width;
wxString labelCancel; wxSize sizeButtons = GetStandardButtonSize(hasCancel);
if ( style & wxCANCEL )
{
labelCancel = _("Cancel");
dc.GetTextExtent(labelCancel, &width, NULL);
if ( width > wButton )
wButton = width;
hasCancel = TRUE; long wButton = sizeButtons.GetWidth(),
} hButton = sizeButtons.GetHeight();
if ( wButton < 75 )
wButton = 75;
else
wButton += 10;
long hButton = wButton*23/75;
long wTotalButtons = wButton; long wTotalButtons = wButton;
if ( hasCancel ) if ( hasCancel )
{ {
@@ -321,8 +268,7 @@ bool wxSingleChoiceDialog::Create( wxWindow *WXUNUSED(parent),
wListbox = wxMax(300, wxMax(wTotalButtons, widthTextMax)); wListbox = wxMax(300, wxMax(wTotalButtons, widthTextMax));
#if wxUSE_STATLINE #if wxUSE_STATLINE
// arbitrary... long hStatLine = wxStaticLine::GetDefaultSize();
long hStatLine = 5;
#endif #endif
// now the complete dialog size // now the complete dialog size
@@ -362,7 +308,7 @@ bool wxSingleChoiceDialog::Create( wxWindow *WXUNUSED(parent),
// listbox // listbox
m_listbox = new wxListBox( this, wxID_LISTBOX, m_listbox = new wxListBox( this, wxID_LISTBOX,
wxPoint(2*LAYOUT_X_MARGIN, y), wxPoint(2*LAYOUT_X_MARGIN, y),
wxSize(wListbox, hListbox), wxSize(wListbox, hListbox),
n, choices, n, choices,
wxLB_HSCROLL); wxLB_HSCROLL);
y += hListbox; y += hListbox;
@@ -376,41 +322,17 @@ bool wxSingleChoiceDialog::Create( wxWindow *WXUNUSED(parent),
// separator line // separator line
#if wxUSE_STATLINE #if wxUSE_STATLINE
(void) new wxStaticLine( this, -1, (void) new wxStaticLine( this, -1,
wxPoint(0, y + LAYOUT_Y_MARGIN), wxPoint(2*LAYOUT_X_MARGIN, y + LAYOUT_Y_MARGIN),
wxSize(wDialog, hStatLine) ); wxSize(wDialog - 4*LAYOUT_X_MARGIN, hStatLine) );
y += LAYOUT_Y_MARGIN + hStatLine; y += LAYOUT_Y_MARGIN + hStatLine;
#endif #endif
// buttons // buttons
y += 2*LAYOUT_X_MARGIN; y += 2*LAYOUT_X_MARGIN;
// NB: create [Ok] first to get the right tab order CreateStandardButtons(wDialog, y, wButton, hButton, hasCancel);
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();
SetClientSize( wDialog, hDialog ); SetClientSize( wDialog, hDialog );

View File

@@ -6,7 +6,7 @@
// Created: 04/01/98 // Created: 04/01/98
// RCS-ID: $Id$ // RCS-ID: $Id$
// Copyright: (c) Julian Smart, Markus Holzem, Robert Roebling // Copyright: (c) Julian Smart, Markus Holzem, Robert Roebling
// Licence: wxWindows license // Licence: wxWindows license
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__ #ifdef __GNUG__
@@ -21,15 +21,15 @@
#endif #endif
#ifndef WX_PRECOMP #ifndef WX_PRECOMP
#include "wx/utils.h" #include "wx/utils.h"
#include "wx/dialog.h" #include "wx/dialog.h"
#include "wx/button.h" #include "wx/button.h"
#include "wx/stattext.h" #include "wx/stattext.h"
#include "wx/statbmp.h" #include "wx/statbmp.h"
#include "wx/layout.h" #include "wx/layout.h"
#include "wx/intl.h" #include "wx/intl.h"
#include "wx/dcclient.h" #include "wx/dcclient.h"
#include "wx/settings.h" #include "wx/settings.h"
#endif #endif
#include <stdio.h> #include <stdio.h>
@@ -71,9 +71,6 @@ wxGenericMessageDialog::wxGenericMessageDialog( wxWindow *parent,
const wxPoint& pos) const wxPoint& pos)
: wxDialog( parent, -1, caption, pos, wxDefaultSize, wxDEFAULT_DIALOG_STYLE ) : 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; m_dialogStyle = style;
wxBeginBusyCursor(); wxBeginBusyCursor();
@@ -122,34 +119,12 @@ wxGenericMessageDialog::wxGenericMessageDialog( wxWindow *parent,
// split the message in lines // split the message in lines
// -------------------------- // --------------------------
wxClientDC dc(this);
dc.SetFont(wxSystemSettings::GetSystemFont(wxSYS_DEFAULT_GUI_FONT));
wxArrayString lines; wxArrayString lines;
wxString curLine; wxSize sizeText = SplitTextMessage(message, &lines);
long height, width, heightTextMax = 0, widthTextMax = 0; long widthTextMax = sizeText.GetWidth(),
for ( const char *pc = message; ; pc++ ) { heightTextMax = sizeText.GetHeight();
if ( *pc == '\n' || *pc == '\0' ) { size_t nLineCount = lines.GetCount();
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;
}
}
// calculate the total dialog size // calculate the total dialog size
enum enum
@@ -194,7 +169,7 @@ wxGenericMessageDialog::wxGenericMessageDialog( wxWindow *parent,
// get the longest caption and also calc the number of buttons // get the longest caption and also calc the number of buttons
size_t nBtn, nButtons = 0; size_t nBtn, nButtons = 0;
long widthBtnMax = 0; long width, widthBtnMax = 0;
for ( nBtn = 0; nBtn < Btn_Max; nBtn++ ) { for ( nBtn = 0; nBtn < Btn_Max; nBtn++ ) {
if ( buttons[nBtn] ) { if ( buttons[nBtn] ) {
nButtons++; nButtons++;
@@ -215,8 +190,6 @@ wxGenericMessageDialog::wxGenericMessageDialog( wxWindow *parent,
heightTextMax *= 12; heightTextMax *= 12;
heightTextMax /= 10; heightTextMax /= 10;
size_t nLineCount = lines.Count();
long widthButtonsTotal = nButtons * (widthBtnMax + LAYOUT_X_MARGIN) - long widthButtonsTotal = nButtons * (widthBtnMax + LAYOUT_X_MARGIN) -
LAYOUT_X_MARGIN; LAYOUT_X_MARGIN;

View File

@@ -174,10 +174,7 @@ wxProgressDialog::wxProgressDialog(wxString const &title,
m_btnAbort = new wxButton(this, -1, _("Cancel")); m_btnAbort = new wxButton(this, -1, _("Cancel"));
c = new wxLayoutConstraints; c = new wxLayoutConstraints;
c->centreX.SameAs(this, wxCentreX); c->centreX.SameAs(this, wxCentreX);
if(lastWindow) c->top.Below(lastWindow, 2*LAYOUT_Y_MARGIN);
c->top.Below(lastWindow, 2*LAYOUT_Y_MARGIN);
else
c->top.Below(m_btnAbort, 2*LAYOUT_Y_MARGIN);
c->width.AsIs(); c->width.AsIs();
c->height.AsIs(); c->height.AsIs();
m_btnAbort->SetConstraints(c); 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 // wide under Windows, so try to find a reasonable value for the width, not
// too big and not too small // too big and not too small
wxSize size = GetClientSize(); wxSize size = GetClientSize();
size.x = 2*widthText; size.x = wxMax(3*widthText/2, 2*size.y);
if ( size.x < 2*size.y ) SetClientSize(size);
SetClientSize(2*size.y, size.y);
Show(TRUE); Show(TRUE);
Centre(wxCENTER_FRAME | wxBOTH); Centre(wxCENTER_FRAME | wxBOTH);
@@ -235,18 +231,18 @@ wxProgressDialog::Update(int value, const wxString& newmsg)
if (m_elapsed) if (m_elapsed)
{ {
s.Printf("%i:%02i:%02i", diff.GetHour(), diff.GetMinute(), diff.GetSecond()); s.Printf("%i:%02i:%02i", diff.GetHour(), diff.GetMinute(), diff.GetSecond());
if (s != m_elapsed->GetLabel()) m_elapsed->SetLabel(s); if (s != m_elapsed->GetLabel()) m_elapsed->SetLabel(s);
} }
if (m_estimated) if (m_estimated)
{ {
s.Printf("%i:%02i:%02i", estim / (60 * 60), (estim / 60) % 60, estim % 60); s.Printf("%i:%02i:%02i", estim / (60 * 60), (estim / 60) % 60, estim % 60);
if (s != m_estimated->GetLabel()) m_estimated->SetLabel(s); if (s != m_estimated->GetLabel()) m_estimated->SetLabel(s);
} }
if (m_remaining) if (m_remaining)
{ {
s.Printf("%i:%02i:%02i", remai / (60 * 60), (remai / 60) % 60, remai % 60); s.Printf("%i:%02i:%02i", remai / (60 * 60), (remai / 60) % 60, remai % 60);
if (s != m_remaining->GetLabel()) m_remaining->SetLabel(s); if (s != m_remaining->GetLabel()) m_remaining->SetLabel(s);
} }
} }

61
src/generic/statline.cpp Normal file
View File

@@ -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;
}

View File

@@ -6,157 +6,132 @@
// Created: 04/01/98 // Created: 04/01/98
// RCS-ID: $Id$ // RCS-ID: $Id$
// Copyright: (c) Julian Smart and Markus Holzem // Copyright: (c) Julian Smart and Markus Holzem
// Licence: wxWindows license // Licence: wxWindows license
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// ============================================================================
// declarations
// ============================================================================
// ----------------------------------------------------------------------------
// headers
// ----------------------------------------------------------------------------
#ifdef __GNUG__ #ifdef __GNUG__
#pragma implementation "textdlgg.h" #pragma implementation "textdlgg.h"
#endif #endif
// For compilers that support precompilation, includes "wx.h". // For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h" #include "wx/wxprec.h"
#ifdef __BORLANDC__ #ifdef __BORLANDC__
#pragma hdrstop #pragma hdrstop
#endif #endif
#ifndef WX_PRECOMP #ifndef WX_PRECOMP
#include <stdio.h> #include <stdio.h>
#include "wx/utils.h"
#include "wx/dialog.h" #include "wx/utils.h"
#include "wx/button.h" #include "wx/dialog.h"
#include "wx/stattext.h" #include "wx/button.h"
#include "wx/textctrl.h" #include "wx/stattext.h"
#include "wx/intl.h" #include "wx/textctrl.h"
#include "wx/intl.h"
#endif #endif
#if wxUSE_STATLINE #if wxUSE_STATLINE
#include "wx/statline.h" #include "wx/statline.h"
#endif #endif
#include "wx/generic/textdlgg.h" #include "wx/generic/textdlgg.h"
/* Split message, using constraints to position controls */ // ----------------------------------------------------------------------------
static wxSize wxSplitMessage2( const wxString &message, wxWindow *parent ) // constants
{ // ----------------------------------------------------------------------------
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);
}
#define wxID_TEXT 3000
// ============================================================================
// implementation
// ============================================================================
// ----------------------------------------------------------------------------
// wxTextEntryDialog // wxTextEntryDialog
// ----------------------------------------------------------------------------
#if !USE_SHARED_LIBRARY #if !USE_SHARED_LIBRARY
BEGIN_EVENT_TABLE(wxTextEntryDialog, wxDialog) BEGIN_EVENT_TABLE(wxTextEntryDialog, wxDialog)
EVT_BUTTON(wxID_OK, wxTextEntryDialog::OnOK) EVT_BUTTON(wxID_OK, wxTextEntryDialog::OnOK)
END_EVENT_TABLE() END_EVENT_TABLE()
IMPLEMENT_CLASS(wxTextEntryDialog, wxDialog) IMPLEMENT_CLASS(wxTextEntryDialog, wxDialog)
#endif #endif
wxTextEntryDialog::wxTextEntryDialog(wxWindow *parent, const wxString& message, const wxString& caption, wxTextEntryDialog::wxTextEntryDialog(wxWindow *parent,
const wxString& value, long style, const wxPoint& pos): const wxString& message,
wxDialog(parent, -1, caption, pos, wxDefaultSize, wxDEFAULT_DIALOG_STYLE|wxDIALOG_MODAL|wxTAB_TRAVERSAL) 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; // calculate the sizes
m_value = value; // -------------------
wxBeginBusyCursor(); wxArrayString lines;
wxSize sizeText = SplitTextMessage(message, &lines);
wxSize message_size( wxSplitMessage2( message, this ) ); wxSize sizeBtn = GetStandardButtonSize();
wxButton *ok = (wxButton *) NULL; long wText = wxMax(4*sizeBtn.GetWidth(), sizeText.GetWidth());
wxButton *cancel = (wxButton *) NULL; long hText = GetStandardTextHeight();
wxList m_buttons;
int y = message_size.y + 15;
wxTextCtrl *textCtrl = new wxTextCtrl(this, wxID_TEXT, value, wxPoint(-1, y), wxSize(350, -1));
y += 65;
if (style & wxOK) 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;
// create the controls
// -------------------
// message
long x = 2*LAYOUT_X_MARGIN;
long y = CreateTextMessage(lines,
wxPoint(x, 2*LAYOUT_Y_MARGIN),
sizeText);
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;
// and buttons
CreateStandardButtons(wDialog, y, sizeBtn.GetWidth(), sizeBtn.GetHeight());
// set the dialog size and position
SetClientSize(wDialog, hDialog);
if ( pos == wxDefaultPosition )
{ {
ok = new wxButton( this, wxID_OK, _("OK"), wxPoint(-1,y), wxSize(80,-1) ); // centre the dialog if no explicit position given
m_buttons.Append( ok ); Centre(wxBOTH | wxCENTER_FRAME);
} }
if (style & wxCANCEL) m_textctrl->SetFocus();
{
cancel = new wxButton( this, wxID_CANCEL, _("Cancel"), wxPoint(-1,y), wxSize(80,-1) );
m_buttons.Append( cancel );
}
if (ok)
{
ok->SetDefault();
ok->SetFocus();
}
int w = wxMax( 350, m_buttons.GetCount() * 100 );
w = wxMax( w, message_size.x );
int space = w / (m_buttons.GetCount()*2);
textCtrl->SetSize( 20, -1, w-10, -1 );
int m = 0;
wxNode *node = m_buttons.First();
while (node)
{
wxWindow *win = (wxWindow*)node->Data();
int x = (m*2+1)*space - 40 + 15;
win->Move( x, -1 );
node = node->Next();
m++;
}
#if wxUSE_STATLINE
(void) new wxStaticLine( this, -1, wxPoint(0,y-20), wxSize(w+30, 5) );
#endif
SetSize( w+30, y+40 );
Centre( wxBOTH );
wxEndBusyCursor();
} }
void wxTextEntryDialog::OnOK(wxCommandEvent& WXUNUSED(event) ) void wxTextEntryDialog::OnOK(wxCommandEvent& WXUNUSED(event) )
{ {
wxTextCtrl *textCtrl = (wxTextCtrl *)FindWindow(wxID_TEXT); m_value = m_textctrl->GetValue();
if ( textCtrl )
m_value = textCtrl->GetValue();
EndModal(wxID_OK); EndModal(wxID_OK);
} }

260
src/generic/tipdlg.cpp Normal file
View File

@@ -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

View File

@@ -37,6 +37,7 @@ libwx_gtk_la_SOURCES = \
date.cpp \ date.cpp \
datstrm.cpp \ datstrm.cpp \
dcbase.cpp \ dcbase.cpp \
dlgcmn.cpp \
docmdi.cpp \ docmdi.cpp \
docview.cpp \ docview.cpp \
dynarray.cpp \ dynarray.cpp \
@@ -186,6 +187,7 @@ libwx_gtk_la_SOURCES = \
textctrl.cpp \ textctrl.cpp \
textdlg.cpp \ textdlg.cpp \
timer.cpp \ timer.cpp \
tipdlg.cpp \
tooltip.cpp \ tooltip.cpp \
utilsgtk.cpp \ utilsgtk.cpp \
utilsres.cpp \ utilsres.cpp \

View File

@@ -4,7 +4,7 @@
// Author: Robert Roebling // Author: Robert Roebling
// Id: $Id$ // Id: $Id$
// Copyright: (c) 1998 Robert Roebling // Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence // Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__ #ifdef __GNUG__
@@ -22,39 +22,39 @@
// wxStaticLine // wxStaticLine
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxStaticLine,wxControl) IMPLEMENT_DYNAMIC_CLASS(wxStaticLine, wxControl)
wxStaticLine::wxStaticLine(void) wxStaticLine::wxStaticLine()
{ {
} }
wxStaticLine::wxStaticLine( wxWindow *parent, wxWindowID id, wxStaticLine::wxStaticLine( wxWindow *parent, wxWindowID id,
const wxPoint &pos, const wxSize &size, const wxPoint &pos, const wxSize &size,
long style, const wxString &name ) long style, const wxString &name )
{ {
Create( parent, id, pos, size, style, name ); Create( parent, id, pos, size, style, name );
} }
bool wxStaticLine::Create( wxWindow *parent, wxWindowID id, bool wxStaticLine::Create( wxWindow *parent, wxWindowID id,
const wxPoint &pos, const wxSize &size, const wxPoint &pos, const wxSize &size,
long style, const wxString &name ) long style, const wxString &name )
{ {
m_needParent = TRUE; m_needParent = TRUE;
PreCreation( parent, id, pos, size, style, name ); PreCreation( parent, id, pos, size, style, name );
if (style & wxVERTICAL) if ( IsVertical() )
m_widget = gtk_vseparator_new(); m_widget = gtk_vseparator_new();
else else
m_widget = gtk_hseparator_new(); m_widget = gtk_hseparator_new();
m_parent->DoAddChild( this ); m_parent->DoAddChild( this );
PostCreation(); PostCreation();
Show( TRUE ); Show( TRUE );
return TRUE; return TRUE;
} }
#endif #endif

View File

@@ -183,23 +183,23 @@ void debug_focus_in( GtkWidget* widget, const wxChar* name, const wxChar *window
void void
gdk_window_warp_pointer (GdkWindow *window, gdk_window_warp_pointer (GdkWindow *window,
gint x, gint x,
gint y) gint y)
{ {
GdkWindowPrivate *priv; GdkWindowPrivate *priv;
if (!window) if (!window)
window = (GdkWindow*) &gdk_root_parent; window = (GdkWindow*) &gdk_root_parent;
priv = (GdkWindowPrivate*) window; priv = (GdkWindowPrivate*) window;
if (!priv->destroyed) if (!priv->destroyed)
{ {
XWarpPointer (priv->xdisplay, XWarpPointer (priv->xdisplay,
None, /* not source window -> move from anywhere */ 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 */ 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 */ /* these functions are copied verbatim from GTK 1.2 */
static void static void
gdkx_XConvertCase (KeySym symbol, gdkx_XConvertCase (KeySym symbol,
KeySym *lower, KeySym *lower,
KeySym *upper) KeySym *upper)
{ {
register KeySym sym = symbol; register KeySym sym = symbol;
g_return_if_fail (lower != NULL); g_return_if_fail (lower != NULL);
g_return_if_fail (upper != NULL); g_return_if_fail (upper != NULL);
*lower = sym; *lower = sym;
*upper = sym; *upper = sym;
switch (sym >> 8) switch (sym >> 8)
{ {
#if defined (GDK_A) && defined (GDK_Ooblique) #if defined (GDK_A) && defined (GDK_Ooblique)
case 0: /* Latin 1 */ case 0: /* Latin 1 */
if ((sym >= GDK_A) && (sym <= GDK_Z)) 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)) 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)) 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)) 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)) 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)) else if ((sym >= GDK_oslash) && (sym <= GDK_thorn))
*upper -= (GDK_oslash - GDK_Ooblique); *upper -= (GDK_oslash - GDK_Ooblique);
break; break;
#endif /* LATIN1 */ #endif /* LATIN1 */
#if defined (GDK_Aogonek) && defined (GDK_tcedilla) #if defined (GDK_Aogonek) && defined (GDK_tcedilla)
case 1: /* Latin 2 */ case 1: /* Latin 2 */
/* Assume the KeySym is a legal value (ignore discontinuities) */ /* Assume the KeySym is a legal value (ignore discontinuities) */
if (sym == GDK_Aogonek) if (sym == GDK_Aogonek)
*lower = GDK_aogonek; *lower = GDK_aogonek;
else if (sym >= GDK_Lstroke && sym <= GDK_Sacute) 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) 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) else if (sym >= GDK_Zcaron && sym <= GDK_Zabovedot)
*lower += (GDK_zcaron - GDK_Zcaron); *lower += (GDK_zcaron - GDK_Zcaron);
else if (sym == GDK_aogonek) else if (sym == GDK_aogonek)
*upper = GDK_Aogonek; *upper = GDK_Aogonek;
else if (sym >= GDK_lstroke && sym <= GDK_sacute) 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) 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) 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) 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) else if (sym >= GDK_racute && sym <= GDK_tcedilla)
*upper -= (GDK_racute - GDK_Racute); *upper -= (GDK_racute - GDK_Racute);
break; break;
#endif /* LATIN2 */ #endif /* LATIN2 */
#if defined (GDK_Hstroke) && defined (GDK_Cabovedot) #if defined (GDK_Hstroke) && defined (GDK_Cabovedot)
case 2: /* Latin 3 */ case 2: /* Latin 3 */
/* Assume the KeySym is a legal value (ignore discontinuities) */ /* Assume the KeySym is a legal value (ignore discontinuities) */
if (sym >= GDK_Hstroke && sym <= GDK_Hcircumflex) 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) 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) 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) 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) 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) else if (sym >= GDK_cabovedot && sym <= GDK_scircumflex)
*upper -= (GDK_cabovedot - GDK_Cabovedot); *upper -= (GDK_cabovedot - GDK_Cabovedot);
break; break;
#endif /* LATIN3 */ #endif /* LATIN3 */
#if defined (GDK_Rcedilla) && defined (GDK_Amacron) #if defined (GDK_Rcedilla) && defined (GDK_Amacron)
case 3: /* Latin 4 */ case 3: /* Latin 4 */
/* Assume the KeySym is a legal value (ignore discontinuities) */ /* Assume the KeySym is a legal value (ignore discontinuities) */
if (sym >= GDK_Rcedilla && sym <= GDK_Tslash) 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) else if (sym >= GDK_rcedilla && sym <= GDK_tslash)
*upper -= (GDK_rcedilla - GDK_Rcedilla); *upper -= (GDK_rcedilla - GDK_Rcedilla);
else if (sym == GDK_ENG) else if (sym == GDK_ENG)
*lower = GDK_eng; *lower = GDK_eng;
else if (sym == GDK_eng) else if (sym == GDK_eng)
*upper = GDK_ENG; *upper = GDK_ENG;
else if (sym >= GDK_Amacron && sym <= GDK_Umacron) 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) else if (sym >= GDK_amacron && sym <= GDK_umacron)
*upper -= (GDK_amacron - GDK_Amacron); *upper -= (GDK_amacron - GDK_Amacron);
break; break;
#endif /* LATIN4 */ #endif /* LATIN4 */
#if defined (GDK_Serbian_DJE) && defined (GDK_Cyrillic_yu) #if defined (GDK_Serbian_DJE) && defined (GDK_Cyrillic_yu)
case 6: /* Cyrillic */ case 6: /* Cyrillic */
/* Assume the KeySym is a legal value (ignore discontinuities) */ /* Assume the KeySym is a legal value (ignore discontinuities) */
if (sym >= GDK_Serbian_DJE && sym <= GDK_Serbian_DZE) 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) 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) 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) 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; break;
#endif /* CYRILLIC */ #endif /* CYRILLIC */
#if defined (GDK_Greek_ALPHAaccent) && defined (GDK_Greek_finalsmallsigma) #if defined (GDK_Greek_ALPHAaccent) && defined (GDK_Greek_finalsmallsigma)
case 7: /* Greek */ case 7: /* Greek */
/* Assume the KeySym is a legal value (ignore discontinuities) */ /* Assume the KeySym is a legal value (ignore discontinuities) */
if (sym >= GDK_Greek_ALPHAaccent && sym <= GDK_Greek_OMEGAaccent) 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 && else if (sym >= GDK_Greek_alphaaccent && sym <= GDK_Greek_omegaaccent &&
sym != GDK_Greek_iotaaccentdieresis && sym != GDK_Greek_iotaaccentdieresis &&
sym != GDK_Greek_upsilonaccentdieresis) sym != GDK_Greek_upsilonaccentdieresis)
*upper -= (GDK_Greek_alphaaccent - GDK_Greek_ALPHAaccent); *upper -= (GDK_Greek_alphaaccent - GDK_Greek_ALPHAaccent);
else if (sym >= GDK_Greek_ALPHA && sym <= GDK_Greek_OMEGA) 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 && else if (sym >= GDK_Greek_alpha && sym <= GDK_Greek_omega &&
sym != GDK_Greek_finalsmallsigma) sym != GDK_Greek_finalsmallsigma)
*upper -= (GDK_Greek_alpha - GDK_Greek_ALPHA); *upper -= (GDK_Greek_alpha - GDK_Greek_ALPHA);
break; break;
#endif /* GREEK */ #endif /* GREEK */
} }
} }
static guint static guint
gdk_keyval_to_upper (guint keyval) gdk_keyval_to_upper (guint keyval)
{ {
if (keyval) if (keyval)
{ {
KeySym lower_val = 0; KeySym lower_val = 0;
KeySym upper_val = 0; KeySym upper_val = 0;
gdkx_XConvertCase (keyval, &lower_val, &upper_val); gdkx_XConvertCase (keyval, &lower_val, &upper_val);
return 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_Shift_R: key_code = WXK_SHIFT; break;
case GDK_Control_L: case GDK_Control_L:
case GDK_Control_R: key_code = WXK_CONTROL; break; case GDK_Control_R: key_code = WXK_CONTROL; break;
case GDK_Meta_L: case GDK_Meta_L:
case GDK_Meta_R: case GDK_Meta_R:
case GDK_Alt_L: case GDK_Alt_L:
case GDK_Alt_R: case GDK_Alt_R:
case GDK_Super_L: case GDK_Super_L:
case GDK_Super_R: key_code = WXK_ALT; break; case GDK_Super_R: key_code = WXK_ALT; break;
case GDK_Menu: key_code = WXK_MENU; break; case GDK_Menu: key_code = WXK_MENU; break;
case GDK_Help: key_code = WXK_HELP; break; case GDK_Help: key_code = WXK_HELP; break;
case GDK_BackSpace: key_code = WXK_BACK; 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_Subtract: key_code = WXK_NUMPAD_SUBTRACT; break;
case GDK_KP_Decimal: key_code = WXK_NUMPAD_DECIMAL; break; case GDK_KP_Decimal: key_code = WXK_NUMPAD_DECIMAL; break;
case GDK_KP_Divide: key_code = WXK_NUMPAD_DIVIDE; break; case GDK_KP_Divide: key_code = WXK_NUMPAD_DIVIDE; break;
case GDK_F1: key_code = WXK_F1; break; case GDK_F1: key_code = WXK_F1; break;
case GDK_F2: key_code = WXK_F2; break; case GDK_F2: key_code = WXK_F2; break;
case GDK_F3: key_code = WXK_F3; 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_Subtract: key_code = '-'; break;
case GDK_KP_Decimal: key_code = '.'; break; case GDK_KP_Decimal: key_code = '.'; break;
case GDK_KP_Divide: key_code = '/'; break; case GDK_KP_Divide: key_code = '/'; break;
case GDK_F1: key_code = WXK_F1; break; case GDK_F1: key_code = WXK_F1; break;
case GDK_F2: key_code = WXK_F2; break; case GDK_F2: key_code = WXK_F2; break;
case GDK_F3: key_code = WXK_F3; 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 ) static void gtk_window_draw_callback( GtkWidget *WXUNUSED(widget), GdkRectangle *rect, wxWindow *win )
{ {
if (g_isIdle) if (g_isIdle)
wxapp_install_idle_handler(); wxapp_install_idle_handler();
if (!win->m_hasVMT) 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 ) static gint gtk_window_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_event, wxWindow *win )
{ {
if (g_isIdle) if (g_isIdle)
wxapp_install_idle_handler(); wxapp_install_idle_handler();
if (!win->m_hasVMT) return FALSE; 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); 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 ); long key_code = map_to_unmodified_wx_keysym( gdk_event->keyval );
/* sending unknown key events doesn't really make sense */ /* sending unknown key events doesn't really make sense */
if (key_code == 0) return FALSE; if (key_code == 0) return FALSE;
bool ret = FALSE; bool ret = FALSE;
wxKeyEvent event( wxEVT_KEY_DOWN ); wxKeyEvent event( wxEVT_KEY_DOWN );
event.SetTimestamp( gdk_event->time ); event.SetTimestamp( gdk_event->time );
event.m_shiftDown = (gdk_event->state & GDK_SHIFT_MASK); event.m_shiftDown = (gdk_event->state & GDK_SHIFT_MASK);
event.m_controlDown = (gdk_event->state & GDK_CONTROL_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.m_y = y;
event.SetEventObject( win ); event.SetEventObject( win );
ret = win->GetEventHandler()->ProcessEvent( event ); ret = win->GetEventHandler()->ProcessEvent( event );
key_code = map_to_wx_keysym( gdk_event->keyval ); key_code = map_to_wx_keysym( gdk_event->keyval );
#if wxUSE_ACCEL #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. */ will only be sent if it is not a menu accelerator. */
if ((key_code != 0) && ! ret ) if ((key_code != 0) && ! ret )
{ {
wxKeyEvent event2( wxEVT_CHAR ); wxKeyEvent event2( wxEVT_CHAR );
event2.SetTimestamp( gdk_event->time ); event2.SetTimestamp( gdk_event->time );
event2.m_shiftDown = (gdk_event->state & GDK_SHIFT_MASK); event2.m_shiftDown = (gdk_event->state & GDK_SHIFT_MASK);
event2.m_controlDown = (gdk_event->state & GDK_CONTROL_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 ); new_event.SetEventObject( win );
ret = win->GetEventHandler()->ProcessEvent( new_event ); ret = win->GetEventHandler()->ProcessEvent( new_event );
} }
#if (GTK_MINOR_VERSION > 0) #if (GTK_MINOR_VERSION > 0)
/* pressing F10 will activate the menu bar of the top frame */ /* pressing F10 will activate the menu bar of the top frame */
if ( (!ret) && if ( (!ret) &&
@@ -828,22 +828,22 @@ static gint gtk_window_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_e
while (ancestor) while (ancestor)
{ {
if (wxIsKindOf(ancestor,wxFrame)) if (wxIsKindOf(ancestor,wxFrame))
{ {
wxFrame *frame = (wxFrame*) ancestor; wxFrame *frame = (wxFrame*) ancestor;
wxMenuBar *menubar = frame->GetMenuBar(); wxMenuBar *menubar = frame->GetMenuBar();
if (menubar) if (menubar)
{ {
wxNode *node = menubar->GetMenus().First(); wxNode *node = menubar->GetMenus().First();
if (node) if (node)
{ {
// doesn't work correctly // doesn't work correctly
// wxMenu *firstMenu = (wxMenu*) node->Data(); // wxMenu *firstMenu = (wxMenu*) node->Data();
// gtk_menu_item_select( GTK_MENU_ITEM(firstMenu->m_owner) ); // gtk_menu_item_select( GTK_MENU_ITEM(firstMenu->m_owner) );
// ret = TRUE; // ret = TRUE;
break; break;
} }
} }
} }
ancestor = ancestor->GetParent(); 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 ) static gint gtk_window_key_release_callback( GtkWidget *widget, GdkEventKey *gdk_event, wxWindow *win )
{ {
if (g_isIdle) if (g_isIdle)
wxapp_install_idle_handler(); wxapp_install_idle_handler();
if (!win->m_hasVMT) return FALSE; 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 ); long key_code = map_to_unmodified_wx_keysym( gdk_event->keyval );
/* sending unknown key events doesn't really make sense */ /* sending unknown key events doesn't really make sense */
if (key_code == 0) return FALSE; 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 ) static gint gtk_window_button_press_callback( GtkWidget *widget, GdkEventButton *gdk_event, wxWindow *win )
{ {
if (g_isIdle) if (g_isIdle)
wxapp_install_idle_handler(); 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 ) static gint gtk_window_button_release_callback( GtkWidget *widget, GdkEventButton *gdk_event, wxWindow *win )
{ {
if (g_isIdle) if (g_isIdle)
wxapp_install_idle_handler(); wxapp_install_idle_handler();
if (!win->m_hasVMT) return FALSE; 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 ) static gint gtk_window_motion_notify_callback( GtkWidget *widget, GdkEventMotion *gdk_event, wxWindow *win )
{ {
if (g_isIdle) if (g_isIdle)
wxapp_install_idle_handler(); wxapp_install_idle_handler();
if (!win->m_hasVMT) return FALSE; 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 ) static gint gtk_window_focus_in_callback( GtkWidget *widget, GdkEvent *WXUNUSED(event), wxWindow *win )
{ {
if (g_isIdle) if (g_isIdle)
wxapp_install_idle_handler(); wxapp_install_idle_handler();
if (!win->m_hasVMT) return FALSE; 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 ) static gint gtk_window_focus_out_callback( GtkWidget *widget, GdkEvent *WXUNUSED(event), wxWindow *win )
{ {
if (g_isIdle) if (g_isIdle)
wxapp_install_idle_handler(); wxapp_install_idle_handler();
if (!win->m_hasVMT) return FALSE; 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 ) static gint gtk_window_enter_callback( GtkWidget *widget, GdkEventCrossing *gdk_event, wxWindow *win )
{ {
if (g_isIdle) if (g_isIdle)
wxapp_install_idle_handler(); wxapp_install_idle_handler();
if (!win->m_hasVMT) return FALSE; 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 ) static gint gtk_window_leave_callback( GtkWidget *widget, GdkEventCrossing *gdk_event, wxWindow *win )
{ {
if (g_isIdle) if (g_isIdle)
wxapp_install_idle_handler(); wxapp_install_idle_handler();
if (!win->m_hasVMT) return FALSE; if (!win->m_hasVMT) return FALSE;
if (g_blockEventsOnDrag) return FALSE; if (g_blockEventsOnDrag) return FALSE;
if (!win->IsOwnGtkWindow( gdk_event->window )) return FALSE; if (!win->IsOwnGtkWindow( gdk_event->window )) return FALSE;
wxMouseEvent event( wxEVT_LEAVE_WINDOW ); wxMouseEvent event( wxEVT_LEAVE_WINDOW );
#if (GTK_MINOR_VERSION > 0) #if (GTK_MINOR_VERSION > 0)
event.SetTimestamp( gdk_event->time ); 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 ) static void gtk_window_vscroll_callback( GtkWidget *WXUNUSED(widget), wxWindow *win )
{ {
if (g_isIdle) if (g_isIdle)
wxapp_install_idle_handler(); wxapp_install_idle_handler();
if (g_blockEventsOnDrag) return; 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 ) static void gtk_window_hscroll_callback( GtkWidget *WXUNUSED(widget), wxWindow *win )
{ {
if (g_isIdle) if (g_isIdle)
wxapp_install_idle_handler(); wxapp_install_idle_handler();
if (g_blockEventsOnDrag) return; 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 ) static void gtk_window_vscroll_change_callback( GtkWidget *WXUNUSED(widget), wxWindow *win )
{ {
if (g_isIdle) if (g_isIdle)
wxapp_install_idle_handler(); wxapp_install_idle_handler();
if (g_blockEventsOnDrag) return; 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 ) static void gtk_window_hscroll_change_callback( GtkWidget *WXUNUSED(widget), wxWindow *win )
{ {
if (g_isIdle) if (g_isIdle)
wxapp_install_idle_handler(); wxapp_install_idle_handler();
if (g_blockEventsOnDrag) return; if (g_blockEventsOnDrag) return;
@@ -1624,7 +1624,7 @@ static gint gtk_scrollbar_button_press_callback( GtkRange *WXUNUSED(widget),
GdkEventButton *WXUNUSED(gdk_event), GdkEventButton *WXUNUSED(gdk_event),
wxWindow *win ) wxWindow *win )
{ {
if (g_isIdle) if (g_isIdle)
wxapp_install_idle_handler(); wxapp_install_idle_handler();
// don't test here as we can release the mouse while being over // don't test here as we can release the mouse while being over
@@ -1683,7 +1683,7 @@ wxWindow *wxWindowBase::FindFocus()
static gint static gint
gtk_window_realized_callback( GtkWidget * WXUNUSED(widget), wxWindow *win ) gtk_window_realized_callback( GtkWidget * WXUNUSED(widget), wxWindow *win )
{ {
if (g_isIdle) if (g_isIdle)
wxapp_install_idle_handler(); wxapp_install_idle_handler();
if (win->m_delayedFont) if (win->m_delayedFont)
@@ -1696,7 +1696,7 @@ gtk_window_realized_callback( GtkWidget * WXUNUSED(widget), wxWindow *win )
win->SetForegroundColour( win->GetForegroundColour() ); win->SetForegroundColour( win->GetForegroundColour() );
win->SetCursor( win->GetCursor() ); win->SetCursor( win->GetCursor() );
wxWindowCreateEvent event( win ); wxWindowCreateEvent event( win );
event.SetEventObject( win ); event.SetEventObject( win );
win->GetEventHandler()->ProcessEvent( event ); win->GetEventHandler()->ProcessEvent( event );
@@ -1962,25 +1962,25 @@ wxWindow::~wxWindow()
if (m_widgetStyle) if (m_widgetStyle)
{ {
gtk_style_unref( m_widgetStyle ); gtk_style_unref( m_widgetStyle );
m_widgetStyle = (GtkStyle*) NULL; m_widgetStyle = (GtkStyle*) NULL;
} }
if (m_scrollGC) if (m_scrollGC)
{ {
gdk_gc_unref( m_scrollGC ); gdk_gc_unref( m_scrollGC );
m_scrollGC = (GdkGC*) NULL; m_scrollGC = (GdkGC*) NULL;
} }
if (m_wxwindow) if (m_wxwindow)
{ {
gtk_widget_destroy( m_wxwindow ); gtk_widget_destroy( m_wxwindow );
m_wxwindow = (GtkWidget*) NULL; m_wxwindow = (GtkWidget*) NULL;
} }
if (m_widget) if (m_widget)
{ {
gtk_widget_destroy( 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 /* we cannot set colours, fonts and cursors before the widget has
been realized, so we do this directly after realization */ been realized, so we do this directly after realization */
gtk_signal_connect( GTK_OBJECT(connect_widget), "realize", 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; 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; if ((m_maxHeight != -1) && (m_height > m_maxHeight)) m_height = m_maxHeight;
int border = 0; int border = 0;
int bottom_border = 0; int bottom_border = 0;
if (GTK_WIDGET_CAN_DEFAULT(m_widget)) if (GTK_WIDGET_CAN_DEFAULT(m_widget))
{ {
/* the default button has a border around it */ /* the default button has a border around it */
border = 6; border = 6;
bottom_border = 5; bottom_border = 5;
} }
/* this is the result of hours of debugging: the following code /* 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 means that if we have a m_wxwindow and we set the size of
m_widget, m_widget (which is a GtkScrolledWindow) does NOT m_widget, m_widget (which is a GtkScrolledWindow) does NOT
automatically propagate its size down to its m_wxwindow, automatically propagate its size down to its m_wxwindow,
which is its client area. therefore, we have to tell the which is its client area. therefore, we have to tell the
client area directly that it has to resize itself. client area directly that it has to resize itself.
this will lead to that m_widget (GtkScrolledWindow) will this will lead to that m_widget (GtkScrolledWindow) will
calculate how much size it needs for scrollbars etc and calculate how much size it needs for scrollbars etc and
it will then call XXX_size_allocate of its child, which it will then call XXX_size_allocate of its child, which
is m_wxwindow. m_wxwindow in turn will do the same with its is m_wxwindow. m_wxwindow in turn will do the same with its
children and so on. problems can arise if this happens children and so on. problems can arise if this happens
before all the children have been realized as some widgets before all the children have been realized as some widgets
stupidy need to be realized during XXX_size_allocate (e.g. stupidy need to be realized during XXX_size_allocate (e.g.
GtkNotebook) and they will segv if called otherwise. this GtkNotebook) and they will segv if called otherwise. this
emergency is tested in gtk_myfixed_size_allocate. Normally emergency is tested in gtk_myfixed_size_allocate. Normally
this shouldn't be needed and only gtk_widget_queue_resize() this shouldn't be needed and only gtk_widget_queue_resize()
should be enough to provoke a resize at the next appropriate should be enough to provoke a resize at the next appropriate
moment, but this seems to fail, e.g. when a wxNotebook contains moment, but this seems to fail, e.g. when a wxNotebook contains
a wxSplitterWindow: the splitter window's children won't a wxSplitterWindow: the splitter window's children won't
show up properly resized then. */ show up properly resized then. */
gtk_myfixed_set_size( GTK_MYFIXED(m_parent->m_wxwindow), gtk_myfixed_set_size( GTK_MYFIXED(m_parent->m_wxwindow),
m_widget, m_widget,
m_x-border, m_x-border,
m_y-border, m_y-border,
m_width+2*border, m_width+2*border,
m_height+border+bottom_border ); m_height+border+bottom_border );
} }
m_sizeSet = TRUE; m_sizeSet = TRUE;
@@ -2196,13 +2196,13 @@ void wxWindow::OnInternalIdle()
{ {
wxCursor cursor = m_cursor; wxCursor cursor = m_cursor;
if (g_globalCursor.Ok()) cursor = g_globalCursor; if (g_globalCursor.Ok()) cursor = g_globalCursor;
if (cursor.Ok() && m_currentGdkCursor != cursor) if (cursor.Ok() && m_currentGdkCursor != cursor)
{ {
gdk_window_set_cursor( window, cursor.GetCursor() ); gdk_window_set_cursor( window, cursor.GetCursor() );
m_currentGdkCursor = cursor; m_currentGdkCursor = cursor;
} }
} }
UpdateWindowUI(); UpdateWindowUI();
} }
@@ -2513,7 +2513,7 @@ bool wxWindow::AcceptsFocus() const
bool wxWindow::Reparent( wxWindow *newParent ) bool wxWindow::Reparent( wxWindow *newParent )
{ {
wxCHECK_MSG( (m_widget != NULL), FALSE, _T("invalid window") ); wxCHECK_MSG( (m_widget != NULL), FALSE, _T("invalid window") );
wxWindow *oldParent = m_parent; wxWindow *oldParent = m_parent;
if ( !wxWindowBase::Reparent(newParent) ) if ( !wxWindowBase::Reparent(newParent) )
@@ -2523,27 +2523,27 @@ bool wxWindow::Reparent( wxWindow *newParent )
{ {
gtk_container_remove( GTK_CONTAINER(oldParent->m_wxwindow), m_widget ); gtk_container_remove( GTK_CONTAINER(oldParent->m_wxwindow), m_widget );
} }
if (newParent) if (newParent)
{ {
/* insert GTK representation */ /* insert GTK representation */
(*(newParent->m_insertCallback))(newParent, this); (*(newParent->m_insertCallback))(newParent, this);
} }
return TRUE; return TRUE;
} }
void wxWindow::DoAddChild(wxWindow *child) void wxWindow::DoAddChild(wxWindow *child)
{ {
wxASSERT_MSG( (m_widget != NULL), _T("invalid window") ); wxASSERT_MSG( (m_widget != NULL), _T("invalid window") );
wxASSERT_MSG( (child != NULL), _T("invalid child window") ); wxASSERT_MSG( (child != NULL), _T("invalid child window") );
wxASSERT_MSG( (m_insertCallback != NULL), _T("invalid child insertion function") ); wxASSERT_MSG( (m_insertCallback != NULL), _T("invalid child insertion function") );
/* add to list */ /* add to list */
AddChild( child ); AddChild( child );
/* insert GTK representation */ /* insert GTK representation */
(*m_insertCallback)(this, child); (*m_insertCallback)(this, child);
} }
@@ -2576,16 +2576,16 @@ bool wxWindow::SetCursor( const wxCursor &cursor )
// been realized // been realized
if (!m_delayedCursor) return FALSE; if (!m_delayedCursor) return FALSE;
} }
GtkWidget *connect_widget = GetConnectWidget(); GtkWidget *connect_widget = GetConnectWidget();
if (!connect_widget->window) if (!connect_widget->window)
{ {
// indicate that a new style has been set // indicate that a new style has been set
// but it couldn't get applied as the // but it couldn't get applied as the
// widget hasn't been realized yet. // widget hasn't been realized yet.
m_delayedCursor = TRUE; m_delayedCursor = TRUE;
// pretend we have done something // pretend we have done something
return TRUE; return TRUE;
} }
@@ -2603,7 +2603,7 @@ void wxWindow::WarpPointer( int x, int y )
if (connect_widget->window) if (connect_widget->window)
{ {
/* we provide this function ourselves as it is /* we provide this function ourselves as it is
missing in GDK */ missing in GDK */
gdk_window_warp_pointer( connect_widget->window, x, y ); gdk_window_warp_pointer( connect_widget->window, x, y );
} }
} }
@@ -2687,16 +2687,16 @@ bool wxWindow::SetBackgroundColour( const wxColour &colour )
// been realized // been realized
if (!m_delayedBackgroundColour) return FALSE; if (!m_delayedBackgroundColour) return FALSE;
} }
GtkWidget *connect_widget = GetConnectWidget(); GtkWidget *connect_widget = GetConnectWidget();
if (!connect_widget->window) if (!connect_widget->window)
{ {
// indicate that a new style has been set // indicate that a new style has been set
// but it couldn't get applied as the // but it couldn't get applied as the
// widget hasn't been realized yet. // widget hasn't been realized yet.
m_delayedBackgroundColour = TRUE; m_delayedBackgroundColour = TRUE;
// pretend we have done something // pretend we have done something
return TRUE; return TRUE;
} }
@@ -2734,16 +2734,16 @@ bool wxWindow::SetForegroundColour( const wxColour &colour )
// been realized // been realized
if (!m_delayedForegroundColour) return FALSE; if (!m_delayedForegroundColour) return FALSE;
} }
GtkWidget *connect_widget = GetConnectWidget(); GtkWidget *connect_widget = GetConnectWidget();
if (!connect_widget->window) if (!connect_widget->window)
{ {
// indicate that a new style has been set // indicate that a new style has been set
// but it couldn't get applied as the // but it couldn't get applied as the
// widget hasn't been realized yet. // widget hasn't been realized yet.
m_delayedForegroundColour = TRUE; m_delayedForegroundColour = TRUE;
// pretend we have done something // pretend we have done something
return TRUE; return TRUE;
} }
@@ -2890,7 +2890,7 @@ bool wxWindow::IsOwnGtkWindow( GdkWindow *window )
bool wxWindow::SetFont( const wxFont &font ) 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)) if (!wxWindowBase::SetFont(font))
{ {
@@ -2898,16 +2898,16 @@ bool wxWindow::SetFont( const wxFont &font )
// been realized // been realized
if (!m_delayedFont) return FALSE; if (!m_delayedFont) return FALSE;
} }
GtkWidget *connect_widget = GetConnectWidget(); GtkWidget *connect_widget = GetConnectWidget();
if (!connect_widget->window) if (!connect_widget->window)
{ {
// indicate that a new style has been set // indicate that a new style has been set
// but it couldn't get applied as the // but it couldn't get applied as the
// widget hasn't been realized yet. // widget hasn't been realized yet.
m_delayedFont = TRUE; m_delayedFont = TRUE;
// pretend we have done something // pretend we have done something
return TRUE; return TRUE;
} }
@@ -2934,7 +2934,7 @@ void wxWindow::CaptureMouse()
GtkWidget *connect_widget = GetConnectWidget(); GtkWidget *connect_widget = GetConnectWidget();
if (!connect_widget->window) return; if (!connect_widget->window) return;
gdk_pointer_grab( connect_widget->window, FALSE, gdk_pointer_grab( connect_widget->window, FALSE,
(GdkEventMask) (GdkEventMask)
(GDK_BUTTON_PRESS_MASK | (GDK_BUTTON_PRESS_MASK |
@@ -2954,7 +2954,7 @@ void wxWindow::ReleaseMouse()
GtkWidget *connect_widget = GetConnectWidget(); GtkWidget *connect_widget = GetConnectWidget();
if (!connect_widget->window) return; if (!connect_widget->window) return;
gdk_pointer_ungrab ( GDK_CURRENT_TIME ); gdk_pointer_ungrab ( GDK_CURRENT_TIME );
g_captureWindow = (wxWindow*) NULL; 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 ); m_scrollGC = gdk_gc_new( m_wxwindow->window );
gdk_gc_set_exposures( m_scrollGC, TRUE ); gdk_gc_set_exposures( m_scrollGC, TRUE );
} }
wxNode *node = m_children.First(); wxNode *node = m_children.First();
while (node) while (node)
{ {
wxWindow *child = (wxWindow*) node->Data(); wxWindow *child = (wxWindow*) node->Data();
int sx = 0; int sx = 0;
int sy = 0; int sy = 0;
child->GetSize( &sx, &sy ); child->GetSize( &sx, &sy );
child->SetSize( child->m_x + dx, child->m_y + dy, sx, sy, wxSIZE_ALLOW_MINUS_ONE ); child->SetSize( child->m_x + dx, child->m_y + dy, sx, sy, wxSIZE_ALLOW_MINUS_ONE );
node = node->Next(); node = node->Next();
} }
int cw = 0; int cw = 0;
@@ -3131,7 +3131,7 @@ void wxWindow::ScrollWindow( int dx, int dy, const wxRect* WXUNUSED(rect) )
GetClientSize( &cw, &ch ); GetClientSize( &cw, &ch );
int w = cw - abs(dx); int w = cw - abs(dx);
int h = ch - abs(dy); int h = ch - abs(dy);
if ((h < 0) || (w < 0)) if ((h < 0) || (w < 0))
{ {
Refresh(); Refresh();

View File

@@ -37,6 +37,7 @@ libwx_gtk_la_SOURCES = \
date.cpp \ date.cpp \
datstrm.cpp \ datstrm.cpp \
dcbase.cpp \ dcbase.cpp \
dlgcmn.cpp \
docmdi.cpp \ docmdi.cpp \
docview.cpp \ docview.cpp \
dynarray.cpp \ dynarray.cpp \
@@ -186,6 +187,7 @@ libwx_gtk_la_SOURCES = \
textctrl.cpp \ textctrl.cpp \
textdlg.cpp \ textdlg.cpp \
timer.cpp \ timer.cpp \
tipdlg.cpp \
tooltip.cpp \ tooltip.cpp \
utilsgtk.cpp \ utilsgtk.cpp \
utilsres.cpp \ utilsres.cpp \

View File

@@ -4,7 +4,7 @@
// Author: Robert Roebling // Author: Robert Roebling
// Id: $Id$ // Id: $Id$
// Copyright: (c) 1998 Robert Roebling // Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence // Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__ #ifdef __GNUG__
@@ -22,39 +22,39 @@
// wxStaticLine // wxStaticLine
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxStaticLine,wxControl) IMPLEMENT_DYNAMIC_CLASS(wxStaticLine, wxControl)
wxStaticLine::wxStaticLine(void) wxStaticLine::wxStaticLine()
{ {
} }
wxStaticLine::wxStaticLine( wxWindow *parent, wxWindowID id, wxStaticLine::wxStaticLine( wxWindow *parent, wxWindowID id,
const wxPoint &pos, const wxSize &size, const wxPoint &pos, const wxSize &size,
long style, const wxString &name ) long style, const wxString &name )
{ {
Create( parent, id, pos, size, style, name ); Create( parent, id, pos, size, style, name );
} }
bool wxStaticLine::Create( wxWindow *parent, wxWindowID id, bool wxStaticLine::Create( wxWindow *parent, wxWindowID id,
const wxPoint &pos, const wxSize &size, const wxPoint &pos, const wxSize &size,
long style, const wxString &name ) long style, const wxString &name )
{ {
m_needParent = TRUE; m_needParent = TRUE;
PreCreation( parent, id, pos, size, style, name ); PreCreation( parent, id, pos, size, style, name );
if (style & wxVERTICAL) if ( IsVertical() )
m_widget = gtk_vseparator_new(); m_widget = gtk_vseparator_new();
else else
m_widget = gtk_hseparator_new(); m_widget = gtk_hseparator_new();
m_parent->DoAddChild( this ); m_parent->DoAddChild( this );
PostCreation(); PostCreation();
Show( TRUE ); Show( TRUE );
return TRUE; return TRUE;
} }
#endif #endif

View File

@@ -183,23 +183,23 @@ void debug_focus_in( GtkWidget* widget, const wxChar* name, const wxChar *window
void void
gdk_window_warp_pointer (GdkWindow *window, gdk_window_warp_pointer (GdkWindow *window,
gint x, gint x,
gint y) gint y)
{ {
GdkWindowPrivate *priv; GdkWindowPrivate *priv;
if (!window) if (!window)
window = (GdkWindow*) &gdk_root_parent; window = (GdkWindow*) &gdk_root_parent;
priv = (GdkWindowPrivate*) window; priv = (GdkWindowPrivate*) window;
if (!priv->destroyed) if (!priv->destroyed)
{ {
XWarpPointer (priv->xdisplay, XWarpPointer (priv->xdisplay,
None, /* not source window -> move from anywhere */ 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 */ 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 */ /* these functions are copied verbatim from GTK 1.2 */
static void static void
gdkx_XConvertCase (KeySym symbol, gdkx_XConvertCase (KeySym symbol,
KeySym *lower, KeySym *lower,
KeySym *upper) KeySym *upper)
{ {
register KeySym sym = symbol; register KeySym sym = symbol;
g_return_if_fail (lower != NULL); g_return_if_fail (lower != NULL);
g_return_if_fail (upper != NULL); g_return_if_fail (upper != NULL);
*lower = sym; *lower = sym;
*upper = sym; *upper = sym;
switch (sym >> 8) switch (sym >> 8)
{ {
#if defined (GDK_A) && defined (GDK_Ooblique) #if defined (GDK_A) && defined (GDK_Ooblique)
case 0: /* Latin 1 */ case 0: /* Latin 1 */
if ((sym >= GDK_A) && (sym <= GDK_Z)) 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)) 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)) 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)) 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)) 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)) else if ((sym >= GDK_oslash) && (sym <= GDK_thorn))
*upper -= (GDK_oslash - GDK_Ooblique); *upper -= (GDK_oslash - GDK_Ooblique);
break; break;
#endif /* LATIN1 */ #endif /* LATIN1 */
#if defined (GDK_Aogonek) && defined (GDK_tcedilla) #if defined (GDK_Aogonek) && defined (GDK_tcedilla)
case 1: /* Latin 2 */ case 1: /* Latin 2 */
/* Assume the KeySym is a legal value (ignore discontinuities) */ /* Assume the KeySym is a legal value (ignore discontinuities) */
if (sym == GDK_Aogonek) if (sym == GDK_Aogonek)
*lower = GDK_aogonek; *lower = GDK_aogonek;
else if (sym >= GDK_Lstroke && sym <= GDK_Sacute) 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) 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) else if (sym >= GDK_Zcaron && sym <= GDK_Zabovedot)
*lower += (GDK_zcaron - GDK_Zcaron); *lower += (GDK_zcaron - GDK_Zcaron);
else if (sym == GDK_aogonek) else if (sym == GDK_aogonek)
*upper = GDK_Aogonek; *upper = GDK_Aogonek;
else if (sym >= GDK_lstroke && sym <= GDK_sacute) 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) 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) 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) 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) else if (sym >= GDK_racute && sym <= GDK_tcedilla)
*upper -= (GDK_racute - GDK_Racute); *upper -= (GDK_racute - GDK_Racute);
break; break;
#endif /* LATIN2 */ #endif /* LATIN2 */
#if defined (GDK_Hstroke) && defined (GDK_Cabovedot) #if defined (GDK_Hstroke) && defined (GDK_Cabovedot)
case 2: /* Latin 3 */ case 2: /* Latin 3 */
/* Assume the KeySym is a legal value (ignore discontinuities) */ /* Assume the KeySym is a legal value (ignore discontinuities) */
if (sym >= GDK_Hstroke && sym <= GDK_Hcircumflex) 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) 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) 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) 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) 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) else if (sym >= GDK_cabovedot && sym <= GDK_scircumflex)
*upper -= (GDK_cabovedot - GDK_Cabovedot); *upper -= (GDK_cabovedot - GDK_Cabovedot);
break; break;
#endif /* LATIN3 */ #endif /* LATIN3 */
#if defined (GDK_Rcedilla) && defined (GDK_Amacron) #if defined (GDK_Rcedilla) && defined (GDK_Amacron)
case 3: /* Latin 4 */ case 3: /* Latin 4 */
/* Assume the KeySym is a legal value (ignore discontinuities) */ /* Assume the KeySym is a legal value (ignore discontinuities) */
if (sym >= GDK_Rcedilla && sym <= GDK_Tslash) 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) else if (sym >= GDK_rcedilla && sym <= GDK_tslash)
*upper -= (GDK_rcedilla - GDK_Rcedilla); *upper -= (GDK_rcedilla - GDK_Rcedilla);
else if (sym == GDK_ENG) else if (sym == GDK_ENG)
*lower = GDK_eng; *lower = GDK_eng;
else if (sym == GDK_eng) else if (sym == GDK_eng)
*upper = GDK_ENG; *upper = GDK_ENG;
else if (sym >= GDK_Amacron && sym <= GDK_Umacron) 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) else if (sym >= GDK_amacron && sym <= GDK_umacron)
*upper -= (GDK_amacron - GDK_Amacron); *upper -= (GDK_amacron - GDK_Amacron);
break; break;
#endif /* LATIN4 */ #endif /* LATIN4 */
#if defined (GDK_Serbian_DJE) && defined (GDK_Cyrillic_yu) #if defined (GDK_Serbian_DJE) && defined (GDK_Cyrillic_yu)
case 6: /* Cyrillic */ case 6: /* Cyrillic */
/* Assume the KeySym is a legal value (ignore discontinuities) */ /* Assume the KeySym is a legal value (ignore discontinuities) */
if (sym >= GDK_Serbian_DJE && sym <= GDK_Serbian_DZE) 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) 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) 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) 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; break;
#endif /* CYRILLIC */ #endif /* CYRILLIC */
#if defined (GDK_Greek_ALPHAaccent) && defined (GDK_Greek_finalsmallsigma) #if defined (GDK_Greek_ALPHAaccent) && defined (GDK_Greek_finalsmallsigma)
case 7: /* Greek */ case 7: /* Greek */
/* Assume the KeySym is a legal value (ignore discontinuities) */ /* Assume the KeySym is a legal value (ignore discontinuities) */
if (sym >= GDK_Greek_ALPHAaccent && sym <= GDK_Greek_OMEGAaccent) 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 && else if (sym >= GDK_Greek_alphaaccent && sym <= GDK_Greek_omegaaccent &&
sym != GDK_Greek_iotaaccentdieresis && sym != GDK_Greek_iotaaccentdieresis &&
sym != GDK_Greek_upsilonaccentdieresis) sym != GDK_Greek_upsilonaccentdieresis)
*upper -= (GDK_Greek_alphaaccent - GDK_Greek_ALPHAaccent); *upper -= (GDK_Greek_alphaaccent - GDK_Greek_ALPHAaccent);
else if (sym >= GDK_Greek_ALPHA && sym <= GDK_Greek_OMEGA) 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 && else if (sym >= GDK_Greek_alpha && sym <= GDK_Greek_omega &&
sym != GDK_Greek_finalsmallsigma) sym != GDK_Greek_finalsmallsigma)
*upper -= (GDK_Greek_alpha - GDK_Greek_ALPHA); *upper -= (GDK_Greek_alpha - GDK_Greek_ALPHA);
break; break;
#endif /* GREEK */ #endif /* GREEK */
} }
} }
static guint static guint
gdk_keyval_to_upper (guint keyval) gdk_keyval_to_upper (guint keyval)
{ {
if (keyval) if (keyval)
{ {
KeySym lower_val = 0; KeySym lower_val = 0;
KeySym upper_val = 0; KeySym upper_val = 0;
gdkx_XConvertCase (keyval, &lower_val, &upper_val); gdkx_XConvertCase (keyval, &lower_val, &upper_val);
return 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_Shift_R: key_code = WXK_SHIFT; break;
case GDK_Control_L: case GDK_Control_L:
case GDK_Control_R: key_code = WXK_CONTROL; break; case GDK_Control_R: key_code = WXK_CONTROL; break;
case GDK_Meta_L: case GDK_Meta_L:
case GDK_Meta_R: case GDK_Meta_R:
case GDK_Alt_L: case GDK_Alt_L:
case GDK_Alt_R: case GDK_Alt_R:
case GDK_Super_L: case GDK_Super_L:
case GDK_Super_R: key_code = WXK_ALT; break; case GDK_Super_R: key_code = WXK_ALT; break;
case GDK_Menu: key_code = WXK_MENU; break; case GDK_Menu: key_code = WXK_MENU; break;
case GDK_Help: key_code = WXK_HELP; break; case GDK_Help: key_code = WXK_HELP; break;
case GDK_BackSpace: key_code = WXK_BACK; 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_Subtract: key_code = WXK_NUMPAD_SUBTRACT; break;
case GDK_KP_Decimal: key_code = WXK_NUMPAD_DECIMAL; break; case GDK_KP_Decimal: key_code = WXK_NUMPAD_DECIMAL; break;
case GDK_KP_Divide: key_code = WXK_NUMPAD_DIVIDE; break; case GDK_KP_Divide: key_code = WXK_NUMPAD_DIVIDE; break;
case GDK_F1: key_code = WXK_F1; break; case GDK_F1: key_code = WXK_F1; break;
case GDK_F2: key_code = WXK_F2; break; case GDK_F2: key_code = WXK_F2; break;
case GDK_F3: key_code = WXK_F3; 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_Subtract: key_code = '-'; break;
case GDK_KP_Decimal: key_code = '.'; break; case GDK_KP_Decimal: key_code = '.'; break;
case GDK_KP_Divide: key_code = '/'; break; case GDK_KP_Divide: key_code = '/'; break;
case GDK_F1: key_code = WXK_F1; break; case GDK_F1: key_code = WXK_F1; break;
case GDK_F2: key_code = WXK_F2; break; case GDK_F2: key_code = WXK_F2; break;
case GDK_F3: key_code = WXK_F3; 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 ) static void gtk_window_draw_callback( GtkWidget *WXUNUSED(widget), GdkRectangle *rect, wxWindow *win )
{ {
if (g_isIdle) if (g_isIdle)
wxapp_install_idle_handler(); wxapp_install_idle_handler();
if (!win->m_hasVMT) 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 ) static gint gtk_window_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_event, wxWindow *win )
{ {
if (g_isIdle) if (g_isIdle)
wxapp_install_idle_handler(); wxapp_install_idle_handler();
if (!win->m_hasVMT) return FALSE; 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); 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 ); long key_code = map_to_unmodified_wx_keysym( gdk_event->keyval );
/* sending unknown key events doesn't really make sense */ /* sending unknown key events doesn't really make sense */
if (key_code == 0) return FALSE; if (key_code == 0) return FALSE;
bool ret = FALSE; bool ret = FALSE;
wxKeyEvent event( wxEVT_KEY_DOWN ); wxKeyEvent event( wxEVT_KEY_DOWN );
event.SetTimestamp( gdk_event->time ); event.SetTimestamp( gdk_event->time );
event.m_shiftDown = (gdk_event->state & GDK_SHIFT_MASK); event.m_shiftDown = (gdk_event->state & GDK_SHIFT_MASK);
event.m_controlDown = (gdk_event->state & GDK_CONTROL_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.m_y = y;
event.SetEventObject( win ); event.SetEventObject( win );
ret = win->GetEventHandler()->ProcessEvent( event ); ret = win->GetEventHandler()->ProcessEvent( event );
key_code = map_to_wx_keysym( gdk_event->keyval ); key_code = map_to_wx_keysym( gdk_event->keyval );
#if wxUSE_ACCEL #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. */ will only be sent if it is not a menu accelerator. */
if ((key_code != 0) && ! ret ) if ((key_code != 0) && ! ret )
{ {
wxKeyEvent event2( wxEVT_CHAR ); wxKeyEvent event2( wxEVT_CHAR );
event2.SetTimestamp( gdk_event->time ); event2.SetTimestamp( gdk_event->time );
event2.m_shiftDown = (gdk_event->state & GDK_SHIFT_MASK); event2.m_shiftDown = (gdk_event->state & GDK_SHIFT_MASK);
event2.m_controlDown = (gdk_event->state & GDK_CONTROL_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 ); new_event.SetEventObject( win );
ret = win->GetEventHandler()->ProcessEvent( new_event ); ret = win->GetEventHandler()->ProcessEvent( new_event );
} }
#if (GTK_MINOR_VERSION > 0) #if (GTK_MINOR_VERSION > 0)
/* pressing F10 will activate the menu bar of the top frame */ /* pressing F10 will activate the menu bar of the top frame */
if ( (!ret) && if ( (!ret) &&
@@ -828,22 +828,22 @@ static gint gtk_window_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_e
while (ancestor) while (ancestor)
{ {
if (wxIsKindOf(ancestor,wxFrame)) if (wxIsKindOf(ancestor,wxFrame))
{ {
wxFrame *frame = (wxFrame*) ancestor; wxFrame *frame = (wxFrame*) ancestor;
wxMenuBar *menubar = frame->GetMenuBar(); wxMenuBar *menubar = frame->GetMenuBar();
if (menubar) if (menubar)
{ {
wxNode *node = menubar->GetMenus().First(); wxNode *node = menubar->GetMenus().First();
if (node) if (node)
{ {
// doesn't work correctly // doesn't work correctly
// wxMenu *firstMenu = (wxMenu*) node->Data(); // wxMenu *firstMenu = (wxMenu*) node->Data();
// gtk_menu_item_select( GTK_MENU_ITEM(firstMenu->m_owner) ); // gtk_menu_item_select( GTK_MENU_ITEM(firstMenu->m_owner) );
// ret = TRUE; // ret = TRUE;
break; break;
} }
} }
} }
ancestor = ancestor->GetParent(); 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 ) static gint gtk_window_key_release_callback( GtkWidget *widget, GdkEventKey *gdk_event, wxWindow *win )
{ {
if (g_isIdle) if (g_isIdle)
wxapp_install_idle_handler(); wxapp_install_idle_handler();
if (!win->m_hasVMT) return FALSE; 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 ); long key_code = map_to_unmodified_wx_keysym( gdk_event->keyval );
/* sending unknown key events doesn't really make sense */ /* sending unknown key events doesn't really make sense */
if (key_code == 0) return FALSE; 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 ) static gint gtk_window_button_press_callback( GtkWidget *widget, GdkEventButton *gdk_event, wxWindow *win )
{ {
if (g_isIdle) if (g_isIdle)
wxapp_install_idle_handler(); 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 ) static gint gtk_window_button_release_callback( GtkWidget *widget, GdkEventButton *gdk_event, wxWindow *win )
{ {
if (g_isIdle) if (g_isIdle)
wxapp_install_idle_handler(); wxapp_install_idle_handler();
if (!win->m_hasVMT) return FALSE; 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 ) static gint gtk_window_motion_notify_callback( GtkWidget *widget, GdkEventMotion *gdk_event, wxWindow *win )
{ {
if (g_isIdle) if (g_isIdle)
wxapp_install_idle_handler(); wxapp_install_idle_handler();
if (!win->m_hasVMT) return FALSE; 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 ) static gint gtk_window_focus_in_callback( GtkWidget *widget, GdkEvent *WXUNUSED(event), wxWindow *win )
{ {
if (g_isIdle) if (g_isIdle)
wxapp_install_idle_handler(); wxapp_install_idle_handler();
if (!win->m_hasVMT) return FALSE; 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 ) static gint gtk_window_focus_out_callback( GtkWidget *widget, GdkEvent *WXUNUSED(event), wxWindow *win )
{ {
if (g_isIdle) if (g_isIdle)
wxapp_install_idle_handler(); wxapp_install_idle_handler();
if (!win->m_hasVMT) return FALSE; 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 ) static gint gtk_window_enter_callback( GtkWidget *widget, GdkEventCrossing *gdk_event, wxWindow *win )
{ {
if (g_isIdle) if (g_isIdle)
wxapp_install_idle_handler(); wxapp_install_idle_handler();
if (!win->m_hasVMT) return FALSE; 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 ) static gint gtk_window_leave_callback( GtkWidget *widget, GdkEventCrossing *gdk_event, wxWindow *win )
{ {
if (g_isIdle) if (g_isIdle)
wxapp_install_idle_handler(); wxapp_install_idle_handler();
if (!win->m_hasVMT) return FALSE; if (!win->m_hasVMT) return FALSE;
if (g_blockEventsOnDrag) return FALSE; if (g_blockEventsOnDrag) return FALSE;
if (!win->IsOwnGtkWindow( gdk_event->window )) return FALSE; if (!win->IsOwnGtkWindow( gdk_event->window )) return FALSE;
wxMouseEvent event( wxEVT_LEAVE_WINDOW ); wxMouseEvent event( wxEVT_LEAVE_WINDOW );
#if (GTK_MINOR_VERSION > 0) #if (GTK_MINOR_VERSION > 0)
event.SetTimestamp( gdk_event->time ); 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 ) static void gtk_window_vscroll_callback( GtkWidget *WXUNUSED(widget), wxWindow *win )
{ {
if (g_isIdle) if (g_isIdle)
wxapp_install_idle_handler(); wxapp_install_idle_handler();
if (g_blockEventsOnDrag) return; 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 ) static void gtk_window_hscroll_callback( GtkWidget *WXUNUSED(widget), wxWindow *win )
{ {
if (g_isIdle) if (g_isIdle)
wxapp_install_idle_handler(); wxapp_install_idle_handler();
if (g_blockEventsOnDrag) return; 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 ) static void gtk_window_vscroll_change_callback( GtkWidget *WXUNUSED(widget), wxWindow *win )
{ {
if (g_isIdle) if (g_isIdle)
wxapp_install_idle_handler(); wxapp_install_idle_handler();
if (g_blockEventsOnDrag) return; 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 ) static void gtk_window_hscroll_change_callback( GtkWidget *WXUNUSED(widget), wxWindow *win )
{ {
if (g_isIdle) if (g_isIdle)
wxapp_install_idle_handler(); wxapp_install_idle_handler();
if (g_blockEventsOnDrag) return; if (g_blockEventsOnDrag) return;
@@ -1624,7 +1624,7 @@ static gint gtk_scrollbar_button_press_callback( GtkRange *WXUNUSED(widget),
GdkEventButton *WXUNUSED(gdk_event), GdkEventButton *WXUNUSED(gdk_event),
wxWindow *win ) wxWindow *win )
{ {
if (g_isIdle) if (g_isIdle)
wxapp_install_idle_handler(); wxapp_install_idle_handler();
// don't test here as we can release the mouse while being over // don't test here as we can release the mouse while being over
@@ -1683,7 +1683,7 @@ wxWindow *wxWindowBase::FindFocus()
static gint static gint
gtk_window_realized_callback( GtkWidget * WXUNUSED(widget), wxWindow *win ) gtk_window_realized_callback( GtkWidget * WXUNUSED(widget), wxWindow *win )
{ {
if (g_isIdle) if (g_isIdle)
wxapp_install_idle_handler(); wxapp_install_idle_handler();
if (win->m_delayedFont) if (win->m_delayedFont)
@@ -1696,7 +1696,7 @@ gtk_window_realized_callback( GtkWidget * WXUNUSED(widget), wxWindow *win )
win->SetForegroundColour( win->GetForegroundColour() ); win->SetForegroundColour( win->GetForegroundColour() );
win->SetCursor( win->GetCursor() ); win->SetCursor( win->GetCursor() );
wxWindowCreateEvent event( win ); wxWindowCreateEvent event( win );
event.SetEventObject( win ); event.SetEventObject( win );
win->GetEventHandler()->ProcessEvent( event ); win->GetEventHandler()->ProcessEvent( event );
@@ -1962,25 +1962,25 @@ wxWindow::~wxWindow()
if (m_widgetStyle) if (m_widgetStyle)
{ {
gtk_style_unref( m_widgetStyle ); gtk_style_unref( m_widgetStyle );
m_widgetStyle = (GtkStyle*) NULL; m_widgetStyle = (GtkStyle*) NULL;
} }
if (m_scrollGC) if (m_scrollGC)
{ {
gdk_gc_unref( m_scrollGC ); gdk_gc_unref( m_scrollGC );
m_scrollGC = (GdkGC*) NULL; m_scrollGC = (GdkGC*) NULL;
} }
if (m_wxwindow) if (m_wxwindow)
{ {
gtk_widget_destroy( m_wxwindow ); gtk_widget_destroy( m_wxwindow );
m_wxwindow = (GtkWidget*) NULL; m_wxwindow = (GtkWidget*) NULL;
} }
if (m_widget) if (m_widget)
{ {
gtk_widget_destroy( 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 /* we cannot set colours, fonts and cursors before the widget has
been realized, so we do this directly after realization */ been realized, so we do this directly after realization */
gtk_signal_connect( GTK_OBJECT(connect_widget), "realize", 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; 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; if ((m_maxHeight != -1) && (m_height > m_maxHeight)) m_height = m_maxHeight;
int border = 0; int border = 0;
int bottom_border = 0; int bottom_border = 0;
if (GTK_WIDGET_CAN_DEFAULT(m_widget)) if (GTK_WIDGET_CAN_DEFAULT(m_widget))
{ {
/* the default button has a border around it */ /* the default button has a border around it */
border = 6; border = 6;
bottom_border = 5; bottom_border = 5;
} }
/* this is the result of hours of debugging: the following code /* 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 means that if we have a m_wxwindow and we set the size of
m_widget, m_widget (which is a GtkScrolledWindow) does NOT m_widget, m_widget (which is a GtkScrolledWindow) does NOT
automatically propagate its size down to its m_wxwindow, automatically propagate its size down to its m_wxwindow,
which is its client area. therefore, we have to tell the which is its client area. therefore, we have to tell the
client area directly that it has to resize itself. client area directly that it has to resize itself.
this will lead to that m_widget (GtkScrolledWindow) will this will lead to that m_widget (GtkScrolledWindow) will
calculate how much size it needs for scrollbars etc and calculate how much size it needs for scrollbars etc and
it will then call XXX_size_allocate of its child, which it will then call XXX_size_allocate of its child, which
is m_wxwindow. m_wxwindow in turn will do the same with its is m_wxwindow. m_wxwindow in turn will do the same with its
children and so on. problems can arise if this happens children and so on. problems can arise if this happens
before all the children have been realized as some widgets before all the children have been realized as some widgets
stupidy need to be realized during XXX_size_allocate (e.g. stupidy need to be realized during XXX_size_allocate (e.g.
GtkNotebook) and they will segv if called otherwise. this GtkNotebook) and they will segv if called otherwise. this
emergency is tested in gtk_myfixed_size_allocate. Normally emergency is tested in gtk_myfixed_size_allocate. Normally
this shouldn't be needed and only gtk_widget_queue_resize() this shouldn't be needed and only gtk_widget_queue_resize()
should be enough to provoke a resize at the next appropriate should be enough to provoke a resize at the next appropriate
moment, but this seems to fail, e.g. when a wxNotebook contains moment, but this seems to fail, e.g. when a wxNotebook contains
a wxSplitterWindow: the splitter window's children won't a wxSplitterWindow: the splitter window's children won't
show up properly resized then. */ show up properly resized then. */
gtk_myfixed_set_size( GTK_MYFIXED(m_parent->m_wxwindow), gtk_myfixed_set_size( GTK_MYFIXED(m_parent->m_wxwindow),
m_widget, m_widget,
m_x-border, m_x-border,
m_y-border, m_y-border,
m_width+2*border, m_width+2*border,
m_height+border+bottom_border ); m_height+border+bottom_border );
} }
m_sizeSet = TRUE; m_sizeSet = TRUE;
@@ -2196,13 +2196,13 @@ void wxWindow::OnInternalIdle()
{ {
wxCursor cursor = m_cursor; wxCursor cursor = m_cursor;
if (g_globalCursor.Ok()) cursor = g_globalCursor; if (g_globalCursor.Ok()) cursor = g_globalCursor;
if (cursor.Ok() && m_currentGdkCursor != cursor) if (cursor.Ok() && m_currentGdkCursor != cursor)
{ {
gdk_window_set_cursor( window, cursor.GetCursor() ); gdk_window_set_cursor( window, cursor.GetCursor() );
m_currentGdkCursor = cursor; m_currentGdkCursor = cursor;
} }
} }
UpdateWindowUI(); UpdateWindowUI();
} }
@@ -2513,7 +2513,7 @@ bool wxWindow::AcceptsFocus() const
bool wxWindow::Reparent( wxWindow *newParent ) bool wxWindow::Reparent( wxWindow *newParent )
{ {
wxCHECK_MSG( (m_widget != NULL), FALSE, _T("invalid window") ); wxCHECK_MSG( (m_widget != NULL), FALSE, _T("invalid window") );
wxWindow *oldParent = m_parent; wxWindow *oldParent = m_parent;
if ( !wxWindowBase::Reparent(newParent) ) if ( !wxWindowBase::Reparent(newParent) )
@@ -2523,27 +2523,27 @@ bool wxWindow::Reparent( wxWindow *newParent )
{ {
gtk_container_remove( GTK_CONTAINER(oldParent->m_wxwindow), m_widget ); gtk_container_remove( GTK_CONTAINER(oldParent->m_wxwindow), m_widget );
} }
if (newParent) if (newParent)
{ {
/* insert GTK representation */ /* insert GTK representation */
(*(newParent->m_insertCallback))(newParent, this); (*(newParent->m_insertCallback))(newParent, this);
} }
return TRUE; return TRUE;
} }
void wxWindow::DoAddChild(wxWindow *child) void wxWindow::DoAddChild(wxWindow *child)
{ {
wxASSERT_MSG( (m_widget != NULL), _T("invalid window") ); wxASSERT_MSG( (m_widget != NULL), _T("invalid window") );
wxASSERT_MSG( (child != NULL), _T("invalid child window") ); wxASSERT_MSG( (child != NULL), _T("invalid child window") );
wxASSERT_MSG( (m_insertCallback != NULL), _T("invalid child insertion function") ); wxASSERT_MSG( (m_insertCallback != NULL), _T("invalid child insertion function") );
/* add to list */ /* add to list */
AddChild( child ); AddChild( child );
/* insert GTK representation */ /* insert GTK representation */
(*m_insertCallback)(this, child); (*m_insertCallback)(this, child);
} }
@@ -2576,16 +2576,16 @@ bool wxWindow::SetCursor( const wxCursor &cursor )
// been realized // been realized
if (!m_delayedCursor) return FALSE; if (!m_delayedCursor) return FALSE;
} }
GtkWidget *connect_widget = GetConnectWidget(); GtkWidget *connect_widget = GetConnectWidget();
if (!connect_widget->window) if (!connect_widget->window)
{ {
// indicate that a new style has been set // indicate that a new style has been set
// but it couldn't get applied as the // but it couldn't get applied as the
// widget hasn't been realized yet. // widget hasn't been realized yet.
m_delayedCursor = TRUE; m_delayedCursor = TRUE;
// pretend we have done something // pretend we have done something
return TRUE; return TRUE;
} }
@@ -2603,7 +2603,7 @@ void wxWindow::WarpPointer( int x, int y )
if (connect_widget->window) if (connect_widget->window)
{ {
/* we provide this function ourselves as it is /* we provide this function ourselves as it is
missing in GDK */ missing in GDK */
gdk_window_warp_pointer( connect_widget->window, x, y ); gdk_window_warp_pointer( connect_widget->window, x, y );
} }
} }
@@ -2687,16 +2687,16 @@ bool wxWindow::SetBackgroundColour( const wxColour &colour )
// been realized // been realized
if (!m_delayedBackgroundColour) return FALSE; if (!m_delayedBackgroundColour) return FALSE;
} }
GtkWidget *connect_widget = GetConnectWidget(); GtkWidget *connect_widget = GetConnectWidget();
if (!connect_widget->window) if (!connect_widget->window)
{ {
// indicate that a new style has been set // indicate that a new style has been set
// but it couldn't get applied as the // but it couldn't get applied as the
// widget hasn't been realized yet. // widget hasn't been realized yet.
m_delayedBackgroundColour = TRUE; m_delayedBackgroundColour = TRUE;
// pretend we have done something // pretend we have done something
return TRUE; return TRUE;
} }
@@ -2734,16 +2734,16 @@ bool wxWindow::SetForegroundColour( const wxColour &colour )
// been realized // been realized
if (!m_delayedForegroundColour) return FALSE; if (!m_delayedForegroundColour) return FALSE;
} }
GtkWidget *connect_widget = GetConnectWidget(); GtkWidget *connect_widget = GetConnectWidget();
if (!connect_widget->window) if (!connect_widget->window)
{ {
// indicate that a new style has been set // indicate that a new style has been set
// but it couldn't get applied as the // but it couldn't get applied as the
// widget hasn't been realized yet. // widget hasn't been realized yet.
m_delayedForegroundColour = TRUE; m_delayedForegroundColour = TRUE;
// pretend we have done something // pretend we have done something
return TRUE; return TRUE;
} }
@@ -2890,7 +2890,7 @@ bool wxWindow::IsOwnGtkWindow( GdkWindow *window )
bool wxWindow::SetFont( const wxFont &font ) 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)) if (!wxWindowBase::SetFont(font))
{ {
@@ -2898,16 +2898,16 @@ bool wxWindow::SetFont( const wxFont &font )
// been realized // been realized
if (!m_delayedFont) return FALSE; if (!m_delayedFont) return FALSE;
} }
GtkWidget *connect_widget = GetConnectWidget(); GtkWidget *connect_widget = GetConnectWidget();
if (!connect_widget->window) if (!connect_widget->window)
{ {
// indicate that a new style has been set // indicate that a new style has been set
// but it couldn't get applied as the // but it couldn't get applied as the
// widget hasn't been realized yet. // widget hasn't been realized yet.
m_delayedFont = TRUE; m_delayedFont = TRUE;
// pretend we have done something // pretend we have done something
return TRUE; return TRUE;
} }
@@ -2934,7 +2934,7 @@ void wxWindow::CaptureMouse()
GtkWidget *connect_widget = GetConnectWidget(); GtkWidget *connect_widget = GetConnectWidget();
if (!connect_widget->window) return; if (!connect_widget->window) return;
gdk_pointer_grab( connect_widget->window, FALSE, gdk_pointer_grab( connect_widget->window, FALSE,
(GdkEventMask) (GdkEventMask)
(GDK_BUTTON_PRESS_MASK | (GDK_BUTTON_PRESS_MASK |
@@ -2954,7 +2954,7 @@ void wxWindow::ReleaseMouse()
GtkWidget *connect_widget = GetConnectWidget(); GtkWidget *connect_widget = GetConnectWidget();
if (!connect_widget->window) return; if (!connect_widget->window) return;
gdk_pointer_ungrab ( GDK_CURRENT_TIME ); gdk_pointer_ungrab ( GDK_CURRENT_TIME );
g_captureWindow = (wxWindow*) NULL; 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 ); m_scrollGC = gdk_gc_new( m_wxwindow->window );
gdk_gc_set_exposures( m_scrollGC, TRUE ); gdk_gc_set_exposures( m_scrollGC, TRUE );
} }
wxNode *node = m_children.First(); wxNode *node = m_children.First();
while (node) while (node)
{ {
wxWindow *child = (wxWindow*) node->Data(); wxWindow *child = (wxWindow*) node->Data();
int sx = 0; int sx = 0;
int sy = 0; int sy = 0;
child->GetSize( &sx, &sy ); child->GetSize( &sx, &sy );
child->SetSize( child->m_x + dx, child->m_y + dy, sx, sy, wxSIZE_ALLOW_MINUS_ONE ); child->SetSize( child->m_x + dx, child->m_y + dy, sx, sy, wxSIZE_ALLOW_MINUS_ONE );
node = node->Next(); node = node->Next();
} }
int cw = 0; int cw = 0;
@@ -3131,7 +3131,7 @@ void wxWindow::ScrollWindow( int dx, int dy, const wxRect* WXUNUSED(rect) )
GetClientSize( &cw, &ch ); GetClientSize( &cw, &ch );
int w = cw - abs(dx); int w = cw - abs(dx);
int h = ch - abs(dy); int h = ch - abs(dy);
if ((h < 0) || (w < 0)) if ((h < 0) || (w < 0))
{ {
Refresh(); Refresh();

View File

@@ -51,6 +51,7 @@ libwx_msw_la_SOURCES = \
date.cpp \ date.cpp \
datstrm.cpp \ datstrm.cpp \
dcbase.cpp \ dcbase.cpp \
dlgcmn.cpp \
docmdi.cpp \ docmdi.cpp \
docview.cpp \ docview.cpp \
dynlib.cpp \ dynlib.cpp \
@@ -114,6 +115,7 @@ libwx_msw_la_SOURCES = \
statusbr.cpp \ statusbr.cpp \
tabg.cpp \ tabg.cpp \
textdlgg.cpp \ textdlgg.cpp \
tipdlg.cpp \
\ \
accel.cpp \ accel.cpp \
app.cpp \ app.cpp \

View File

@@ -38,8 +38,8 @@ class WXDLLEXPORT wxAcceleratorRefData: public wxObjectRefData
{ {
friend class WXDLLEXPORT wxAcceleratorTable; friend class WXDLLEXPORT wxAcceleratorTable;
public: public:
wxAcceleratorRefData(void); wxAcceleratorRefData();
~wxAcceleratorRefData(void); ~wxAcceleratorRefData();
inline HACCEL GetHACCEL() const { return m_hAccel; } inline HACCEL GetHACCEL() const { return m_hAccel; }
protected: protected:
@@ -132,13 +132,14 @@ wxAcceleratorTable::wxAcceleratorTable(int n, const wxAcceleratorEntry entries[]
M_ACCELDATA->m_ok = (M_ACCELDATA->m_hAccel != 0); M_ACCELDATA->m_ok = (M_ACCELDATA->m_hAccel != 0);
} }
#else #else // Win16
wxAcceleratorTable::wxAcceleratorTable(int WXUNUSED(n), const wxAcceleratorEntry WXUNUSED(entries)[]) 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)); return (M_ACCELDATA && (M_ACCELDATA->m_ok));
} }
@@ -158,3 +159,8 @@ WXHACCEL wxAcceleratorTable::GetHACCEL() const
return (WXHACCEL) M_ACCELDATA->m_hAccel; 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); }

View File

@@ -846,10 +846,7 @@ bool wxFrame::MSWTranslateMessage(WXMSG* pMsg)
return FALSE; return FALSE;
const wxAcceleratorTable& acceleratorTable = menuBar->GetAccelTable(); const wxAcceleratorTable& acceleratorTable = menuBar->GetAccelTable();
return acceleratorTable.Ok() && return acceleratorTable.Translate(this, pMsg);
::TranslateAccelerator(GetHwnd(),
GetTableHaccel(acceleratorTable),
(MSG *)pMsg);
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
@@ -863,7 +860,7 @@ bool wxFrame::HandlePaint()
{ {
if ( m_iconized ) if ( m_iconized )
{ {
HICON hIcon = m_icon.Ok() ? GetIconHicon(m_icon) HICON hIcon = m_icon.Ok() ? GetHiconOf(m_icon)
: (HICON)m_defaultIcon; : (HICON)m_defaultIcon;
// Hold a pointer to the dc so long as the OnPaint() message // 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: case WM_QUERYDRAGICON:
{ {
HICON hIcon = m_icon.Ok() ? GetIconHicon(m_icon) HICON hIcon = m_icon.Ok() ? GetHiconOf(m_icon)
: (HICON)(m_defaultIcon); : (HICON)(m_defaultIcon);
rc = (long)hIcon; rc = (long)hIcon;
processed = rc != 0; processed = rc != 0;

View File

@@ -86,6 +86,7 @@ GENERICOBJS= \
$(MSWDIR)\statusbr.obj \ $(MSWDIR)\statusbr.obj \
$(MSWDIR)\tabg.obj \ $(MSWDIR)\tabg.obj \
$(MSWDIR)\textdlgg.obj \ $(MSWDIR)\textdlgg.obj \
$(MSWDIR)\tipdlg.obj
# Not needed: # Not needed:
# $(MSWDIR)\colrdlgg.obj \ # $(MSWDIR)\colrdlgg.obj \
@@ -102,6 +103,7 @@ COMMONOBJS = \
$(MSWDIR)\config.obj \ $(MSWDIR)\config.obj \
$(MSWDIR)\cmndata.obj \ $(MSWDIR)\cmndata.obj \
$(MSWDIR)\dcbase.obj \ $(MSWDIR)\dcbase.obj \
$(MSWDIR)\dlgcmn.obj \
$(MSWDIR)\docview.obj \ $(MSWDIR)\docview.obj \
$(MSWDIR)\docmdi.obj \ $(MSWDIR)\docmdi.obj \
$(MSWDIR)\dynarray.obj \ $(MSWDIR)\dynarray.obj \
@@ -239,6 +241,7 @@ MSWOBJS = \
$(MSWDIR)\spinbutt.obj \ $(MSWDIR)\spinbutt.obj \
$(MSWDIR)\statbmp.obj \ $(MSWDIR)\statbmp.obj \
$(MSWDIR)\statbox.obj \ $(MSWDIR)\statbox.obj \
$(MSWDIR)\statline.obj \
$(MSWDIR)\stattext.obj \ $(MSWDIR)\stattext.obj \
$(MSWDIR)\statbr95.obj \ $(MSWDIR)\statbr95.obj \
$(MSWDIR)\tabctrl.obj \ $(MSWDIR)\tabctrl.obj \
@@ -445,6 +448,8 @@ $(MSWDIR)\statbmp.obj: $(MSWDIR)\statbmp.$(SRCSUFF)
$(MSWDIR)\statbox.obj: $(MSWDIR)\statbox.$(SRCSUFF) $(MSWDIR)\statbox.obj: $(MSWDIR)\statbox.$(SRCSUFF)
$(MSWDIR)\statline.obj: $(MSWDIR)\statline.$(SRCSUFF)
$(MSWDIR)\statbr95.obj: $(MSWDIR)\statbr95.$(SRCSUFF) $(MSWDIR)\statbr95.obj: $(MSWDIR)\statbr95.$(SRCSUFF)
$(MSWDIR)\stattext.obj: $(MSWDIR)\stattext.$(SRCSUFF) $(MSWDIR)\stattext.obj: $(MSWDIR)\stattext.$(SRCSUFF)
@@ -600,6 +605,8 @@ $(MSWDIR)\stream.obj: $(COMMDIR)\stream.$(SRCSUFF)
$(MSWDIR)\objstrm.obj: $(COMMDIR)\objstrm.$(SRCSUFF) $(MSWDIR)\objstrm.obj: $(COMMDIR)\objstrm.$(SRCSUFF)
$(MSWDIR)\dlgcmn.obj: $(COMMDIR)\dlgcmn.$(SRCSUFF)
$(MSWDIR)\wincmn.obj: $(COMMDIR)\wincmn.$(SRCSUFF) $(MSWDIR)\wincmn.obj: $(COMMDIR)\wincmn.$(SRCSUFF)
$(MSWDIR)\extended.obj: $(COMMDIR)\extended.c $(MSWDIR)\extended.obj: $(COMMDIR)\extended.c
@@ -668,6 +675,8 @@ $(MSWDIR)\statusbr.obj: $(GENDIR)\statusbr.$(SRCSUFF)
$(MSWDIR)\textdlgg.obj: $(GENDIR)\textdlgg.$(SRCSUFF) $(MSWDIR)\textdlgg.obj: $(GENDIR)\textdlgg.$(SRCSUFF)
$(MSWDIR)\tipdlg.obj: $(GENDIR)\tipdlg.$(SRCSUFF)
$(MSWDIR)\tabg.obj: $(GENDIR)\tabg.$(SRCSUFF) $(MSWDIR)\tabg.obj: $(GENDIR)\tabg.$(SRCSUFF)
all_utils: all_utils:

View File

@@ -89,6 +89,7 @@ GENERICOBJS= \
$(MSWDIR)\statusbr.obj \ $(MSWDIR)\statusbr.obj \
$(MSWDIR)\tabg.obj \ $(MSWDIR)\tabg.obj \
$(MSWDIR)\textdlgg.obj \ $(MSWDIR)\textdlgg.obj \
$(MSWDIR)\tipdlg.obj \
$(MSWDIR)\treectrl.obj $(MSWDIR)\treectrl.obj
# $(MSWDIR)\msgdlgg.obj \ # $(MSWDIR)\msgdlgg.obj \
@@ -144,6 +145,7 @@ COMMONOBJS = \
$(MSWDIR)\datstrm.obj \ $(MSWDIR)\datstrm.obj \
$(MSWDIR)\sckstrm.obj \ $(MSWDIR)\sckstrm.obj \
$(MSWDIR)\extended.obj \ $(MSWDIR)\extended.obj \
$(MSWDIR)\dlgcmn.obj \
$(MSWDIR)\wincmn.obj \ $(MSWDIR)\wincmn.obj \
$(MSWDIR)\objstrm.obj \ $(MSWDIR)\objstrm.obj \
$(MSWDIR)\dynlib.obj \ $(MSWDIR)\dynlib.obj \
@@ -230,6 +232,7 @@ MSWOBJS = \
$(MSWDIR)\spinbutt.obj \ $(MSWDIR)\spinbutt.obj \
$(MSWDIR)\statbmp.obj \ $(MSWDIR)\statbmp.obj \
$(MSWDIR)\statbox.obj \ $(MSWDIR)\statbox.obj \
$(MSWDIR)\statline.obj \
$(MSWDIR)\stattext.obj \ $(MSWDIR)\stattext.obj \
$(MSWDIR)\tbarmsw.obj \ $(MSWDIR)\tbarmsw.obj \
$(MSWDIR)\textctrl.obj \ $(MSWDIR)\textctrl.obj \
@@ -425,6 +428,8 @@ $(MSWDIR)\statbmp.obj: $(MSWDIR)\statbmp.$(SRCSUFF)
$(MSWDIR)\statbox.obj: $(MSWDIR)\statbox.$(SRCSUFF) $(MSWDIR)\statbox.obj: $(MSWDIR)\statbox.$(SRCSUFF)
$(MSWDIR)\statline.obj: $(MSWDIR)\statline.$(SRCSUFF)
$(MSWDIR)\statbr95.obj: $(MSWDIR)\statbr95.$(SRCSUFF) $(MSWDIR)\statbr95.obj: $(MSWDIR)\statbr95.$(SRCSUFF)
$(MSWDIR)\stattext.obj: $(MSWDIR)\stattext.$(SRCSUFF) $(MSWDIR)\stattext.obj: $(MSWDIR)\stattext.$(SRCSUFF)
@@ -572,6 +577,8 @@ $(MSWDIR)\stream.obj: $(COMMDIR)\stream.$(SRCSUFF)
$(MSWDIR)\objstrm.obj: $(COMMDIR)\objstrm.$(SRCSUFF) $(MSWDIR)\objstrm.obj: $(COMMDIR)\objstrm.$(SRCSUFF)
$(MSWDIR)\dlgcmn.obj: $(COMMDIR)\dlgcmn.$(SRCSUFF)
$(MSWDIR)\wincmn.obj: $(COMMDIR)\wincmn.$(SRCSUFF) $(MSWDIR)\wincmn.obj: $(COMMDIR)\wincmn.$(SRCSUFF)
$(MSWDIR)\extended.obj: $(COMMDIR)\extended.c $(MSWDIR)\extended.obj: $(COMMDIR)\extended.c
@@ -638,6 +645,8 @@ $(MSWDIR)\statusbr.obj: $(GENDIR)\statusbr.$(SRCSUFF)
$(MSWDIR)\textdlgg.obj: $(GENDIR)\textdlgg.$(SRCSUFF) $(MSWDIR)\textdlgg.obj: $(GENDIR)\textdlgg.$(SRCSUFF)
$(MSWDIR)\tipdlg.obj: $(GENDIR)\tipdlg.$(SRCSUFF)
$(MSWDIR)\tabg.obj: $(GENDIR)\tabg.$(SRCSUFF) $(MSWDIR)\tabg.obj: $(GENDIR)\tabg.$(SRCSUFF)
$(MSWDIR)\treectrl.obj: $(GENDIR)\treectrl.$(SRCSUFF) $(MSWDIR)\treectrl.obj: $(GENDIR)\treectrl.$(SRCSUFF)

View File

@@ -71,6 +71,7 @@ GENERICOBJS= \
$(GENDIR)\statusbr.obj \ $(GENDIR)\statusbr.obj \
$(GENDIR)\tabg.obj \ $(GENDIR)\tabg.obj \
$(GENDIR)\textdlgg.obj\ $(GENDIR)\textdlgg.obj\
$(GENDIR)\tipdlg.obj\
$(GENDIR)\prntdlgg.obj \ $(GENDIR)\prntdlgg.obj \
$(GENDIR)\treectrl.obj $(GENDIR)\treectrl.obj
@@ -128,6 +129,7 @@ COMMONOBJS = \
$(COMMDIR)\zstream.obj \ $(COMMDIR)\zstream.obj \
$(COMMDIR)\datstrm.obj \ $(COMMDIR)\datstrm.obj \
$(COMMDIR)\extended.obj \ $(COMMDIR)\extended.obj \
$(COMMDIR)\dlgcmn.obj \
$(COMMDIR)\wincmn.obj \ $(COMMDIR)\wincmn.obj \
$(COMMDIR)\wxchar.obj $(COMMDIR)\wxchar.obj
@@ -201,6 +203,7 @@ MSWOBJS = \
$(MSWDIR)\spinbutt.obj \ $(MSWDIR)\spinbutt.obj \
$(MSWDIR)\statbmp.obj \ $(MSWDIR)\statbmp.obj \
$(MSWDIR)\statbox.obj \ $(MSWDIR)\statbox.obj \
$(MSWDIR)\statline.obj \
$(MSWDIR)\stattext.obj \ $(MSWDIR)\stattext.obj \
$(MSWDIR)\tbarmsw.obj \ $(MSWDIR)\tbarmsw.obj \
$(MSWDIR)\textctrl.obj \ $(MSWDIR)\textctrl.obj \
@@ -610,6 +613,11 @@ $(MSWDIR)/statbox.obj: $*.$(SRCSUFF)
$(CPPFLAGS) /Fo$@ /c /Tp $*.$(SRCSUFF) $(CPPFLAGS) /Fo$@ /c /Tp $*.$(SRCSUFF)
<< <<
$(MSWDIR)/statline.obj: $*.$(SRCSUFF)
cl @<<
$(CPPFLAGS) /Fo$@ /c /Tp $*.$(SRCSUFF)
<<
$(MSWDIR)/stattext.obj: $*.$(SRCSUFF) $(MSWDIR)/stattext.obj: $*.$(SRCSUFF)
cl @<< cl @<<
$(CPPFLAGS) /Fo$@ /c /Tp $*.$(SRCSUFF) $(CPPFLAGS) /Fo$@ /c /Tp $*.$(SRCSUFF)
@@ -948,6 +956,11 @@ $(COMMDIR)/extended.obj: $*.c
$(CPPFLAGS2) /Fo$@ /c /Tp $*.c $(CPPFLAGS2) /Fo$@ /c /Tp $*.c
<< <<
$(COMMDIR)/dlgcmn.obj: $*.$(SRCSUFF)
cl @<<
$(CPPFLAGS) /Fo$@ /c /Tp $*.$(SRCSUFF)
<<
$(COMMDIR)/wincmn.obj: $*.$(SRCSUFF) $(COMMDIR)/wincmn.obj: $*.$(SRCSUFF)
cl @<< cl @<<
$(CPPFLAGS) /Fo$@ /c /Tp $*.$(SRCSUFF) $(CPPFLAGS) /Fo$@ /c /Tp $*.$(SRCSUFF)
@@ -1083,6 +1096,11 @@ $(GENDIR)/textdlgg.obj: $*.$(SRCSUFF)
$(CPPFLAGS) /Fo$@ /c /Tp $*.$(SRCSUFF) $(CPPFLAGS) /Fo$@ /c /Tp $*.$(SRCSUFF)
<< <<
$(GENDIR)/tipdlg.obj: $*.$(SRCSUFF)
cl @<<
$(CPPFLAGS) /Fo$@ /c /Tp $*.$(SRCSUFF)
<<
$(GENDIR)/treectrl.obj: $*.$(SRCSUFF) $(GENDIR)/treectrl.obj: $*.$(SRCSUFF)
cl @<< cl @<<
$(CPPFLAGS) /Fo$@ /c /Tp $*.$(SRCSUFF) $(CPPFLAGS) /Fo$@ /c /Tp $*.$(SRCSUFF)

View File

@@ -69,6 +69,7 @@ GENERICOBJS= \
$(GENDIR)/statusbr.$(OBJSUFF) \ $(GENDIR)/statusbr.$(OBJSUFF) \
$(GENDIR)/tabg.$(OBJSUFF) \ $(GENDIR)/tabg.$(OBJSUFF) \
$(GENDIR)/textdlgg.$(OBJSUFF) $(GENDIR)/textdlgg.$(OBJSUFF)
$(GENDIR)/tipdlg.$(OBJSUFF)
# $(GENDIR)/colrdlgg.$(OBJSUFF) \ # $(GENDIR)/colrdlgg.$(OBJSUFF) \
# $(GENDIR)/fontdlgg.$(OBJSUFF) \ # $(GENDIR)/fontdlgg.$(OBJSUFF) \
@@ -131,6 +132,7 @@ COMMONOBJS = \
$(COMMDIR)/datstrm.$(OBJSUFF) \ $(COMMDIR)/datstrm.$(OBJSUFF) \
$(COMMDIR)/objstrm.$(OBJSUFF) \ $(COMMDIR)/objstrm.$(OBJSUFF) \
$(COMMDIR)/extended.$(OBJSUFF) \ $(COMMDIR)/extended.$(OBJSUFF) \
$(COMMDIR)/dlgcmn.$(OBJSUFF) \
$(COMMDIR)/wincmn.$(OBJSUFF) \ $(COMMDIR)/wincmn.$(OBJSUFF) \
$(COMMDIR)/wxchar.$(OBJSUFF) $(COMMDIR)/wxchar.$(OBJSUFF)
@@ -214,6 +216,7 @@ MSWOBJS = \
spinbutt.$(OBJSUFF) \ spinbutt.$(OBJSUFF) \
statbmp.$(OBJSUFF) \ statbmp.$(OBJSUFF) \
statbox.$(OBJSUFF) \ statbox.$(OBJSUFF) \
statline.$(OBJSUFF) \
statbr95.$(OBJSUFF) \ statbr95.$(OBJSUFF) \
stattext.$(OBJSUFF) \ stattext.$(OBJSUFF) \
tabctrl.$(OBJSUFF) \ tabctrl.$(OBJSUFF) \

View File

@@ -35,7 +35,8 @@ GENERICOBJS= \
$(GENDIR)\splitter.obj \ $(GENDIR)\splitter.obj \
$(GENDIR)\statusbr.obj \ $(GENDIR)\statusbr.obj \
$(GENDIR)\tabg.obj \ $(GENDIR)\tabg.obj \
$(GENDIR)\textdlgg.obj $(GENDIR)\textdlgg.obj \
$(GENDIR)\tipdlg.obj
# $(GENDIR)\imaglist.obj \ # $(GENDIR)\imaglist.obj \
# $(GENDIR)\treectrl.obj \ # $(GENDIR)\treectrl.obj \
@@ -105,6 +106,7 @@ COMMONOBJS = \
$(COMMDIR)\datstrm.obj \ $(COMMDIR)\datstrm.obj \
$(COMMDIR)\objstrm.obj \ $(COMMDIR)\objstrm.obj \
$(COMMDIR)\variant.obj \ $(COMMDIR)\variant.obj \
$(COMMDIR)\dlgcmn.obj \
$(COMMDIR)\wincmn.obj \ $(COMMDIR)\wincmn.obj \
$(COMMDIR)\wxchar.obj $(COMMDIR)\wxchar.obj
@@ -189,6 +191,7 @@ MSWOBJS = \
$(MSWDIR)\spinbutt.obj \ $(MSWDIR)\spinbutt.obj \
$(MSWDIR)\statbmp.obj \ $(MSWDIR)\statbmp.obj \
$(MSWDIR)\statbox.obj \ $(MSWDIR)\statbox.obj \
$(MSWDIR)\statline.obj \
$(MSWDIR)\statbr95.obj \ $(MSWDIR)\statbr95.obj \
$(MSWDIR)\stattext.obj \ $(MSWDIR)\stattext.obj \
$(MSWDIR)\tabctrl.obj \ $(MSWDIR)\tabctrl.obj \

View File

@@ -79,7 +79,8 @@ GENERICOBJS= \
..\generic\$D\splitter.obj \ ..\generic\$D\splitter.obj \
..\generic\$D\statusbr.obj \ ..\generic\$D\statusbr.obj \
..\generic\$D\tabg.obj \ ..\generic\$D\tabg.obj \
..\generic\$D\textdlgg.obj ..\generic\$D\textdlgg.obj \
..\generic\$D\tipdlg.obj
# ..\generic\$D\imaglist.obj \ # ..\generic\$D\imaglist.obj \
# ..\generic\$D\treectrl.obj \ # ..\generic\$D\treectrl.obj \
@@ -165,6 +166,7 @@ COMMONOBJS = \
..\common\$D\datstrm.obj \ ..\common\$D\datstrm.obj \
..\common\$D\objstrm.obj \ ..\common\$D\objstrm.obj \
..\common\$D\variant.obj \ ..\common\$D\variant.obj \
..\common\$D\dlgcmn.obj \
..\common\$D\wincmn.obj \ ..\common\$D\wincmn.obj \
..\common\$D\wxchar.obj ..\common\$D\wxchar.obj
@@ -240,6 +242,7 @@ MSWOBJS = \
..\msw\$D\spinbutt.obj \ ..\msw\$D\spinbutt.obj \
..\msw\$D\statbmp.obj \ ..\msw\$D\statbmp.obj \
..\msw\$D\statbox.obj \ ..\msw\$D\statbox.obj \
..\msw\$D\statline.obj \
..\msw\$D\statbr95.obj \ ..\msw\$D\statbr95.obj \
..\msw\$D\stattext.obj \ ..\msw\$D\stattext.obj \
..\msw\$D\tabctrl.obj \ ..\msw\$D\tabctrl.obj \

View File

@@ -39,7 +39,8 @@ GENERICOBJS= choicdgg.obj &
splitter.obj & splitter.obj &
statusbr.obj & statusbr.obj &
tabg.obj & tabg.obj &
textdlgg.obj textdlgg.obj &
tipdlg.obj
# These are generic things that don't need to be compiled on MSW, # These are generic things that don't need to be compiled on MSW,
# but sometimes it's useful to do so for testing purposes. # but sometimes it's useful to do so for testing purposes.
@@ -112,6 +113,7 @@ COMMONOBJS = cmndata.obj &
datstrm.obj & datstrm.obj &
objstrm.obj & objstrm.obj &
variant.obj & variant.obj &
dlgcmn.obj &
wincmn.obj & wincmn.obj &
wxchar.obj wxchar.obj
@@ -191,6 +193,7 @@ MSWOBJS = &
spinbutt.obj & spinbutt.obj &
statbmp.obj & statbmp.obj &
statbox.obj & statbox.obj &
statline.obj &
statbr95.obj & statbr95.obj &
stattext.obj & stattext.obj &
tabctrl.obj & tabctrl.obj &
@@ -453,6 +456,9 @@ statbmp.obj: $(MSWDIR)\statbmp.cpp
statbox.obj: $(MSWDIR)\statbox.cpp statbox.obj: $(MSWDIR)\statbox.cpp
*$(CCC) $(CPPFLAGS) $(IFLAGS) $< *$(CCC) $(CPPFLAGS) $(IFLAGS) $<
statline.obj: $(MSWDIR)\statline.cpp
*$(CCC) $(CPPFLAGS) $(IFLAGS) $<
statbr95.obj: $(MSWDIR)\statbr95.cpp statbr95.obj: $(MSWDIR)\statbr95.cpp
*$(CCC) $(CPPFLAGS) $(IFLAGS) $< *$(CCC) $(CPPFLAGS) $(IFLAGS) $<
@@ -720,6 +726,9 @@ process.obj: $(COMMDIR)\process.cpp
variant.obj: $(COMMDIR)\variant.cpp variant.obj: $(COMMDIR)\variant.cpp
*$(CCC) $(CPPFLAGS) $(IFLAGS) $< *$(CCC) $(CPPFLAGS) $(IFLAGS) $<
dlgcmn.obj: $(COMMDIR)\dlgcmn.cpp
*$(CCC) $(CPPFLAGS) $(IFLAGS) $<
wincmn.obj: $(COMMDIR)\wincmn.cpp wincmn.obj: $(COMMDIR)\wincmn.cpp
*$(CCC) $(CPPFLAGS) $(IFLAGS) $< *$(CCC) $(CPPFLAGS) $(IFLAGS) $<
@@ -801,6 +810,9 @@ tabg.obj: $(GENDIR)\tabg.cpp
textdlgg.obj: $(GENDIR)\textdlgg.cpp textdlgg.obj: $(GENDIR)\textdlgg.cpp
*$(CCC) $(CPPFLAGS) $(IFLAGS) $< *$(CCC) $(CPPFLAGS) $(IFLAGS) $<
tipdlg.obj: $(GENDIR)\tipdlg.cpp
*$(CCC) $(CPPFLAGS) $(IFLAGS) $<
crbuffri.obj: $(XPMDIR)\crbuffri.c crbuffri.obj: $(XPMDIR)\crbuffri.c
*$(CC) $(CPPFLAGS) $(IFLAGS) $< *$(CC) $(CPPFLAGS) $(IFLAGS) $<

View File

@@ -537,10 +537,7 @@ bool wxMDIParentFrame::MSWTranslateMessage(WXMSG* msg)
return TRUE; return TRUE;
} }
if ( m_acceleratorTable.Ok() && if ( m_acceleratorTable.Translate(this, msg) )
::TranslateAccelerator(GetHwnd(),
GetTableHaccel(m_acceleratorTable),
pMsg) )
{ {
return TRUE; return TRUE;
} }
@@ -993,15 +990,7 @@ long wxMDIChildFrame::MSWDefWindowProc(WXUINT message, WXUINT wParam, WXLPARAM l
bool wxMDIChildFrame::MSWTranslateMessage(WXMSG* msg) bool wxMDIChildFrame::MSWTranslateMessage(WXMSG* msg)
{ {
MSG *pMsg = (MSG *)msg; return m_acceleratorTable.Translate(GetParent(), msg);
if ( m_acceleratorTable.Ok() )
{
return ::TranslateAccelerator(GetWinHwnd(GetParent()),
GetTableHaccel(m_acceleratorTable),
pMsg) != 0;
}
return FALSE;
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------

View File

@@ -69,10 +69,6 @@ static const int idMenuTitle = -2;
IMPLEMENT_DYNAMIC_CLASS(wxMenuBar, wxEvtHandler) IMPLEMENT_DYNAMIC_CLASS(wxMenuBar, wxEvtHandler)
#endif #endif
// convenience macros
#define GetHMENU() ((HMENU)GetHMenu())
#define GetHMenuOf(menu) ((HMENU)menu->GetHMenu())
// ============================================================================ // ============================================================================
// implementation // implementation
// ============================================================================ // ============================================================================
@@ -257,7 +253,7 @@ void wxMenu::Append(wxMenuItem *pItem)
pData = label; pData = label;
} }
if ( !::AppendMenu(GetHMENU(), flags, id, pData) ) if ( !::AppendMenu(GetHmenu(), flags, id, pData) )
{ {
wxLogLastError("AppendMenu"); wxLogLastError("AppendMenu");
} }
@@ -272,7 +268,7 @@ void wxMenu::Append(wxMenuItem *pItem)
mii.fMask = MIIM_STATE; mii.fMask = MIIM_STATE;
mii.fState = MFS_DEFAULT; mii.fState = MFS_DEFAULT;
if ( !SetMenuItemInfo(GetHMENU(), (unsigned)id, FALSE, &mii) ) if ( !SetMenuItemInfo(GetHmenu(), (unsigned)id, FALSE, &mii) )
{ {
wxLogLastError(_T("SetMenuItemInfo")); wxLogLastError(_T("SetMenuItemInfo"));
} }
@@ -323,7 +319,7 @@ void wxMenu::Delete(int id)
wxCHECK_RET( node, _T("wxMenu::Delete(): item doesn't exist") ); wxCHECK_RET( node, _T("wxMenu::Delete(): item doesn't exist") );
HMENU menu = GetHMENU(); HMENU menu = GetHmenu();
wxMenu *pSubMenu = item->GetSubMenu(); wxMenu *pSubMenu = item->GetSubMenu();
if ( pSubMenu != NULL ) { if ( pSubMenu != NULL ) {
@@ -453,7 +449,7 @@ void wxMenu::SetTitle(const wxString& label)
bool hasNoTitle = m_title.IsEmpty(); bool hasNoTitle = m_title.IsEmpty();
m_title = label; m_title = label;
HMENU hMenu = GetHMENU(); HMENU hMenu = GetHmenu();
if ( hasNoTitle ) if ( hasNoTitle )
{ {
@@ -622,27 +618,6 @@ wxMenuItem *wxMenu::FindItemForId(int itemId, wxMenu ** itemMenu) const
// other // 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) void wxMenu::Attach(wxMenuBar *menubar)
{ {
// menu can be in at most one menubar because otherwise they would both // 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") ); 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; 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") ); 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; return (flag & MF_ENABLED) != 0;
} }
@@ -879,7 +854,7 @@ void wxMenuBar::SetLabelTop(int pos, const wxString& label)
id = pos; id = pos;
} }
if ( ::ModifyMenu(GetHMENU(), pos, MF_BYPOSITION | MF_STRING | flagsOld, if ( ::ModifyMenu(GetHmenu(), pos, MF_BYPOSITION | MF_STRING | flagsOld,
id, label) == 0xFFFFFFFF ) id, label) == 0xFFFFFFFF )
{ {
wxLogLastError("ModifyMenu"); wxLogLastError("ModifyMenu");
@@ -892,7 +867,7 @@ wxString wxMenuBar::GetLabelTop(int pos) const
len++; // for the NUL character len++; // for the NUL character
wxString label; wxString label;
::GetMenuString(GetHMENU(), pos, label.GetWriteBuf(len), len, MF_BYCOMMAND); ::GetMenuString(GetHmenu(), pos, label.GetWriteBuf(len), len, MF_BYCOMMAND);
label.UngetWriteBuf(); label.UngetWriteBuf();
return label; return label;
@@ -938,7 +913,7 @@ bool wxMenuBar::OnAppend(wxMenu *a_menu, const wxChar *title)
a_menu->Attach(this); a_menu->Attach(this);
if ( !::AppendMenu(GetHMENU(), MF_POPUP | MF_STRING, if ( !::AppendMenu(GetHmenu(), MF_POPUP | MF_STRING,
(UINT)submenu, title) ) (UINT)submenu, title) )
{ {
wxLogLastError(_T("AppendMenu")); wxLogLastError(_T("AppendMenu"));

82
src/msw/statline.cpp Normal file
View File

@@ -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;
}

View File

@@ -1280,3 +1280,8 @@ void wxTextCtrl::OnUpdateRedo(wxUpdateUIEvent& event)
event.Enable( CanRedo() ); event.Enable( CanRedo() );
} }
bool wxTextCtrl::AcceptsFocus() const
{
// we don't want focus if we can't be edited
return IsEditable() && wxControl::AcceptsFocus();
}

View File

@@ -281,11 +281,10 @@ wxWindow::~wxWindow()
{ {
if ( !::DestroyWindow(GetHwnd()) ) if ( !::DestroyWindow(GetHwnd()) )
wxLogLastError("DestroyWindow"); wxLogLastError("DestroyWindow");
}
// Restore old Window proc, if required and remove hWnd <-> wxWindow // remove hWnd <-> wxWindow association
// association wxRemoveHandleAssociation(this);
UnsubclassWin(); }
} }
// real construction (Init() must have been called before!) // 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 // want everything: i.e. all keys and WM_CHAR message
m_lDlgCode = DLGC_WANTARROWS | DLGC_WANTCHARS | m_lDlgCode = DLGC_WANTARROWS | DLGC_WANTCHARS |
DLGC_WANTTAB | DLGC_WANTMESSAGE; DLGC_WANTTAB | DLGC_WANTMESSAGE;
} }
MSWCreate(m_windowId, parent, wxCanvasClassName, this, NULL, 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") ); 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; return TRUE;
@@ -801,10 +799,13 @@ void wxWindow::SubclassWin(WXHWND hWnd)
{ {
wxASSERT_MSG( !m_oldWndProc, _T("subclassing window twice?") ); 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") );
m_oldWndProc = (WXFARPROC) GetWindowLong((HWND) hWnd, GWL_WNDPROC); wxAssociateWinWithHandle(hwnd, this);
SetWindowLong((HWND) hWnd, GWL_WNDPROC, (LONG) wxWndProc);
m_oldWndProc = (WXFARPROC) GetWindowLong(hwnd, GWL_WNDPROC);
SetWindowLong(hwnd, GWL_WNDPROC, (LONG) wxWndProc);
} }
void wxWindow::UnsubclassWin() void wxWindow::UnsubclassWin()
@@ -812,16 +813,19 @@ void wxWindow::UnsubclassWin()
wxRemoveHandleAssociation(this); wxRemoveHandleAssociation(this);
// Restore old Window proc // 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) ) 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_oldWndProc = 0;
} }
m_hWnd = 0;
} }
} }
@@ -1368,6 +1372,31 @@ void wxWindow::GetCaretPos(int *x, int *y) const
} }
#endif // wxUSE_CARET #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 // pre/post message processing
// =========================================================================== // ===========================================================================
@@ -1454,9 +1483,28 @@ bool wxWindow::MSWProcessMessage(WXMSG* pMsg)
// buttons want process Enter themselevs // buttons want process Enter themselevs
bProcess = FALSE; bProcess = FALSE;
} }
// else: but if it does not it makes sense to make it else
// work like a TAB - and that's what we do. {
// Note that Ctrl-Enter always works this way. 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; break;
@@ -1504,10 +1552,7 @@ bool wxWindow::MSWProcessMessage(WXMSG* pMsg)
bool wxWindow::MSWTranslateMessage(WXMSG* pMsg) bool wxWindow::MSWTranslateMessage(WXMSG* pMsg)
{ {
return m_acceleratorTable.Ok() && return m_acceleratorTable.Translate(this, pMsg);
::TranslateAccelerator(GetHwnd(),
GetTableHaccel(m_acceleratorTable),
(MSG *)pMsg);
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------

View File

@@ -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
#

2049
utils/wxPython/src/wxp.cpp Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -12,9 +12,16 @@
#---------------------------------------------------------------------------- #----------------------------------------------------------------------------
<<<<<<< test1.py
<<<<<<< test1.py
#from wxPython import *
from wxpc import *
=======
=======
## import all of the wxPython GUI package ## import all of the wxPython GUI package
>>>>>>> 1.4
from wxPython.wx import * 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 # Every wxWindows application must have a class derived from wxApp
>>>>>>> 1.4
class MyApp(wxApp): class MyApp(wxApp):
# wxWindows calls this method to initialize the application # 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 = MyApp(0) # Create an instance of the application class
app.MainLoop() # Tell it to start processing events app.MainLoop() # Tell it to start processing events
>>>>>>> 1.4
print 'done!' 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

1119
utils/wxprop/src/prop.cpp Normal file

File diff suppressed because it is too large Load Diff