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
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}
\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>
\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}
The following are relevant to the GDI (Graphics Device Interface).

View File

@@ -19,10 +19,14 @@ streambuf\\
\twocolwidtha{5cm}
\begin{twocollist}\itemsep=0pt
\twocolitem{\windowstyle{wxTE\_PROCESS\_ENTER}}{The callback function will
receive the message wxEVENT\_TYPE\_TEXT\_ENTER\_COMMAND. Note
that this will break tab traversal for this panel item under
Windows.}
\twocolitem{\windowstyle{wxTE\_PROCESS\_ENTER}}{The control will generate
the message wxEVENT\_TYPE\_TEXT\_ENTER\_COMMAND (otherwise pressing <Enter> is
either processed internally by the control or used for navigation between
dialog controls).}
\twocolitem{\windowstyle{wxTE\_PROCESS\_TAB}}{The control will receieve
EVT\_CHAR messages for TAB pressed - normally, TAB is used for passing to the
next control in a dialog instead. For the control created with this style,
you can still use Ctrl-Enter to pass to the next control from the keyboard.}
\twocolitem{\windowstyle{wxTE\_MULTILINE}}{The text control allows multiple lines.}
\twocolitem{\windowstyle{wxTE\_PASSWORD}}{The text will be echoed as asterisks.}
\twocolitem{\windowstyle{wxTE\_READONLY}}{The text will not be user-editable.}

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 tstream.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,6 +1,47 @@
#ifndef _WX_DIALOG_H_BASE_
#define _WX_DIALOG_H_BASE_
class WXDLLEXPORT wxDialogBase : public wxPanel
{
protected:
// functions to help with dialog layout
// ------------------------------------
// constants used in dialog layout
static const long LAYOUT_X_MARGIN;
static const long LAYOUT_Y_MARGIN;
static const long MARGIN_BETWEEN_BUTTONS;
// Split the message in lines putting them into the array and calculating
// the maximum line width/height which is returned as wxSize.
wxSize SplitTextMessage(const wxString& message, wxArrayString *lines);
// Creates the (possibly multiline) message, assuming each line has the
// size sizeText (which can be retrieved from SplitTextMessage). Returns
// the bottom border of the multiline text zone.
long CreateTextMessage(const wxArrayString& lines,
const wxPoint& posText,
const wxSize& sizeText);
// Returns the preferred size for the buttons in the dialog
wxSize GetStandardButtonSize(bool hasCancel = TRUE);
// Create the standard [Ok] and [Cancel] (if hasCancel) buttons centering
// them with respect to the dialog width wDialog at vertical position y.
// wButton and hButton is the size of the button (which can be retrieved
// from GetStandardButtonSize)
void CreateStandardButtons(long wDialog,
long y,
long wButton,
long hButton,
bool hasCancel = TRUE);
// Returns the standard height of single line text ctrl (it's not the same
// as the height of just text which may be retrieved from
// wxGetCharHeight())
long GetStandardTextHeight();
};
#if defined(__WXMSW__)
#include "wx/msw/dialog.h"
#elif defined(__WXMOTIF__)

View File

@@ -79,7 +79,6 @@ public:
void OnListBoxDClick(wxCommandEvent& event);
protected:
long m_dialogStyle;
int m_selection;
wxString m_stringSelection;
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

@@ -16,36 +16,48 @@
#pragma interface "textdlgg.h"
#endif
#include "wx/setup.h"
#include "wx/defs.h"
#include "wx/dialog.h"
// Handy dialog functions (will be converted into classes at some point)
WXDLLEXPORT_DATA(extern const wxChar*) wxGetTextFromUserPromptStr;
WXDLLEXPORT_DATA(extern const wxChar*) wxEmptyString;
#define wxID_TEXT 3000
class WXDLLEXPORT wxTextEntryDialog : public wxDialog
{
DECLARE_DYNAMIC_CLASS(wxTextEntryDialog)
protected:
long m_dialogStyle;
wxString m_value;
public:
wxTextEntryDialog(wxWindow *parent, const wxString& message, const wxString& caption = wxGetTextFromUserPromptStr,
const wxString& value = wxEmptyString, long style = wxOK|wxCANCEL|wxCENTRE, const wxPoint& pos = wxDefaultPosition);
wxTextEntryDialog(wxWindow *parent,
const wxString& message,
const wxString& caption = wxGetTextFromUserPromptStr,
const wxString& value = wxEmptyString,
long style = wxOK | wxCANCEL | wxCENTRE,
const wxPoint& pos = wxDefaultPosition);
inline void SetValue(const wxString& val) { m_value = val; }
inline wxString GetValue(void) const { return m_value; }
void SetValue(const wxString& val) { m_value = val; }
wxString GetValue() const { return m_value; }
// implementation only
void OnOK(wxCommandEvent& event);
protected:
wxTextCtrl *m_textctrl;
wxString m_value;
private:
DECLARE_EVENT_TABLE()
};
wxString WXDLLEXPORT wxGetTextFromUser(const wxString& message, const wxString& caption = wxGetTextFromUserPromptStr,
const wxString& default_value = wxEmptyString, wxWindow *parent = (wxWindow *) NULL,
int x = -1, int y = -1, bool centre = TRUE);
wxString WXDLLEXPORT
wxGetTextFromUser(const wxString& message,
const wxString& caption = wxGetTextFromUserPromptStr,
const wxString& default_value = wxEmptyString,
wxWindow *parent = (wxWindow *) NULL,
int x = -1,
int y = -1,
bool centre = TRUE);
#endif
// __TEXTDLGH_G__

View File

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

View File

@@ -15,9 +15,9 @@
#pragma interface
#endif
#include "wx/defs.h"
#if wxUSE_STATLINE
#if !wxUSE_STATLINE
#error "This file should only be included if wxUSE_STATLINE == 1"
#endif
#include "wx/object.h"
#include "wx/list.h"
@@ -29,32 +29,24 @@
class wxStaticLine;
//-----------------------------------------------------------------------------
// global data
//-----------------------------------------------------------------------------
extern const char *wxStaticTextNameStr;
//-----------------------------------------------------------------------------
// wxStaticLine
//-----------------------------------------------------------------------------
class wxStaticLine: public wxControl
class wxStaticLine : public wxStaticLineBase
{
DECLARE_DYNAMIC_CLASS(wxStaticLine)
public:
wxStaticLine(void);
wxStaticLine();
wxStaticLine( wxWindow *parent, wxWindowID id,
const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize,
long style = wxLI_HORIZONTAL, const wxString &name = wxStaticTextNameStr );
bool Create( wxWindow *parent, wxWindowID id,
const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize,
long style = wxLI_HORIZONTAL, const wxString &name = wxStaticTextNameStr );
};
#endif
#endif // wxUSE_STATLINE
#endif // __GTKSTATICLINEH__

View File

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

View File

@@ -15,9 +15,9 @@
#pragma interface
#endif
#include "wx/defs.h"
#if wxUSE_STATLINE
#if !wxUSE_STATLINE
#error "This file should only be included if wxUSE_STATLINE == 1"
#endif
#include "wx/object.h"
#include "wx/list.h"
@@ -29,32 +29,24 @@
class wxStaticLine;
//-----------------------------------------------------------------------------
// global data
//-----------------------------------------------------------------------------
extern const char *wxStaticTextNameStr;
//-----------------------------------------------------------------------------
// wxStaticLine
//-----------------------------------------------------------------------------
class wxStaticLine: public wxControl
class wxStaticLine : public wxStaticLineBase
{
DECLARE_DYNAMIC_CLASS(wxStaticLine)
public:
wxStaticLine(void);
wxStaticLine();
wxStaticLine( wxWindow *parent, wxWindowID id,
const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize,
long style = wxLI_HORIZONTAL, const wxString &name = wxStaticTextNameStr );
bool Create( wxWindow *parent, wxWindowID id,
const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize,
long style = wxLI_HORIZONTAL, const wxString &name = wxStaticTextNameStr );
};
#endif
#endif // wxUSE_STATLINE
#endif // __GTKSTATICLINEH__

View File

@@ -20,6 +20,10 @@
class WXDLLEXPORT wxAcceleratorTable;
// ----------------------------------------------------------------------------
// constants
// ----------------------------------------------------------------------------
// Hold Ctrl key down
#define wxACCEL_ALT 0x01
@@ -32,26 +36,37 @@ class WXDLLEXPORT wxAcceleratorTable;
// Hold no other key
#define wxACCEL_NORMAL 0x00
// ----------------------------------------------------------------------------
// an entry in wxAcceleratorTable corresponds to one accelerator
// ----------------------------------------------------------------------------
class WXDLLEXPORT wxAcceleratorEntry
{
public:
wxAcceleratorEntry(int flags = 0, int keyCode = 0, int cmd = 0)
{
Set(flags, keyCode, cmd);
}
void Set(int flags, int keyCode, int cmd)
{
m_flags = flags; m_keyCode = keyCode; m_command = cmd;
}
inline void Set(int flags, int keyCode, int cmd)
{ m_flags = flags; m_keyCode = keyCode; m_command = cmd; }
inline int GetFlags() const { return m_flags; }
inline int GetKeyCode() const { return m_keyCode; }
inline int GetCommand() const { return m_command; }
int GetFlags() const { return m_flags; }
int GetKeyCode() const { return m_keyCode; }
int GetCommand() const { return m_command; }
//private:
int m_flags;
int m_keyCode; // ASCII or virtual keycode
int m_command; // Command id to generate
};
// ----------------------------------------------------------------------------
// the accel table has all accelerators for a given window or menu
// ----------------------------------------------------------------------------
class WXDLLEXPORT wxAcceleratorTable : public wxObject
{
DECLARE_DYNAMIC_CLASS(wxAcceleratorTable)
@@ -61,18 +76,25 @@ public:
wxAcceleratorTable(int n, const wxAcceleratorEntry entries[]); // Load from array
// Copy constructors
inline wxAcceleratorTable(const wxAcceleratorTable& accel) { Ref(accel); }
inline wxAcceleratorTable(const wxAcceleratorTable* accel) { if (accel) Ref(*accel); }
wxAcceleratorTable(const wxAcceleratorTable& accel)
{ Ref(accel); }
~wxAcceleratorTable();
inline wxAcceleratorTable& operator = (const wxAcceleratorTable& accel) { if (*this == accel) return (*this); Ref(accel); return *this; }
inline bool operator == (const wxAcceleratorTable& accel) { return m_refData == accel.m_refData; }
inline bool operator != (const wxAcceleratorTable& accel) { return m_refData != accel.m_refData; }
wxAcceleratorTable& operator = (const wxAcceleratorTable& accel)
{ if ( *this != accel ) Ref(accel); return *this; }
bool Ok(void) const;
bool operator == (const wxAcceleratorTable& accel) const
{ return m_refData == accel.m_refData; }
bool operator != (const wxAcceleratorTable& accel) const
{ return m_refData != accel.m_refData; }
bool Ok() const;
void SetHACCEL(WXHACCEL hAccel);
WXHACCEL GetHACCEL() const;
// translate the accelerator, return TRUE if done
bool Translate(wxWindow *window, WXMSG *msg) const;
};
WXDLLEXPORT_DATA(extern wxAcceleratorTable) wxNullAcceleratorTable;

View File

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

View File

@@ -207,20 +207,27 @@ extern LONG APIENTRY _EXPORT
// ---------------------------------------------------------------------------
// macros to make casting between WXFOO and FOO a bit easier: the GetFoo()
// returns Foo cast to the Windows type for oruselves, while GetFoosFoo() takes
// an argument which should be a pointer to wxFoo (is this really clear?)
// returns Foo cast to the Windows type for oruselves, while GetFooOf() takes
// an argument which should be a pointer or reference to the object of the
// corresponding class (this depends on the macro)
// ---------------------------------------------------------------------------
#define GetHwnd() ((HWND)GetHWND())
#define GetWinHwnd(win) ((HWND)((win)->GetHWND()))
#define GetHwndOf(win) ((HWND)((win)->GetHWND()))
// old name
#define GetWinHwnd GetHwndOf
#define GetHdc() ((HDC)GetHDC())
#define GetHdcOf(dc) ((HDC)(dc).GetHDC())
#define GetHicon() ((HICON)GetHICON())
#define GetIconHicon(icon) ((HICON)(icon).GetHICON())
#define GetHiconOf(icon) ((HICON)(icon).GetHICON())
#define GetHaccel() ((HACCEL)GetHACCEL())
#define GetTableHaccel(table) ((HACCEL)((table).GetHACCEL()))
#define GetHaccelOf(table) ((HACCEL)((table).GetHACCEL()))
#define GetHmenu() ((HMENU)GetHMenu())
#define GetHmenuOf(menu) ((HMENU)menu->GetHMenu())
// ---------------------------------------------------------------------------
// global data

View File

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

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 SetupColours();
virtual bool AcceptsFocus() const;
protected:
#if wxUSE_RICHEDIT
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_ERROR ICON "wx/msw/error.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_
#define _WX_STATLINE_H_BASE_
// ----------------------------------------------------------------------------
// headers
// ----------------------------------------------------------------------------
// this defines wxUSE_STATLINE
#include "wx/defs.h"
#if wxUSE_STATLINE
// the base class declaration
#include "wx/control.h"
// ----------------------------------------------------------------------------
// global variables
// ----------------------------------------------------------------------------
// the default name for objects of class wxStaticLine
WXDLLEXPORT_DATA(extern const wxChar*) wxStaticTextNameStr;
// ----------------------------------------------------------------------------
// wxStaticLine - a line in a dialog
// ----------------------------------------------------------------------------
class WXDLLEXPORT wxStaticLineBase : public wxControl
{
public:
// constructor
wxStaticLineBase() { }
// is the line vertical?
bool IsVertical() const { return (GetWindowStyle() & wxLI_VERTICAL) != 0; }
// get the default size for the "lesser" dimension of the static line
static int GetDefaultSize() { return 2; }
protected:
// set the right size for the right dimension
wxSize AdjustSize(const wxSize& size)
{
wxSize sizeReal(size);
if ( IsVertical() )
{
if ( size.x == -1 )
sizeReal.x = GetDefaultSize();
}
else
{
if ( size.y == -1 )
sizeReal.y = GetDefaultSize();
}
return sizeReal;
}
};
// ----------------------------------------------------------------------------
// now include the actual class declaration
// ----------------------------------------------------------------------------
#if defined(__WXMSW__)
#include "wx/msw/statline.h"
#elif defined(__WXMOTIF__)
#include "wx/motif/statline.h"
#elif defined(__WXGTK__)
#include "wx/gtk/statline.h"
#elif defined(__WXQT__)
#include "wx/qt/statline.h"
#elif defined(__WXMAC__)
#include "wx/mac/statline.h"
#elif defined(__WXSTUBS__)
#include "wx/stubs/statline.h"
#else // use generic implementation for all other platforms
#include "wx/generic/statline.h"
#endif
#endif // wxUSE_STATLINE
#endif
// _WX_STATLINE_H_BASE_

View File

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

View File

@@ -30,6 +30,7 @@
#include <wx/dirdlg.h>
#include <wx/fontdlg.h>
#include <wx/choicdlg.h>
#include <wx/tipdlg.h>
#define wxTEST_GENERIC_DIALOGS_IN_MSW 0
@@ -78,6 +79,8 @@ bool MyApp::OnInit(void)
file_menu->Append(DIALOGS_TEXT_ENTRY, "Text &entry");
file_menu->Append(DIALOGS_SINGLE_CHOICE, "&Single choice");
file_menu->AppendSeparator();
file_menu->Append(DIALOGS_TIP, "&Tip of the day");
file_menu->AppendSeparator();
file_menu->Append(DIALOGS_FILE_OPEN, "&Open file");
file_menu->Append(DIALOGS_FILE_SAVE, "Sa&ve file");
file_menu->Append(DIALOGS_DIR_CHOOSE, "&Choose a directory");
@@ -190,12 +193,9 @@ void MyFrame::ChooseFontGeneric(wxCommandEvent& WXUNUSED(event) )
void MyFrame::MessageBox(wxCommandEvent& WXUNUSED(event) )
{
wxMessageDialog dialog(NULL, "This is a message box\nA long, long string to test out the message box properly",
"Message box text", wxYES_NO|wxCANCEL);
"Message box text", wxYES_NO|wxCANCEL|wxICON_INFORMATION);
dialog.ShowModal();
::wxMessageBox("MsgBox with a really long long string",
"this is the text", wxYES_NO|wxICON_EXCLAMATION);
}
void MyFrame::TextEntry(wxCommandEvent& WXUNUSED(event) )
@@ -271,6 +271,33 @@ void MyFrame::DirChoose(wxCommandEvent& WXUNUSED(event) )
}
}
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) )
{
Close(TRUE);
@@ -298,6 +325,7 @@ BEGIN_EVENT_TABLE(MyFrame, wxFrame)
EVT_MENU(DIALOGS_FILE_OPEN, MyFrame::FileOpen)
EVT_MENU(DIALOGS_FILE_SAVE, MyFrame::FileSave)
EVT_MENU(DIALOGS_DIR_CHOOSE, MyFrame::DirChoose)
EVT_MENU(DIALOGS_TIP, MyFrame::ShowTip)
#if defined(__WXMSW__) && wxTEST_GENERIC_DIALOGS_IN_MSW
EVT_MENU(DIALOGS_CHOOSE_COLOUR_GENERIC, MyFrame::ChooseColourGeneric)
EVT_MENU(DIALOGS_CHOOSE_FONT_GENERIC, MyFrame::ChooseFontGeneric)

View File

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

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,20 +9,20 @@
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#include <wx/wxprec.h>
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#ifndef WX_PRECOMP
#include <wx/wx.h>
#include "wx/wx.h"
#endif
#include <wx/intl.h>
#include <wx/log.h>
#include "wx/intl.h"
#include "wx/log.h"
#include <wx/dnd.h>
#include "wx/dnd.h"
#ifdef __WXMOTIF__
#error Sorry, drag and drop is not yet implemented on wxMotif.
@@ -32,6 +32,8 @@
#include "mondrian.xpm"
#endif
#include "wx/clipbrd.h"
// ----------------------------------------------------------------------------
// Derive two simple classes which just put in the listbox the strings (text or
// file names) we drop on them
@@ -49,7 +51,8 @@ class DnDText : public wxTextDropTarget
public:
DnDText(wxListBox *pOwner) { m_pOwner = pOwner; }
virtual bool OnDropText(wxDropPointCoord x, wxDropPointCoord y, const wxChar* psz );
virtual bool OnDropText(wxDropPointCoord x, wxDropPointCoord y,
const wxChar* psz);
private:
wxListBox *m_pOwner;
@@ -94,6 +97,8 @@ public:
void OnDrag (wxCommandEvent& event);
void OnHelp (wxCommandEvent& event);
void OnLogClear(wxCommandEvent& event);
void OnCopy(wxCommandEvent& event);
void OnPaste(wxCommandEvent& event);
void OnLeftDown(wxMouseEvent& event);
void OnRightDown(wxMouseEvent& event);
@@ -121,6 +126,8 @@ enum
Menu_About = 101,
Menu_Help,
Menu_Clear,
Menu_Copy,
Menu_Paste
};
BEGIN_EVENT_TABLE(DnDFrame, wxFrame)
@@ -129,6 +136,9 @@ BEGIN_EVENT_TABLE(DnDFrame, wxFrame)
EVT_MENU(Menu_Drag, DnDFrame::OnDrag)
EVT_MENU(Menu_Help, DnDFrame::OnHelp)
EVT_MENU(Menu_Clear, DnDFrame::OnLogClear)
EVT_MENU(Menu_Copy, DnDFrame::OnCopy)
EVT_MENU(Menu_Paste, DnDFrame::OnPaste)
EVT_LEFT_DOWN( DnDFrame::OnLeftDown)
EVT_RIGHT_DOWN( DnDFrame::OnRightDown)
EVT_PAINT( DnDFrame::OnPaint)
@@ -138,7 +148,8 @@ END_EVENT_TABLE()
bool DnDApp::OnInit()
{
// create the main frame window
DnDFrame *frame = new DnDFrame((wxFrame *) NULL, "Drag & Drop wxWindows App",
DnDFrame *frame = new DnDFrame((wxFrame *) NULL,
"Drag-and-Drop/Clipboard wxWindows Sample",
50, 50, 450, 340);
// activate it
@@ -154,12 +165,9 @@ DnDFrame::DnDFrame(wxFrame *frame, char *title, int x, int y, int w, int h)
m_strText("wxWindows drag & drop works :-)")
{
// SetBackgroundColour(* wxWHITE);
// frame icon and status bar
SetIcon(wxICON(mondrian));
// const int widths[] = { -1 };
CreateStatusBar();
// construct menu
@@ -176,6 +184,79 @@ DnDFrame::DnDFrame(wxFrame *frame, char *title, int x, int y, int w, int h)
help_menu->AppendSeparator();
help_menu->Append(Menu_About, "&About");
wxMenu *clip_menu = new wxMenu;
clip_menu->Append(Menu_Copy, "&Copy\tCtrl+C");
clip_menu->Append(Menu_Paste, "&Paste\tCtrl+V");
wxMenuBar *menu_bar = new wxMenuBar;
menu_bar->Append(file_menu, "&File");
menu_bar->Append(log_menu, "&Log");
menu_bar->Append(clip_menu, "&Clipboard");
menu_bar->Append(help_menu, "&Help");
SetMenuBar(menu_bar);
// make a panel with 3 subwindows
wxPoint pos(0, 0);
wxSize size(400, 200);
wxString strFile("Drop files here!"), strText("Drop text on me");
m_ctrlFile = new wxListBox(this, -1, pos, size, 1, &strFile, wxLB_HSCROLL);
m_ctrlText = new wxListBox(this, -1, pos, size, 1, &strText, wxLB_HSCROLL);
m_ctrlLog = new wxTextCtrl(this, -1, "", pos, size,
wxTE_MULTILINE | wxTE_READONLY |
wxSUNKEN_BORDER );
// redirect log messages to the text window (don't forget to delete it!)
m_pLog = new wxLogTextCtrl(m_ctrlLog);
m_pLogPrev = wxLog::SetActiveTarget(m_pLog);
// associate drop targets with 2 text controls
m_ctrlFile->SetDropTarget(new DnDFile(m_ctrlFile));
m_ctrlText->SetDropTarget( new DnDText(m_ctrlText) );
wxLayoutConstraints *c;
// Top-left listbox
c = new wxLayoutConstraints;
c->left.SameAs(this, wxLeft);
c->top.SameAs(this, wxTop);
c->right.PercentOf(this, wxRight, 50);
c->height.PercentOf(this, wxHeight, 40);
m_ctrlFile->SetConstraints(c);
// Top-right listbox
c = new wxLayoutConstraints;
c->left.SameAs (m_ctrlFile, wxRight);
c->top.SameAs (this, wxTop);
c->right.SameAs (this, wxRight);
c->height.PercentOf(this, wxHeight, 40);
m_ctrlText->SetConstraints(c);
// Lower text control
c = new wxLayoutConstraints;
c->left.SameAs (this, wxLeft);
c->right.SameAs (this, wxRight);
c->height.PercentOf(this, wxHeight, 40);
c->top.SameAs(m_ctrlText, wxBottom);
m_ctrlLog->SetConstraints(c);
// construct menu
wxMenu *file_menu = new wxMenu;
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");
wxMenuBar *menu_bar = new wxMenuBar;
menu_bar->Append(file_menu, "&File");
menu_bar->Append(log_menu, "&Log");
@@ -265,13 +346,12 @@ void DnDFrame::OnDrag(wxCommandEvent& /* event */)
void DnDFrame::OnAbout(wxCommandEvent& /* event */)
{
wxMessageDialog dialog(this,
"Drag-&-Drop Demo\n"
wxMessageBox("Drag-&-Drop Demo\n"
"Please see \"Help|Help...\" for details\n"
"Copyright (c) 1998 Vadim Zeitlin",
"About wxDnD");
dialog.ShowModal();
"About wxDnD",
wxICON_INFORMATION | wxOK,
this);
}
void DnDFrame::OnHelp(wxCommandEvent& /* event */)
@@ -353,6 +433,61 @@ DnDFrame::~DnDFrame()
}
}
// ---------------------------------------------------------------------------
// 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();
}
// ----------------------------------------------------------------------------
// Notifications called by the base class
// ----------------------------------------------------------------------------

View File

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

View File

@@ -69,6 +69,9 @@ public:
// event handlers (these functions should _not_ be virtual)
void OnQuit(wxCommandEvent& event);
void OnAbout(wxCommandEvent& event);
void OnTest(wxCommandEvent& event);
void OnPaint(wxPaintEvent& event);
private:
// any class wishing to process wxWindows events must use this macro
@@ -85,8 +88,7 @@ enum
// menu items
Minimal_Quit = 1,
Minimal_About,
Minimal_Test1,
Minimal_Test2,
Minimal_Test,
// controls start here (the numbers are, of course, arbitrary)
Minimal_Text = 1000,
@@ -102,6 +104,10 @@ enum
BEGIN_EVENT_TABLE(MyFrame, wxFrame)
EVT_MENU(Minimal_Quit, MyFrame::OnQuit)
EVT_MENU(Minimal_About, MyFrame::OnAbout)
EVT_BUTTON(-1, MyFrame::OnTest)
EVT_PAINT(MyFrame::OnPaint)
END_EVENT_TABLE()
// Create a new application object: this macro will allow wxWindows to create
@@ -163,9 +169,11 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
// ... and attach this menu bar to the frame
SetMenuBar(menuBar);
#if wxUSE_STATUSBAR
// create a status bar just for fun (by default with 1 pane only)
CreateStatusBar(2);
SetStatusText("Welcome to wxWindows!");
#endif // wxUSE_STATUSBAR
}
@@ -193,3 +201,28 @@ void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
wxMessageBox(msg, "About Minimal", wxOK | wxICON_INFORMATION, this);
}
void MyFrame::OnTest(wxCommandEvent& event)
{
}
void MyFrame::OnPaint(wxPaintEvent& event)
{
wxPaintDC dc(this);
wxMemoryDC dcMem;
wxSize size(GetClientSize());
dcMem.SelectObject(wxBitmap(size.x, size.y, -1));
dcMem.SetBackground(wxBrush(wxColour(0, 0, 255), wxSOLID));
dcMem.SetTextForeground(wxColour(0, 255, 0));
dcMem.SetTextBackground(wxColour(0, 0, 0));
dcMem.SetBackgroundMode(wxSOLID);
dcMem.Clear();
dcMem.DrawText("Hello, wxWindows!", 10, 10);
wxPoint ptOrig(0, 0);
dc.Blit(ptOrig, size, &dcMem, ptOrig);
dcMem.SelectObject(wxNullBitmap);
}

View File

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

View File

@@ -28,8 +28,6 @@
#include "wx/listbox.h"
#include "wx/stattext.h"
#include "wx/intl.h"
#include "wx/dcclient.h"
#include "wx/settings.h"
#endif
#if wxUSE_STATLINE
@@ -225,84 +223,33 @@ bool wxSingleChoiceDialog::Create( wxWindow *WXUNUSED(parent),
long style,
const wxPoint& WXUNUSED(pos) )
{
m_dialogStyle = style;
m_selection = 0;
m_clientData = NULL;
// dialog layout constants
static const int LAYOUT_X_MARGIN = 5;
static const int LAYOUT_Y_MARGIN = 5;
static const int MARGIN_BETWEEN_BUTTONS = 3*LAYOUT_X_MARGIN;
// calc the message size
// ---------------------
// TODO this should be factored out to a common function (also used in
// msgdlgg.cpp)
wxClientDC dc(this);
dc.SetFont(wxSystemSettings::GetSystemFont(wxSYS_DEFAULT_GUI_FONT));
wxArrayString lines;
wxString curLine;
long height, width, heightTextMax = 0, widthTextMax = 0;
for ( const char *pc = message; ; pc++ ) {
if ( *pc == '\n' || *pc == '\0' ) {
dc.GetTextExtent(curLine, &width, &height);
if ( width > widthTextMax )
widthTextMax = width;
if ( height > heightTextMax )
heightTextMax = height;
lines.Add(curLine);
if ( *pc == '\n' ) {
curLine.Empty();
}
else {
// the end of string
break;
}
}
else {
curLine += *pc;
}
}
wxSize sizeText = SplitTextMessage(message, &lines);
long heightTextMax = sizeText.GetHeight(),
widthTextMax = sizeText.GetWidth();
size_t nLineCount = lines.Count();
long hTotalMsg = heightTextMax*nLineCount;
// calc the button size
// --------------------
bool hasCancel = FALSE;
// always create the OK button - the code below supposes we do have buttons
// and besides the user should have some way to close this dialog
wxASSERT_MSG( style & wxOK, _T("this dialog should have OK button") );
wxString labelOk(_("OK"));
long wButton = 0;
dc.GetTextExtent(labelOk, &width, NULL);
if ( width > wButton )
wButton = width;
bool hasCancel = (style & wxCANCEL) != 0;
wxString labelCancel;
if ( style & wxCANCEL )
{
labelCancel = _("Cancel");
dc.GetTextExtent(labelCancel, &width, NULL);
if ( width > wButton )
wButton = width;
wxSize sizeButtons = GetStandardButtonSize(hasCancel);
hasCancel = TRUE;
}
long wButton = sizeButtons.GetWidth(),
hButton = sizeButtons.GetHeight();
if ( wButton < 75 )
wButton = 75;
else
wButton += 10;
long hButton = wButton*23/75;
long wTotalButtons = wButton;
if ( hasCancel )
{
@@ -321,8 +268,7 @@ bool wxSingleChoiceDialog::Create( wxWindow *WXUNUSED(parent),
wListbox = wxMax(300, wxMax(wTotalButtons, widthTextMax));
#if wxUSE_STATLINE
// arbitrary...
long hStatLine = 5;
long hStatLine = wxStaticLine::GetDefaultSize();
#endif
// now the complete dialog size
@@ -376,8 +322,8 @@ bool wxSingleChoiceDialog::Create( wxWindow *WXUNUSED(parent),
// separator line
#if wxUSE_STATLINE
(void) new wxStaticLine( this, -1,
wxPoint(0, y + LAYOUT_Y_MARGIN),
wxSize(wDialog, hStatLine) );
wxPoint(2*LAYOUT_X_MARGIN, y + LAYOUT_Y_MARGIN),
wxSize(wDialog - 4*LAYOUT_X_MARGIN, hStatLine) );
y += LAYOUT_Y_MARGIN + hStatLine;
#endif
@@ -386,31 +332,7 @@ bool wxSingleChoiceDialog::Create( wxWindow *WXUNUSED(parent),
y += 2*LAYOUT_X_MARGIN;
// NB: create [Ok] first to get the right tab order
wxButton *ok = (wxButton *) NULL;
wxButton *cancel = (wxButton *) NULL;
long x = wDialog / 2;
if ( hasCancel )
x -= MARGIN_BETWEEN_BUTTONS / 2 + wButton;
else
x -= wButton / 2;
ok = new wxButton( this, wxID_OK, labelOk,
wxPoint(x, y),
wxSize(wButton, hButton) );
if ( hasCancel )
{
x += MARGIN_BETWEEN_BUTTONS + wButton;
cancel = new wxButton( this, wxID_CANCEL, labelCancel,
wxPoint(x, y),
wxSize(wButton, hButton) );
}
ok->SetDefault();
ok->SetFocus();
CreateStandardButtons(wDialog, y, wButton, hButton, hasCancel);
SetClientSize( wDialog, hDialog );

View File

@@ -71,9 +71,6 @@ wxGenericMessageDialog::wxGenericMessageDialog( wxWindow *parent,
const wxPoint& pos)
: wxDialog( parent, -1, caption, pos, wxDefaultSize, wxDEFAULT_DIALOG_STYLE )
{
static const int LAYOUT_X_MARGIN = 5;
static const int LAYOUT_Y_MARGIN = 5;
m_dialogStyle = style;
wxBeginBusyCursor();
@@ -122,34 +119,12 @@ wxGenericMessageDialog::wxGenericMessageDialog( wxWindow *parent,
// split the message in lines
// --------------------------
wxClientDC dc(this);
dc.SetFont(wxSystemSettings::GetSystemFont(wxSYS_DEFAULT_GUI_FONT));
wxArrayString lines;
wxString curLine;
long height, width, heightTextMax = 0, widthTextMax = 0;
for ( const char *pc = message; ; pc++ ) {
if ( *pc == '\n' || *pc == '\0' ) {
dc.GetTextExtent(curLine, &width, &height);
if ( width > widthTextMax )
widthTextMax = width;
if ( height > heightTextMax )
heightTextMax = height;
lines.Add(curLine);
if ( *pc == '\n' ) {
curLine.Empty();
}
else {
// the end of string
break;
}
}
else {
curLine += *pc;
}
}
wxSize sizeText = SplitTextMessage(message, &lines);
long widthTextMax = sizeText.GetWidth(),
heightTextMax = sizeText.GetHeight();
size_t nLineCount = lines.GetCount();
// calculate the total dialog size
enum
@@ -194,7 +169,7 @@ wxGenericMessageDialog::wxGenericMessageDialog( wxWindow *parent,
// get the longest caption and also calc the number of buttons
size_t nBtn, nButtons = 0;
long widthBtnMax = 0;
long width, widthBtnMax = 0;
for ( nBtn = 0; nBtn < Btn_Max; nBtn++ ) {
if ( buttons[nBtn] ) {
nButtons++;
@@ -215,8 +190,6 @@ wxGenericMessageDialog::wxGenericMessageDialog( wxWindow *parent,
heightTextMax *= 12;
heightTextMax /= 10;
size_t nLineCount = lines.Count();
long widthButtonsTotal = nButtons * (widthBtnMax + LAYOUT_X_MARGIN) -
LAYOUT_X_MARGIN;

View File

@@ -174,10 +174,7 @@ wxProgressDialog::wxProgressDialog(wxString const &title,
m_btnAbort = new wxButton(this, -1, _("Cancel"));
c = new wxLayoutConstraints;
c->centreX.SameAs(this, wxCentreX);
if(lastWindow)
c->top.Below(lastWindow, 2*LAYOUT_Y_MARGIN);
else
c->top.Below(m_btnAbort, 2*LAYOUT_Y_MARGIN);
c->width.AsIs();
c->height.AsIs();
m_btnAbort->SetConstraints(c);
@@ -194,9 +191,8 @@ wxProgressDialog::wxProgressDialog(wxString const &title,
// wide under Windows, so try to find a reasonable value for the width, not
// too big and not too small
wxSize size = GetClientSize();
size.x = 2*widthText;
if ( size.x < 2*size.y )
SetClientSize(2*size.y, size.y);
size.x = wxMax(3*widthText/2, 2*size.y);
SetClientSize(size);
Show(TRUE);
Centre(wxCENTER_FRAME | wxBOTH);

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

@@ -9,6 +9,14 @@
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
// ============================================================================
// declarations
// ============================================================================
// ----------------------------------------------------------------------------
// headers
// ----------------------------------------------------------------------------
#ifdef __GNUG__
#pragma implementation "textdlgg.h"
#endif
@@ -22,6 +30,7 @@
#ifndef WX_PRECOMP
#include <stdio.h>
#include "wx/utils.h"
#include "wx/dialog.h"
#include "wx/button.h"
@@ -36,44 +45,19 @@
#include "wx/generic/textdlgg.h"
/* Split message, using constraints to position controls */
static wxSize wxSplitMessage2( const wxString &message, wxWindow *parent )
{
int y = 10;
int w = 50;
wxString line( _T("") );
for (size_t pos = 0; pos < message.Len(); pos++)
{
if (message[pos] == _T('\n'))
{
if (!line.IsEmpty())
{
wxStaticText *s1 = new wxStaticText( parent, -1, line, wxPoint(15,y) );
wxSize size1( s1->GetSize() );
if (size1.x > w) w = size1.x;
line = _T("");
}
y += 18;
}
else
{
line += message[pos];
}
}
// ----------------------------------------------------------------------------
// constants
// ----------------------------------------------------------------------------
if (!line.IsEmpty())
{
wxStaticText *s2 = new wxStaticText( parent, -1, line, wxPoint(15,y) );
wxSize size2( s2->GetSize() );
if (size2.x > w) w = size2.x;
}
#define wxID_TEXT 3000
y += 18;
return wxSize(w+30,y);
}
// ============================================================================
// implementation
// ============================================================================
// ----------------------------------------------------------------------------
// wxTextEntryDialog
// ----------------------------------------------------------------------------
#if !USE_SHARED_LIBRARY
BEGIN_EVENT_TABLE(wxTextEntryDialog, wxDialog)
@@ -83,79 +67,70 @@ END_EVENT_TABLE()
IMPLEMENT_CLASS(wxTextEntryDialog, wxDialog)
#endif
wxTextEntryDialog::wxTextEntryDialog(wxWindow *parent, const wxString& message, const wxString& caption,
const wxString& value, long style, const wxPoint& pos):
wxDialog(parent, -1, caption, pos, wxDefaultSize, wxDEFAULT_DIALOG_STYLE|wxDIALOG_MODAL|wxTAB_TRAVERSAL)
wxTextEntryDialog::wxTextEntryDialog(wxWindow *parent,
const wxString& message,
const wxString& caption,
const wxString& value,
long style,
const wxPoint& pos)
: wxDialog(parent, -1, caption, pos, wxDefaultSize,
wxDEFAULT_DIALOG_STYLE | wxDIALOG_MODAL),
m_value(value)
{
m_dialogStyle = style;
m_value = value;
// calculate the sizes
// -------------------
wxBeginBusyCursor();
wxArrayString lines;
wxSize sizeText = SplitTextMessage(message, &lines);
wxSize message_size( wxSplitMessage2( message, this ) );
wxSize sizeBtn = GetStandardButtonSize();
wxButton *ok = (wxButton *) NULL;
wxButton *cancel = (wxButton *) NULL;
wxList m_buttons;
long wText = wxMax(4*sizeBtn.GetWidth(), sizeText.GetWidth());
long hText = GetStandardTextHeight();
int y = message_size.y + 15;
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;
wxTextCtrl *textCtrl = new wxTextCtrl(this, wxID_TEXT, value, wxPoint(-1, y), wxSize(350, -1));
// create the controls
// -------------------
y += 65;
// message
long x = 2*LAYOUT_X_MARGIN;
long y = CreateTextMessage(lines,
wxPoint(x, 2*LAYOUT_Y_MARGIN),
sizeText);
if (style & wxOK)
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) );
m_buttons.Append( ok );
// centre the dialog if no explicit position given
Centre(wxBOTH | wxCENTER_FRAME);
}
if (style & wxCANCEL)
{
cancel = new wxButton( this, wxID_CANCEL, _("Cancel"), wxPoint(-1,y), wxSize(80,-1) );
m_buttons.Append( cancel );
}
if (ok)
{
ok->SetDefault();
ok->SetFocus();
}
int w = wxMax( 350, m_buttons.GetCount() * 100 );
w = wxMax( w, message_size.x );
int space = w / (m_buttons.GetCount()*2);
textCtrl->SetSize( 20, -1, w-10, -1 );
int m = 0;
wxNode *node = m_buttons.First();
while (node)
{
wxWindow *win = (wxWindow*)node->Data();
int x = (m*2+1)*space - 40 + 15;
win->Move( x, -1 );
node = node->Next();
m++;
}
#if wxUSE_STATLINE
(void) new wxStaticLine( this, -1, wxPoint(0,y-20), wxSize(w+30, 5) );
#endif
SetSize( w+30, y+40 );
Centre( wxBOTH );
wxEndBusyCursor();
m_textctrl->SetFocus();
}
void wxTextEntryDialog::OnOK(wxCommandEvent& WXUNUSED(event) )
{
wxTextCtrl *textCtrl = (wxTextCtrl *)FindWindow(wxID_TEXT);
if ( textCtrl )
m_value = textCtrl->GetValue();
m_value = m_textctrl->GetValue();
EndModal(wxID_OK);
}

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 \
datstrm.cpp \
dcbase.cpp \
dlgcmn.cpp \
docmdi.cpp \
docview.cpp \
dynarray.cpp \
@@ -186,6 +187,7 @@ libwx_gtk_la_SOURCES = \
textctrl.cpp \
textdlg.cpp \
timer.cpp \
tipdlg.cpp \
tooltip.cpp \
utilsgtk.cpp \
utilsres.cpp \

View File

@@ -24,7 +24,7 @@
IMPLEMENT_DYNAMIC_CLASS(wxStaticLine, wxControl)
wxStaticLine::wxStaticLine(void)
wxStaticLine::wxStaticLine()
{
}
@@ -43,7 +43,7 @@ bool wxStaticLine::Create( wxWindow *parent, wxWindowID id,
PreCreation( parent, id, pos, size, style, name );
if (style & wxVERTICAL)
if ( IsVertical() )
m_widget = gtk_vseparator_new();
else
m_widget = gtk_hseparator_new();

View File

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

View File

@@ -24,7 +24,7 @@
IMPLEMENT_DYNAMIC_CLASS(wxStaticLine, wxControl)
wxStaticLine::wxStaticLine(void)
wxStaticLine::wxStaticLine()
{
}
@@ -43,7 +43,7 @@ bool wxStaticLine::Create( wxWindow *parent, wxWindowID id,
PreCreation( parent, id, pos, size, style, name );
if (style & wxVERTICAL)
if ( IsVertical() )
m_widget = gtk_vseparator_new();
else
m_widget = gtk_hseparator_new();

View File

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

View File

@@ -38,8 +38,8 @@ class WXDLLEXPORT wxAcceleratorRefData: public wxObjectRefData
{
friend class WXDLLEXPORT wxAcceleratorTable;
public:
wxAcceleratorRefData(void);
~wxAcceleratorRefData(void);
wxAcceleratorRefData();
~wxAcceleratorRefData();
inline HACCEL GetHACCEL() const { return m_hAccel; }
protected:
@@ -132,13 +132,14 @@ wxAcceleratorTable::wxAcceleratorTable(int n, const wxAcceleratorEntry entries[]
M_ACCELDATA->m_ok = (M_ACCELDATA->m_hAccel != 0);
}
#else
#else // Win16
wxAcceleratorTable::wxAcceleratorTable(int WXUNUSED(n), const wxAcceleratorEntry WXUNUSED(entries)[])
{
wxFAIL_MSG("not implemented");
}
#endif
#endif // Win32/16
bool wxAcceleratorTable::Ok(void) const
bool wxAcceleratorTable::Ok() const
{
return (M_ACCELDATA && (M_ACCELDATA->m_ok));
}
@@ -158,3 +159,8 @@ WXHACCEL wxAcceleratorTable::GetHACCEL() const
return (WXHACCEL) M_ACCELDATA->m_hAccel;
}
bool wxAcceleratorTable::Translate(wxWindow *window, WXMSG *wxmsg) const
{
MSG *msg = (MSG *)wxmsg;
return Ok() && ::TranslateAccelerator(GetHwndOf(window), GetHaccel(), msg); }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

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() );
}
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()) )
wxLogLastError("DestroyWindow");
}
// Restore old Window proc, if required and remove hWnd <-> wxWindow
// association
UnsubclassWin();
// remove hWnd <-> wxWindow association
wxRemoveHandleAssociation(this);
}
}
// real construction (Init() must have been called before!)
@@ -328,7 +327,6 @@ bool wxWindow::Create(wxWindow *parent, wxWindowID id,
// want everything: i.e. all keys and WM_CHAR message
m_lDlgCode = DLGC_WANTARROWS | DLGC_WANTCHARS |
DLGC_WANTTAB | DLGC_WANTMESSAGE;
}
MSWCreate(m_windowId, parent, wxCanvasClassName, this, NULL,
@@ -448,7 +446,7 @@ bool wxWindow::SetFont(const wxFont& font)
wxASSERT_MSG( hFont, _T("should have valid font") );
::SendMessage(hWnd, WM_SETFONT, (WPARAM)hFont, TRUE);
::SendMessage(hWnd, WM_SETFONT, (WPARAM)hFont, MAKELPARAM(TRUE, 0));
}
return TRUE;
@@ -801,10 +799,13 @@ void wxWindow::SubclassWin(WXHWND hWnd)
{
wxASSERT_MSG( !m_oldWndProc, _T("subclassing window twice?") );
wxAssociateWinWithHandle((HWND)hWnd, this);
HWND hwnd = (HWND)hWnd;
wxCHECK_RET( ::IsWindow(hwnd), _T("invalid HWND in SubclassWin") );
m_oldWndProc = (WXFARPROC) GetWindowLong((HWND) hWnd, GWL_WNDPROC);
SetWindowLong((HWND) hWnd, GWL_WNDPROC, (LONG) wxWndProc);
wxAssociateWinWithHandle(hwnd, this);
m_oldWndProc = (WXFARPROC) GetWindowLong(hwnd, GWL_WNDPROC);
SetWindowLong(hwnd, GWL_WNDPROC, (LONG) wxWndProc);
}
void wxWindow::UnsubclassWin()
@@ -812,16 +813,19 @@ void wxWindow::UnsubclassWin()
wxRemoveHandleAssociation(this);
// Restore old Window proc
if ( GetHwnd() )
HWND hwnd = GetHwnd();
if ( hwnd )
{
FARPROC farProc = (FARPROC) GetWindowLong(GetHwnd(), GWL_WNDPROC);
m_hWnd = 0;
wxCHECK_RET( ::IsWindow(hwnd), _T("invalid HWND in SubclassWin") );
FARPROC farProc = (FARPROC) GetWindowLong(hwnd, GWL_WNDPROC);
if ( (m_oldWndProc != 0) && (farProc != (FARPROC) m_oldWndProc) )
{
SetWindowLong(GetHwnd(), GWL_WNDPROC, (LONG) m_oldWndProc);
SetWindowLong(hwnd, GWL_WNDPROC, (LONG) m_oldWndProc);
m_oldWndProc = 0;
}
m_hWnd = 0;
}
}
@@ -1368,6 +1372,31 @@ void wxWindow::GetCaretPos(int *x, int *y) const
}
#endif // wxUSE_CARET
// ---------------------------------------------------------------------------
// popup menu
// ---------------------------------------------------------------------------
bool wxWindow::PopupMenu(wxMenu *menu, int x, int y)
{
menu->SetInvokingWindow(this);
menu->UpdateUI();
HWND hWnd = GetHwnd();
HMENU hMenu = GetHmenuOf(menu);
POINT point;
point.x = x;
point.y = y;
::ClientToScreen(hWnd, &point);
wxCurrentPopupMenu = menu;
::TrackPopupMenu(hMenu, TPM_RIGHTBUTTON, point.x, point.y, 0, hWnd, NULL);
wxYield();
wxCurrentPopupMenu = NULL;
menu->SetInvokingWindow(NULL);
return TRUE;
}
// ===========================================================================
// pre/post message processing
// ===========================================================================
@@ -1454,10 +1483,29 @@ bool wxWindow::MSWProcessMessage(WXMSG* pMsg)
// buttons want process Enter themselevs
bProcess = FALSE;
}
// else: but if it does not it makes sense to make it
// work like a TAB - and that's what we do.
else
{
wxPanel *panel = wxDynamicCast(this, wxPanel);
wxButton *btn = NULL;
if ( panel )
{
// panel may have a default button which should
// be activated by Enter
btn = panel->GetDefaultItem();
}
if ( btn )
{
// if we do have a default button, do press it
btn->MSWCommand(BN_CLICKED, 0 /* unused */);
return TRUE;
}
// else: but if it does not it makes sense to make
// it work like a TAB - and that's what we do.
// Note that Ctrl-Enter always works this way.
}
}
break;
default:
@@ -1504,10 +1552,7 @@ bool wxWindow::MSWProcessMessage(WXMSG* pMsg)
bool wxWindow::MSWTranslateMessage(WXMSG* pMsg)
{
return m_acceleratorTable.Ok() &&
::TranslateAccelerator(GetHwnd(),
GetTableHaccel(m_acceleratorTable),
(MSG *)pMsg);
return m_acceleratorTable.Translate(this, pMsg);
}
// ---------------------------------------------------------------------------

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
>>>>>>> 1.4
from wxPython.wx import *
>>>>>>> 1.3
#---------------------------------------------------------------------------
@@ -54,7 +61,11 @@ class MyFrame(wxFrame):
#---------------------------------------------------------------------------
<<<<<<< test1.py
=======
# Every wxWindows application must have a class derived from wxApp
>>>>>>> 1.4
class MyApp(wxApp):
# wxWindows calls this method to initialize the application
@@ -72,12 +83,67 @@ class MyApp(wxApp):
#---------------------------------------------------------------------------
<<<<<<< test1.py
def main():
app = MyApp(0)
app.MainLoop()
def t():
import pdb
pdb.run('main()')
=======
>>>>>>> 1.4
<<<<<<< test1.py
if __name__ == '__main__':
main()
=======
app = MyApp(0) # Create an instance of the application class
app.MainLoop() # Tell it to start processing events
>>>>>>> 1.4
print 'done!'
#----------------------------------------------------------------------------
#
# $Log$
# Revision 1.6 1999/06/28 21:39:48 VZ
# 1. wxStaticLine implemented (generic (ugly) and MSW versions)
# 2. wxTextDialog looks fine under MSW again
# 3. startup tips added: code, sample, docs
# 4. read-only text controls don't participate in TAB traversal
#
# Revision 1.3 1998/12/15 20:44:34 RD
# Changed the import semantics from "from wxPython import *" to "from
# wxPython.wx import *" This is for people who are worried about
# namespace pollution, they can use "from wxPython import wx" and then
# prefix all the wxPython identifiers with "wx."
#
# Added wxTaskbarIcon for wxMSW.
#
# Made the events work for wxGrid.
#
# Added wxConfig.
#
# Added wxMiniFrame for wxGTK, (untested.)
#
# Changed many of the args and return values that were pointers to gdi
# objects to references to reflect changes in the wxWindows API.
#
<<<<<<< test1.py
# Other assorted fixes and additions.
#
# Revision 1.2 1998/10/02 06:42:27 RD
#
# Version 0.4 of wxPython for MSW.
#
# Revision 1.1 1998/08/09 08:28:05 RD
# Initial version
#
#
=======
>>>>>>> 1.4

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

File diff suppressed because it is too large Load Diff