Add wxHD_BITMAP_ON_RIGHT style to wxHeaderCtrl

Implement this style for wxMSW to allow putting the column images on the
right side, for consistency with wxMSW wxListCtrl.

See #13350.
This commit is contained in:
Vadim Zeitlin
2018-02-03 15:05:46 +01:00
parent 0b1acae0a7
commit fd73ae1623
4 changed files with 15 additions and 0 deletions

View File

@@ -181,6 +181,7 @@ All (GUI):
- Add wxEVT_SEARCH[_CANCEL] synonyms for wxSearchCtrl events. - Add wxEVT_SEARCH[_CANCEL] synonyms for wxSearchCtrl events.
- Generate wxEVT_SEARCH on Enter under all platforms. - Generate wxEVT_SEARCH on Enter under all platforms.
- Extend wxRendererNative::DrawGauge() to work for vertical gauges too. - Extend wxRendererNative::DrawGauge() to work for vertical gauges too.
- Add wxHD_BITMAP_ON_RIGHT style to wxHeaderCtrl.
wxGTK: wxGTK:

View File

@@ -37,6 +37,9 @@ enum
// right clicking the header // right clicking the header
wxHD_ALLOW_HIDE = 0x0002, wxHD_ALLOW_HIDE = 0x0002,
// force putting column images on right
wxHD_BITMAP_ON_RIGHT = 0x0004,
// style used by default when creating the control // style used by default when creating the control
wxHD_DEFAULT_STYLE = wxHD_ALLOW_REORDER wxHD_DEFAULT_STYLE = wxHD_ALLOW_REORDER
}; };

View File

@@ -17,6 +17,9 @@ enum
// right clicking the header // right clicking the header
wxHD_ALLOW_HIDE = 0x0002, wxHD_ALLOW_HIDE = 0x0002,
// force putting column images on right
wxHD_BITMAP_ON_RIGHT = 0x0004,
// style used by default when creating the control // style used by default when creating the control
wxHD_DEFAULT_STYLE = wxHD_ALLOW_REORDER wxHD_DEFAULT_STYLE = wxHD_ALLOW_REORDER
}; };
@@ -76,6 +79,11 @@ enum
user to change the columns visibility on right mouse click. Notice that user to change the columns visibility on right mouse click. Notice that
the program can always hide or show the columns, this style only the program can always hide or show the columns, this style only
affects the users capability to do it. affects the users capability to do it.
@style{wxHD_BITMAP_ON_RIGHT}
The column image, if any, will be shown on the right side if this style
is used. Note that this style is only implemented in wxMSW currently
and doesn't do anything under the other platforms. It is available
since wxWidgets 3.1.1.
@style{wxHD_DEFAULT_STYLE} @style{wxHD_DEFAULT_STYLE}
Symbolic name for the default control style, currently equal to Symbolic name for the default control style, currently equal to
@c wxHD_ALLOW_REORDER. @c wxHD_ALLOW_REORDER.

View File

@@ -314,6 +314,9 @@ void wxHeaderCtrl::DoInsertItem(const wxHeaderColumn& col, unsigned int idx)
{ {
hdi.mask |= HDI_IMAGE; hdi.mask |= HDI_IMAGE;
if ( HasFlag(wxHD_BITMAP_ON_RIGHT) )
hdi.fmt |= HDF_BITMAP_ON_RIGHT;
if ( bmp.IsOk() ) if ( bmp.IsOk() )
{ {
const int bmpWidth = bmp.GetWidth(), const int bmpWidth = bmp.GetWidth(),