Refactor code finding the name of the windows class to use in wxMSW

Determine which class name to use in MSWCreate() caller instead of doing it
partly there and partly in MSWCreate() itself, which used to add the "NR"
suffix if necessary -- now it doesn't do this any more and just really created
the window using the given class.

No real changes, just prepare for future enhancements.
This commit is contained in:
Vadim Zeitlin
2016-12-18 22:04:06 +01:00
parent aac66ea877
commit 097f8a7f14
5 changed files with 41 additions and 24 deletions

View File

@@ -53,6 +53,16 @@ public:
// variant registered without CS_[HV]REDRAW styles
static const wxChar *GetNoRedrawClassSuffix() { return wxT("NR"); }
// Flags for GetRegisteredClassName()
enum
{
// Just a symbolic name indicating absence of any special flags.
RegClass_Default = 0,
// Return the name with the GetNoRedrawClassSuffix() appended to it.
RegClass_ReturnNR = 1
};
// get the name of the registered Win32 class with the given (unique) base
// name: this function constructs the unique class name using this name as
// prefix, checks if the class is already registered and registers it if it
@@ -68,7 +78,8 @@ public:
// or (default) -1 meaning that the class paints its background itself
static const wxChar *GetRegisteredClassName(const wxChar *name,
int bgBrushCol = -1,
int extraStyles = 0);
int extraStyles = 0,
int flags = RegClass_Default);
// return true if this name corresponds to one of the classes we registered
// in the previous GetRegisteredClassName() calls

View File

@@ -230,8 +230,11 @@ public:
// get the HWND to be used as parent of this window with CreateWindow()
virtual WXHWND MSWGetParent() const;
// get the Win32 window class name used by all wxWindow objects by default
static const wxChar *MSWGetRegisteredClassName();
// Return the name of the Win32 class that should be used by this wxWindow
// object, taking into account wxFULL_REPAINT_ON_RESIZE style (if it's not
// specified, the wxApp::GetNoRedrawClassSuffix()-suffixed version of the
// class is used).
const wxChar *GetMSWClassName() const;
// creates the window of specified Windows class with given style, extended
// style, title and geometry (default values