Replace dynamic casts with MSWShouldSetDefaultFont() virtual method
Get rid of ugly wxDynamicCastThis()s in wxMSW wxControl code and add a new virtual method overridden in wx{Tree,List}Ctrl instead. Also stop comparing the font with wxSYS_DEFAULT_GUI_FONT, there doesn't seem to be any good reason to set this particular font for these controls neither. In addition to simplifying and de-ugligying the code, this commit incidentally fixes -Wnonnull-compare warnings in this code from gcc6 too.
This commit is contained in:
@@ -70,6 +70,12 @@ public:
|
||||
virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const wxOVERRIDE;
|
||||
|
||||
protected:
|
||||
// Hook for common controls for which we don't want to set the default font
|
||||
// as if we do set it, the controls don't update their font size
|
||||
// automatically in response to WM_SETTINGCHANGE if it's changed in the
|
||||
// display properties in the control panel, so avoid doing this for them.
|
||||
virtual bool MSWShouldSetDefaultFont() const { return true; }
|
||||
|
||||
// choose the default border for this window
|
||||
virtual wxBorder GetDefaultBorder() const wxOVERRIDE;
|
||||
|
||||
|
@@ -380,6 +380,8 @@ protected:
|
||||
// common part of all ctors
|
||||
void Init();
|
||||
|
||||
virtual bool MSWShouldSetDefaultFont() const wxOVERRIDE { return false; }
|
||||
|
||||
// Implement constrained best size calculation.
|
||||
virtual int DoGetBestClientHeight(int width) const wxOVERRIDE
|
||||
{ return MSWGetBestViewRect(width, -1).y; }
|
||||
|
@@ -211,6 +211,8 @@ protected:
|
||||
int width, int height,
|
||||
int sizeFlags = wxSIZE_AUTO) wxOVERRIDE;
|
||||
|
||||
virtual bool MSWShouldSetDefaultFont() const wxOVERRIDE { return false; }
|
||||
|
||||
// SetImageList helper
|
||||
void SetAnyImageList(wxImageList *imageList, int which);
|
||||
|
||||
|
Reference in New Issue
Block a user