Dynamically size horizontal column if necessary.
This commit is contained in:
parent
2ed78cf84b
commit
14008321fe
|
@ -31,6 +31,17 @@
|
|||
#include <dialog_shim.h>
|
||||
|
||||
|
||||
/**
|
||||
* Minimum width of the hotkey column
|
||||
*/
|
||||
static const int HOTKEY_MIN_WIDTH = 100;
|
||||
|
||||
/**
|
||||
* Extra margin to compensate for vertical scrollbar
|
||||
*/
|
||||
static const int HORIZ_MARGIN = 30;
|
||||
|
||||
|
||||
/**
|
||||
* Menu IDs for the hotkey context menu
|
||||
*/
|
||||
|
@ -352,9 +363,23 @@ void WIDGET_HOTKEY_LIST::OnSize( wxSizeEvent& aEvent )
|
|||
}
|
||||
#endif
|
||||
|
||||
SetColumnWidth( 1, WIDGET_HOTKEY_LIST_HKCOLUMN_WIDTH );
|
||||
SetColumnWidth( 0,
|
||||
rect.width - WIDGET_HOTKEY_LIST_HKCOLUMN_WIDTH - WIDGET_HOTKEY_LIST_HMARGIN );
|
||||
// Find the maximum width of the hotkey column
|
||||
int hk_column_width = 0;
|
||||
|
||||
for( wxTreeListItem item = GetFirstItem(); item.IsOk(); item = GetNextItem( item ) )
|
||||
{
|
||||
const wxString& text = GetItemText( item, 1 );
|
||||
int width = WidthFor( text );
|
||||
|
||||
if( width > hk_column_width )
|
||||
hk_column_width = width;
|
||||
}
|
||||
|
||||
if( hk_column_width < HOTKEY_MIN_WIDTH )
|
||||
hk_column_width = HOTKEY_MIN_WIDTH;
|
||||
|
||||
SetColumnWidth( 1, hk_column_width );
|
||||
SetColumnWidth( 0, rect.width - hk_column_width - HORIZ_MARGIN );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -36,12 +36,6 @@
|
|||
|
||||
#include <hotkeys_basic.h>
|
||||
|
||||
/// Width of the hotkey list
|
||||
const int WIDGET_HOTKEY_LIST_HKCOLUMN_WIDTH = 100;
|
||||
|
||||
/// Extra margin to compensate for vertical scrollbar
|
||||
const int WIDGET_HOTKEY_LIST_HMARGIN = 30;
|
||||
|
||||
/**
|
||||
* struct HOTKEY_SECTION
|
||||
* Associates a hotkey configuration with a name.
|
||||
|
|
Loading…
Reference in New Issue