Code::Blocks  SVN r11506
Classes | Public Member Functions | Private Types | Private Member Functions | Private Attributes | Friends | List of all members
cbStatusBar Class Reference

A custom status bar which can contain controls, icons... More...

#include <cbstatusbar.h>

Inheritance diagram for cbStatusBar:
Collaboration diagram for cbStatusBar:

Classes

struct  cbStatusBarElement
 

Public Member Functions

virtual void SetStatusTextByPlugin (const wxString &text, cbPlugin *plugin)
 Sets the text for one field. More...
 
virtual wxString GetStatusTextByPlugin (cbPlugin *plugin) const
 Returns the string associated with a status bar field. More...
 
virtual bool GetFieldRectByPlugin (cbPlugin *plugin, wxRect &rect) const
 Returns the size and position of a field's internal bounding rectangle. More...
 
void SetStatusWidths (int n, const int *widths) override
 
void AddField (cbPlugin *plugin, wxWindow *ctrl, int width)
 Add a new field, which contains a control, to the status bar. More...
 
void AddField (cbPlugin *plugin, int width)
 Add a new field to the status bar. More...
 
void RemoveField (cbPlugin *plugin)
 Remove a field from the status bar. More...
 
- Public Member Functions inherited from wxStatusBar
 wxStatusBar ()
 
 wxStatusBar (wxWindow *parent, wxWindowID id=wxID_ANY, long style=wxSTB_DEFAULT_STYLE, const wxString &name=wxStatusBarNameStr)
 
virtual ~wxStatusBar ()
 
bool Create (wxWindow *parent, wxWindowID id=wxID_ANY, long style=wxSTB_DEFAULT_STYLE, const wxString &name=wxStatusBarNameStr)
 
virtual bool GetFieldRect (int i, wxRect &rect) const
 
int GetFieldsCount () const
 
const wxStatusBarPaneGetField (int n) const
 
wxSize GetBorders () const
 
virtual wxString GetStatusText (int i=0) const
 
int GetStatusWidth (int n) const
 
int GetStatusStyle (int n) const
 
void PopStatusText (int field=0)
 
void PushStatusText (const wxString &string, int field=0)
 
virtual void SetFieldsCount (int number=1, const int *widths=NULL)
 
virtual void SetMinHeight (int height)
 
virtual void SetStatusStyles (int n, const int *styles)
 
virtual void SetStatusText (const wxString &text, int i=0)
 

Private Types

typedef std::vector< cbStatusBarElementElementVector
 

Private Member Functions

 cbStatusBar (wxWindow *parent, wxWindowID id, long style, const wxString &name)
 
 cbStatusBar ()
 
 cbStatusBar (const cbStatusBar &)
 
 ~cbStatusBar () override
 
void OnSize (wxSizeEvent &event)
 
void UpdateWidths ()
 
void AdjustFieldsSize ()
 
int GetFieldNumberOfPlugin (cbPlugin *plugin) const
 
void PushStatusText (cb_unused const wxString &text, cb_unused cbPlugin *plugin)
 
void PopStatusText (cb_unused cbPlugin *plugin)
 

Private Attributes

ElementVector m_Elements
 
std::vector< int > m_MainWidths
 

Friends

class MainFrame
 

Detailed Description

A custom status bar which can contain controls, icons...

Definition at line 18 of file cbstatusbar.h.


Class Documentation

◆ cbStatusBar::cbStatusBarElement

struct cbStatusBar::cbStatusBarElement

Definition at line 81 of file cbstatusbar.h.

Collaboration diagram for cbStatusBar::cbStatusBarElement:
Class Members
wxWindow * control
cbPlugin * plugin
int width

Member Typedef Documentation

◆ ElementVector

typedef std::vector<cbStatusBarElement> cbStatusBar::ElementVector
private

Definition at line 87 of file cbstatusbar.h.

Constructor & Destructor Documentation

◆ cbStatusBar() [1/3]

cbStatusBar::cbStatusBar ( wxWindow parent,
wxWindowID  id,
long  style,
const wxString name 
)
private

◆ cbStatusBar() [2/3]

cbStatusBar::cbStatusBar ( )
inlineprivate

Definition at line 25 of file cbstatusbar.h.

References MainFrame::OnSize(), and wxStatusBar::SetStatusWidths().

◆ cbStatusBar() [3/3]

cbStatusBar::cbStatusBar ( const cbStatusBar )
private

◆ ~cbStatusBar()

cbStatusBar::~cbStatusBar ( )
overrideprivate

Definition at line 34 of file cbstatusbar.cpp.

Member Function Documentation

◆ AddField() [1/2]

void cbStatusBar::AddField ( cbPlugin plugin,
wxWindow ctrl,
int  width 
)

Add a new field, which contains a control, to the status bar.

Parameters
pluginThe plugin which wants to add a new statusfield
ctrlPointer to the control to show on the new field.
widthWidth of the new field. See wxStatusBar::SetStatusWidths for the meaning of this parameter.

Definition at line 72 of file cbstatusbar.cpp.

References cbStatusBar::cbStatusBarElement::control, m_Elements, cbStatusBar::cbStatusBarElement::plugin, UpdateWidths(), and cbStatusBar::cbStatusBarElement::width.

Referenced by AddField().

◆ AddField() [2/2]

void cbStatusBar::AddField ( cbPlugin plugin,
int  width 
)

Add a new field to the status bar.

The field contains no control.

See also
cbStatusBar::AddField(cbPlugin *plugin, wxWindow *ctrl, int width) for details.

Definition at line 85 of file cbstatusbar.cpp.

References AddField(), and NULL.

◆ AdjustFieldsSize()

void cbStatusBar::AdjustFieldsSize ( )
private

◆ GetFieldNumberOfPlugin()

int cbStatusBar::GetFieldNumberOfPlugin ( cbPlugin plugin) const
private

Definition at line 141 of file cbstatusbar.cpp.

References m_Elements, and m_MainWidths.

Referenced by GetFieldRectByPlugin(), GetStatusTextByPlugin(), and SetStatusTextByPlugin().

◆ GetFieldRectByPlugin()

bool cbStatusBar::GetFieldRectByPlugin ( cbPlugin plugin,
wxRect rect 
) const
virtual

Returns the size and position of a field's internal bounding rectangle.

Parameters
pluginThe plugin which wants to know its status-field size.
rectThe rectangle values are placed in this variable.
Returns
true if the field id is valid, false otherwise.

Definition at line 53 of file cbstatusbar.cpp.

References GetFieldNumberOfPlugin(), and wxStatusBar::GetFieldRect().

Referenced by AdjustFieldsSize().

◆ GetStatusTextByPlugin()

wxString cbStatusBar::GetStatusTextByPlugin ( cbPlugin plugin) const
virtual

Returns the string associated with a status bar field.

Parameters
pluginThe plugin which wants to get its status text
Returns
The status field string if the field id is valid, otherwise the empty string.

Definition at line 45 of file cbstatusbar.cpp.

References GetFieldNumberOfPlugin(), wxStatusBar::GetStatusText(), and wxEmptyString.

◆ OnSize()

void cbStatusBar::OnSize ( wxSizeEvent event)
private

Definition at line 105 of file cbstatusbar.cpp.

References AdjustFieldsSize().

◆ PopStatusText()

void cbStatusBar::PopStatusText ( cb_unused cbPlugin plugin)
inlineprivate

Definition at line 79 of file cbstatusbar.h.

◆ PushStatusText()

void cbStatusBar::PushStatusText ( cb_unused const wxString text,
cb_unused cbPlugin plugin 
)
inlineprivate

Definition at line 78 of file cbstatusbar.h.

◆ RemoveField()

void cbStatusBar::RemoveField ( cbPlugin plugin)

Remove a field from the status bar.

If a control is associated wit this filed, RemoveField will destroy it.

Parameters
idThe plugin which wants to remove its field

Definition at line 90 of file cbstatusbar.cpp.

References m_Elements, and UpdateWidths().

Referenced by MainFrame::OnPluginUnloaded().

◆ SetStatusTextByPlugin()

void cbStatusBar::SetStatusTextByPlugin ( const wxString text,
cbPlugin plugin 
)
virtual

Sets the text for one field.

Parameters
textThe text to be set.
pluginThe pugin which wants to set its status text

Definition at line 38 of file cbstatusbar.cpp.

References GetFieldNumberOfPlugin(), and wxStatusBar::SetStatusText().

◆ SetStatusWidths()

void cbStatusBar::SetStatusWidths ( int  n,
const int *  widths 
)
overridevirtual

Reimplemented from wxStatusBar.

Definition at line 61 of file cbstatusbar.cpp.

References m_MainWidths, and UpdateWidths().

◆ UpdateWidths()

void cbStatusBar::UpdateWidths ( )
private

Friends And Related Function Documentation

◆ MainFrame

friend class MainFrame
friend

Definition at line 21 of file cbstatusbar.h.

Member Data Documentation

◆ m_Elements

ElementVector cbStatusBar::m_Elements
private

◆ m_MainWidths

std::vector<int> cbStatusBar::m_MainWidths
private

Definition at line 89 of file cbstatusbar.h.

Referenced by GetFieldNumberOfPlugin(), SetStatusWidths(), and UpdateWidths().


The documentation for this class was generated from the following files: