changed/centralized window creation code to allow wxTLW work in wxUniv

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11880 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2001-10-07 22:17:24 +00:00
parent f1e1ed3b77
commit b225f65995
18 changed files with 625 additions and 711 deletions

View File

@@ -92,20 +92,21 @@ protected:
virtual wxSize DoGetBestSize() const;
// create the control of the given class with the given style, returns FALSE
// if creation failed
// create the control of the given class with the given style (combination
// of WS_XXX flags, i.e. Windows style, not wxWindows one), returns
// FALSE if creation failed
//
// All parameters except classname and style are optional, if the
// size/position are not given, they should be set later with SetSize() and,
// label (the title of the window), of course, is left empty. The extended
// style is determined from the style and the app 3D settings automatically
// if it's not specified explicitly.
// size/position are not given, they should be set later with SetSize()
// and, label (the title of the window), of course, is left empty. The
// extended style is determined from the style and the app 3D settings
// automatically if it's not specified explicitly.
bool MSWCreateControl(const wxChar *classname,
WXDWORD style,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
const wxString& label = wxEmptyString,
WXDWORD exstyle = (WXDWORD)-1);
WXDWORD style,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
const wxString& label = wxEmptyString,
WXDWORD exstyle = (WXDWORD)-1);
// determine the extended styles combination for this window (may slightly
// modify style parameter, this is why it's non const)

View File

@@ -93,10 +93,6 @@ public:
bool HandleCommand(WXWORD id, WXWORD cmd, WXHWND control);
bool HandleMenuSelect(WXWORD nItem, WXWORD nFlags, WXHMENU hMenu);
bool MSWCreate(int id, wxWindow *parent, const wxChar *wclass,
wxWindow *wx_win, const wxChar *title,
int x, int y, int width, int height, long style);
// tooltip management
#if wxUSE_TOOLTIPS
WXHWND GetToolTipCtrl() const { return m_hwndToolTip; }

View File

@@ -21,8 +21,8 @@
#include <windows.h>
#ifdef __WXMICROWIN__
/* Extra prototypes and symbols not defined by MicroWindows */
#include "wx/msw/microwin.h"
// Extra prototypes and symbols not defined by MicroWindows
#include "wx/msw/microwin.h"
#endif
// undefine conflicting symbols which were defined in windows.h

View File

@@ -36,22 +36,6 @@
// so there is little advantage to setting it to 1.
#define WXWIN_COMPATIBILITY 0
// This setting determines the compatibility with 2.0 API: set it to 1 to
// enable it
//
// Default is 0.
//
// Recommended setting: 0 (please update your code instead!)
#define WXWIN_COMPATIBILITY_2 0
// This setting determines the compatibility with 2.0 API: set it to 1 to
// enable it
//
// Default is 0.
//
// Recommended setting: 0 (please update your code instead!)
#define WXWIN_COMPATIBILITY_2_2 0
// in wxMSW version 2.1.11 and earlier, wxIcon always derives from wxBitmap,
// but this is very dangerous because you can mistakenly pass an icon instead
// of a bitmap to a function taking "const wxBitmap&" - which will *not* work
@@ -104,7 +88,7 @@
// Default is 1.
//
// Recommended setting: 1 but see comment above
#define wxUSE_DEBUG_CONTEXT 1
#define wxUSE_DEBUG_CONTEXT 0
// If 1, enables debugging versions of wxObject::new and wxObject::delete *IF*
// __WXDEBUG__ is also defined.
@@ -115,7 +99,7 @@
// Default is 1
//
// Recommended setting: 1 but see comment in the beginning of this section
#define wxUSE_MEMORY_TRACING 1
#define wxUSE_MEMORY_TRACING 0
// In debug mode, cause new and delete to be redefined globally.
// If this causes problems (e.g. link errors), set this to 0.
@@ -124,7 +108,7 @@
// Default is 1
//
// Recommended setting: 1 but see comment in the beginning of this section
#define wxUSE_GLOBAL_MEMORY_OPERATORS 1
#define wxUSE_GLOBAL_MEMORY_OPERATORS 0
// In debug mode, causes new to be defined to be WXDEBUG_NEW (see object.h). If
// this causes problems (e.g. link errors), set this to 0. You may need to set
@@ -134,7 +118,7 @@
// Default is 1
//
// Recommended setting: 1 but see comment in the beginning of this section
#define wxUSE_DEBUG_NEW_ALWAYS 1
#define wxUSE_DEBUG_NEW_ALWAYS 0
// wxHandleFatalExceptions() may be used to catch the program faults at run
// time and, instead of terminating the program with a usual GPF message box,
@@ -193,20 +177,12 @@
// Recommended setting: 1 (always)
#define wxUSE_LOG 1
// Support for command line parsing using wxCmdLineParser class.
//
// Default is 1
//
// Recommended setting: 1 (can be set to 0 if you don't use the cmd line)
#define wxUSE_CMDLINE_PARSER 1
// Recommended setting: 1
#define wxUSE_LOGWINDOW 1
// Recommended setting: 1
// Recommended setting: 1 (always)
#define wxUSE_LOGGUI 1
// Recommended setting: 1
// Recommended setting: 1 (always)
#define wxUSE_LOG_DIALOG 1
// Support for multithreaded applications: if 1, compile in thread classes
@@ -264,7 +240,7 @@
// i18n support: _() macro, wxLocale class. Requires wxTextFile.
#define wxUSE_INTL 1
// Set wxUSE_DATETIME to 1 to compile the wxDateTime and related classes which
// Set wxUSE_TIMEDATE to 1 to compile the wxDateTime and related classes which
// allow to manipulate dates, times and time intervals. wxDateTime replaces the
// old wxTime and wxDate classes which are still provided for backwards
// compatibility (and implemented in terms of wxDateTime).
@@ -276,20 +252,9 @@
//
// Requires: wxUSE_LONGLONG
//
// Default is 1
//
// Recommended setting: 1
#define wxUSE_DATETIME 1
// wxUSE_TIMEDATE enables compilation of the old wxDate and wxTime classes (not
// the same as wxDateTime!). These classes are obsolete and shouldn't be used
// in new code
//
// Default is 0
//
// Recommended setting: 0 unless you have legacy code which uses these classes
#define wxUSE_TIMEDATE 0
// Set wxUSE_TIMER to 1 to compile wxTimer class
//
// Default is 1
@@ -365,6 +330,8 @@
// wxUSE_LIBPNG.
#define wxUSE_ZLIB 1
#define wxUSE_REGEX 1
// If enabled, the code written by Apple will be used to write, in a portable
// way, float on the disk. See extended.c for the license which is different
// from wxWindows one.
@@ -383,22 +350,6 @@
// wxMimeTypesManager class
#define wxUSE_MIMETYPE 1
// wxSystemOptions class
#define wxUSE_SYSTEM_OPTIONS 1
// Support for regular expression matching via wxRegEx class: enable this to
// use POSIX regular expressions in your code. You need to compile regex
// library from src/regex to use it under Windows.
//
// Default is 0
//
// Recommended setting: 1 if your compiler supports it, if it doesn't please
// contribute us a makefile for src/regex for it
#define wxUSE_REGEX 0
// wxWave class
#define wxUSE_WAVE 1
// ----------------------------------------------------------------------------
// Individual GUI controls
// ----------------------------------------------------------------------------
@@ -576,9 +527,6 @@
// wxValidator class and related methods
#define wxUSE_VALIDATORS 1
// wxDC cacheing implementation
#define wxUSE_DC_CACHEING 1
// ----------------------------------------------------------------------------
// common dialogs
// ----------------------------------------------------------------------------
@@ -601,29 +549,6 @@
// Recommended setting: 1 (unless it really doesn't work)
#define wxUSE_COMMON_DIALOGS 1
// wxBusyInfo displays window with message when app is busy. Works in same way
// as wxBusyCursor
#define wxUSE_BUSYINFO 1
// Use single/multiple choice dialogs.
//
// Default is 1
//
// Recommended setting: 1 (used in the library itself)
#define wxUSE_CHOICEDLG 1
// Use colour picker dialog
//
// Default is 1
//
// Recommended setting: 1
#define wxUSE_COLOURDLG 1
// wxDirDlg class for getting a directory name from user
#define wxUSE_DIRDLG 1
// TODO: setting to choose the generic or native one
// Use file open/save dialogs.
//
// Default is 1
@@ -631,11 +556,6 @@
// Recommended setting: 1 (used in many places in the library itself)
#define wxUSE_FILEDLG 1
// Use find/replace dialogs.
//
// Default is 1
//
// Recommended setting: 1 (but may be safely set to 0)
#define wxUSE_FINDREPLDLG 1
// Use font picker dialog
@@ -652,22 +572,38 @@
// Recommended setting: 1 (used in the library itself)
#define wxUSE_MSGDLG 1
// progress dialog class for lengthy operations
#define wxUSE_PROGRESSDLG 1
// Use single/multiple choice dialogs.
//
// Default is 1
//
// Recommended setting: 1 (used in the library itself)
#define wxUSE_CHOICEDLG 1
// support for startup tips (wxShowTip &c)
#define wxUSE_STARTUP_TIPS 1
// Use colour picker dialog
//
// Default is 1
//
// Recommended setting: 1
#define wxUSE_COLOURDLG 1
// text entry dialog and wxGetTextFromUser function
#define wxUSE_TEXTDLG 1
// number entry dialog
#define wxUSE_NUMBERDLG 1
// splash screen class
#define wxUSE_SPLASH 1
// progress dialog class for lengthy operations
#define wxUSE_PROGRESSDLG 1
// wxBusyInfo displays window with message when app is busy. Works in same way
// as wxBusyCursor
#define wxUSE_BUSYINFO 1
// wxDirDlg class for getting a directory name from user
#define wxUSE_DIRDLG 1
// support for startup tips (wxShowTip &c)
#define wxUSE_STARTUP_TIPS 1
// wizards
#define wxUSE_WIZARDDLG 1
// ----------------------------------------------------------------------------
@@ -768,10 +704,7 @@
// 0 for no help facility
#define wxUSE_MS_HTML_HELP 0
// 0 for no MS HTML Help
// Use wxHTML-based help controller?
#define wxUSE_WXHTML_HELP 1
#define wxUSE_RESOURCES 1
// 0 for no wxGetResource/wxWriteResource
#define wxUSE_CONSTRAINTS 1
@@ -890,7 +823,6 @@
// Set to 1 for XPM format support
#define wxUSE_XPM 1
// Set to 1 to compile in wxPalette class
#define wxUSE_PALETTE 1
// ----------------------------------------------------------------------------
@@ -1176,7 +1108,7 @@
// you need to modify setup.h and rebuild everything
// ----------------------------------------------------------------------------
#if wxUSE_DATETIME && !wxUSE_LONGLONG
#if wxUSE_TIMEDATE && !wxUSE_LONGLONG
#error wxDateTime requires wxLongLong
#endif

View File

@@ -70,12 +70,30 @@ protected:
// common part of all ctors
void Init();
// create a new frame, return FALSE if it couldn't be created
bool CreateFrame(const wxString& title,
const wxPoint& pos,
const wxSize& size);
// create a new dialog using the given dialog template from resources,
// return FALSE if it couldn't be created
bool CreateDialog(const wxChar *dlgTemplate,
const wxString& title,
const wxPoint& pos,
const wxSize& size);
// common part of Iconize(), Maximize() and Restore()
void DoShowWindow(int nShowCmd);
// implement the geometry-related methods for a top level window
virtual void DoSetClientSize(int width, int height);
// get the MSW window flags corresponding to wxWindows ones
//
// the functions returns the flags (WS_XXX) directly and puts the ext
// (WS_EX_XXX) flags into the provided pointer if not NULL
long MSWGetCreateWindowFlags(long *exflags) const;
// is the frame currently iconized?
bool m_iconized;

View File

@@ -217,16 +217,26 @@ public:
// MSW only: TRUE if this control is part of the main control
virtual bool ContainsHWND(WXHWND WXUNUSED(hWnd)) const { return FALSE; };
// returns TRUE if the window has been created
bool MSWCreate(int id,
wxWindow *parent,
const wxChar *wclass,
wxWindow *wx_win,
const wxChar *title,
int x, int y, int width, int height,
WXDWORD style,
const wxChar *dialog_template = NULL,
// translate wxWindows coords into Windows ones suitable to be passed to
// ::CreateWindow()
//
// returns TRUE if non default coords are returned, FALSE otherwise
bool MSWGetCreateWindowCoords(const wxPoint& pos,
const wxSize& size,
int& x, int& y,
int& w, int& h) const;
// creates the window of specified Windows class with given style, extended
// style, title and geometry (default values
//
// returns TRUE if the window has been created, FALSE if creation failed
bool MSWCreate(const wxChar *wclass,
const wxChar *title = NULL,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
WXDWORD style = 0,
WXDWORD exendedStyle = 0);
virtual bool MSWCommand(WXUINT param, WXWORD id);
#if WXWIN_COMPATIBILITY
@@ -463,5 +473,15 @@ private:
WXDLLEXPORT int wxCharCodeMSWToWX(int keySym);
WXDLLEXPORT int wxCharCodeWXToMSW(int id, bool *IsVirtual);
// window creation helper class: before creating a new HWND, instantiate an
// object of this class on stack - this allows to process the messages sent to
// the window even before CreateWindow() returns
class wxWindowCreationHook
{
public:
wxWindowCreationHook(wxWindowMSW *winBeingCreated);
~wxWindowCreationHook();
};
#endif
// _WX_WINDOW_H_

View File

@@ -25,6 +25,24 @@
// elsewhere because the functions, unlike the macros, respect the scope.
// ----------------------------------------------------------------------------
// CreateDialog
#ifdef CreateDialog
#undef CreateDialog
inline HWND CreateDialog(HINSTANCE hInstance,
LPCTSTR pTemplate,
HWND hwndParent,
DLGPROC pDlgProc)
{
#ifdef _UNICODE
return CreateDialogW(hInstance, pTemplate, hwndParent, pDlgProc);
#else
return CreateDialogA(hInstance, pTemplate, hwndParent, pDlgProc);
#endif
}
#endif
// GetCharWidth
#ifdef GetCharWidth

View File

@@ -975,7 +975,7 @@ protected:
virtual void DoSetClientData( void *data );
virtual void *DoGetClientData() const;
// Makes an adjustment to the window position (for example, a frame that has
// a toolbar that it manages itself).
virtual void AdjustForParentClientOrigin(int& x, int& y, int sizeFlags);