wxwidgets/include/wx/qt/statusbar.h
ali kettab 5c46947c57 Fix wxStatusBar with field controls under wxQt
Postpone the creation of the QStatusBar fields until the first call to
SetStatusText(). This is to account for any field control added by the
user and also to avoid having to call UpdateFields() multiple times.

wxSTB_ELLIPSIZE_XXX and wxSTB_SHOW_TIPS supports are also implemented now.

The statbar sample is also updated: The OnSize() handler is removed because
it doesn't do much. that is: it is defined to keep the bitmap centered in the
status bar field it occupies if it is resized. but this is already done by the
wxStaticBitmap control, at least under wxMSW, wxGTK3 and wxQt.
2023-12-07 17:20:00 +01:00

49 lines
1.5 KiB
C++

/////////////////////////////////////////////////////////////////////////////
// Name: wx/qt/statusbar.h
// Author: Peter Most, Javier Torres, Mariano Reingart, Sean D'Epagnier
// Copyright: (c) 2010 wxWidgets dev team
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_QT_STATUSBAR_H_
#define _WX_QT_STATUSBAR_H_
#include "wx/statusbr.h"
class QStatusBar;
class WXDLLIMPEXP_CORE wxStatusBar : public wxStatusBarBase
{
public:
wxStatusBar() = default;
wxStatusBar(wxWindow *parent, wxWindowID winid = wxID_ANY,
long style = wxSTB_DEFAULT_STYLE,
const wxString& name = wxASCII_STR(wxStatusBarNameStr));
bool Create(wxWindow *parent, wxWindowID winid = wxID_ANY,
long style = wxSTB_DEFAULT_STYLE,
const wxString& name = wxASCII_STR(wxStatusBarNameStr));
virtual void SetStatusWidths(int n, const int widths_field[]) override;
virtual bool GetFieldRect(int i, wxRect& rect) const override;
virtual void SetMinHeight(int height) override;
virtual int GetBorderX() const override;
virtual int GetBorderY() const override;
QStatusBar *GetQStatusBar() const { return m_qtStatusBar; }
QWidget *GetHandle() const override;
protected:
virtual void DoUpdateStatusText(int number) override;
private:
void UpdateFields();
QStatusBar *m_qtStatusBar = nullptr;
std::vector<QWidget*> m_qtPanes;
wxDECLARE_DYNAMIC_CLASS(wxStatusBar);
};
#endif // _WX_QT_STATUSBAR_H_