wxwidgets/include/wx/qt/frame.h
ali kettab 5fb8a54e14 Change the return type of QtGetScrollBarsContainer() under wxQt
Neither QListWidget nor QTextEdit derive from QScrollArea and the cast to it is
just UB. Instead, using the common base class QAbstractScrollArea is safer and
eliminates the need to these dangerous and insidious crosscast'ings.
2023-12-26 12:45:52 +01:00

78 lines
2.3 KiB
C++

/////////////////////////////////////////////////////////////////////////////
// Name: wx/qt/frame.h
// Purpose: wxFrame class interface
// Author: Peter Most
// Created: 09.08.09
// Copyright: (c) Peter Most
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_QT_FRAME_H_
#define _WX_QT_FRAME_H_
#include "wx/frame.h"
class QMainWindow;
class QAbstractScrollArea;
class WXDLLIMPEXP_CORE wxFrame : public wxFrameBase
{
public:
wxFrame() { Init(); }
wxFrame(wxWindow *parent,
wxWindowID id,
const wxString& title,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_FRAME_STYLE,
const wxString& name = wxASCII_STR(wxFrameNameStr))
{
Init();
Create( parent, id, title, pos, size, style, name );
}
virtual ~wxFrame();
bool Create(wxWindow *parent,
wxWindowID id,
const wxString& title,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_FRAME_STYLE,
const wxString& name = wxASCII_STR(wxFrameNameStr));
virtual void SetMenuBar(wxMenuBar *menubar) override;
virtual void SetStatusBar(wxStatusBar *statusBar ) override;
virtual void SetToolBar(wxToolBar *toolbar) override;
virtual void SetWindowStyleFlag( long style ) override;
virtual void AddChild( wxWindowBase *child ) override;
virtual void RemoveChild( wxWindowBase *child ) override;
QMainWindow *GetQMainWindow() const;
virtual QAbstractScrollArea *QtGetScrollBarsContainer() const override;
protected:
virtual wxPoint GetClientAreaOrigin() const override;
virtual void DoGetClientSize(int *width, int *height) const override;
virtual void DoSetClientSize(int width, int height) override;
virtual QWidget* QtGetParentWidget() const override;
private:
// Common part of all ctors.
void Init()
{
m_qtToolBar = nullptr;
}
// Currently active native toolbar.
class QToolBar* m_qtToolBar;
wxDECLARE_DYNAMIC_CLASS( wxFrame );
};
#endif // _WX_QT_FRAME_H_