tab ctrl height api fix
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@43388 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
2201013094
commit
ca0d44071c
@ -532,10 +532,11 @@ public:
|
||||
|
||||
virtual void SetUniformBitmapSize(const wxSize& size);
|
||||
virtual void SetTabCtrlHeight(int height);
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
// these can be overridden
|
||||
virtual void UpdateTabCtrlHeight();
|
||||
virtual int CalculateTabCtrlHeight();
|
||||
virtual wxSize CalculateNewSplitSize();
|
||||
|
||||
@ -571,6 +572,7 @@ protected:
|
||||
wxWindow* m_dummy_wnd;
|
||||
|
||||
wxSize m_requested_bmp_size;
|
||||
int m_requested_tabctrl_height;
|
||||
wxFont m_selected_font;
|
||||
wxFont m_normal_font;
|
||||
int m_tab_ctrl_height;
|
||||
|
@ -2379,6 +2379,7 @@ wxAuiNotebook::wxAuiNotebook()
|
||||
m_dummy_wnd = NULL;
|
||||
m_tab_ctrl_height = 20;
|
||||
m_requested_bmp_size = wxDefaultSize;
|
||||
m_requested_tabctrl_height = -1;
|
||||
}
|
||||
|
||||
wxAuiNotebook::wxAuiNotebook(wxWindow *parent,
|
||||
@ -2389,6 +2390,7 @@ wxAuiNotebook::wxAuiNotebook(wxWindow *parent,
|
||||
{
|
||||
m_dummy_wnd = NULL;
|
||||
m_requested_bmp_size = wxDefaultSize;
|
||||
m_requested_tabctrl_height = -1;
|
||||
InitNotebook(style);
|
||||
}
|
||||
|
||||
@ -2413,9 +2415,11 @@ void wxAuiNotebook::InitNotebook(long style)
|
||||
m_curpage = -1;
|
||||
m_tab_id_counter = 10000;
|
||||
m_dummy_wnd = NULL;
|
||||
m_tab_ctrl_height = 20;
|
||||
m_flags = (unsigned int)style;
|
||||
|
||||
m_tab_ctrl_height = 20;
|
||||
m_requested_bmp_size = wxDefaultSize;
|
||||
m_requested_tabctrl_height = -1;
|
||||
|
||||
m_normal_font = *wxNORMAL_FONT;
|
||||
m_selected_font = *wxNORMAL_FONT;
|
||||
m_selected_font.SetWeight(wxBOLD);
|
||||
@ -2444,9 +2448,35 @@ void wxAuiNotebook::SetArtProvider(wxAuiTabArt* art)
|
||||
{
|
||||
m_tabs.SetArtProvider(art);
|
||||
|
||||
SetTabCtrlHeight(CalculateTabCtrlHeight());
|
||||
UpdateTabCtrlHeight();
|
||||
}
|
||||
|
||||
// SetTabCtrlHeight() is the highest-level override of the
|
||||
// tab height. A call to this function effectively enforces a
|
||||
// specified tab ctrl height, overriding all other considerations,
|
||||
// such as text or bitmap height. It overrides any call to
|
||||
// SetUniformBitmapSize(). Specifying a height of -1 reverts
|
||||
// any previous call and returns to the default behavior
|
||||
|
||||
void wxAuiNotebook::SetTabCtrlHeight(int height)
|
||||
{
|
||||
m_requested_tabctrl_height = height;
|
||||
|
||||
// if window is already initialized, recalculate the tab height
|
||||
if (m_dummy_wnd)
|
||||
{
|
||||
UpdateTabCtrlHeight();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// SetUniformBitmapSize() ensures that all tabs will have
|
||||
// the same height, even if some tabs don't have bitmaps
|
||||
// Passing wxDefaultSize to this function will instruct
|
||||
// the control to use dynamic tab height-- so when a tab
|
||||
// with a large bitmap is added, the tab ctrl's height will
|
||||
// automatically increase to accommodate the bitmap
|
||||
|
||||
void wxAuiNotebook::SetUniformBitmapSize(const wxSize& size)
|
||||
{
|
||||
m_requested_bmp_size = size;
|
||||
@ -2454,12 +2484,17 @@ void wxAuiNotebook::SetUniformBitmapSize(const wxSize& size)
|
||||
// if window is already initialized, recalculate the tab height
|
||||
if (m_dummy_wnd)
|
||||
{
|
||||
SetTabCtrlHeight(CalculateTabCtrlHeight());
|
||||
UpdateTabCtrlHeight();
|
||||
}
|
||||
}
|
||||
|
||||
void wxAuiNotebook::SetTabCtrlHeight(int height)
|
||||
// UpdateTabCtrlHeight() does the actual tab resizing. It's meant
|
||||
// to be used interally
|
||||
void wxAuiNotebook::UpdateTabCtrlHeight()
|
||||
{
|
||||
// get the tab ctrl height we will use
|
||||
int height = CalculateTabCtrlHeight();
|
||||
|
||||
// if the tab control height needs to change, update
|
||||
// all of our tab controls with the new height
|
||||
if (m_tab_ctrl_height != height)
|
||||
@ -2536,6 +2571,12 @@ wxSize wxAuiNotebook::CalculateNewSplitSize()
|
||||
|
||||
int wxAuiNotebook::CalculateTabCtrlHeight()
|
||||
{
|
||||
// if a fixed tab ctrl height is specified,
|
||||
// just return that instead of calculating a
|
||||
// tab height
|
||||
if (m_requested_tabctrl_height != -1)
|
||||
return m_requested_tabctrl_height;
|
||||
|
||||
// find out new best tab height
|
||||
wxAuiTabArt* art = m_tabs.GetArtProvider();
|
||||
|
||||
@ -2612,7 +2653,7 @@ bool wxAuiNotebook::InsertPage(size_t page_idx,
|
||||
else
|
||||
active_tabctrl->InsertPage(page, info, page_idx);
|
||||
|
||||
SetTabCtrlHeight(CalculateTabCtrlHeight());
|
||||
UpdateTabCtrlHeight();
|
||||
DoSizing();
|
||||
active_tabctrl->DoShowHide();
|
||||
|
||||
@ -2757,7 +2798,7 @@ bool wxAuiNotebook::SetPageBitmap(size_t page_idx, const wxBitmap& bitmap)
|
||||
page_info.bitmap = bitmap;
|
||||
|
||||
// tab height might have changed
|
||||
SetTabCtrlHeight(CalculateTabCtrlHeight());
|
||||
UpdateTabCtrlHeight();
|
||||
|
||||
// update what's on screen
|
||||
wxAuiTabCtrl* ctrl;
|
||||
|
@ -701,7 +701,7 @@ bool wxAuiMDIClientWindow::CreateClient(wxAuiMDIParentFrame* parent, long style)
|
||||
wxSize(wxSystemSettings::GetMetric(wxSYS_SMALLICON_X),
|
||||
wxSystemSettings::GetMetric(wxSYS_SMALLICON_Y));
|
||||
SetUniformBitmapSize(caption_icon_size);
|
||||
|
||||
|
||||
if (!wxAuiNotebook::Create(parent,
|
||||
wxID_ANY,
|
||||
wxPoint(0,0),
|
||||
|
Loading…
Reference in New Issue
Block a user