Hugin trunk 0.1
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Private Attributes | List of all members
SplitButton Class Reference

#include <SplitButton.h>

Inheritance diagram for SplitButton:
Inheritance graph

Public Member Functions

 SplitButton ()
 constructor
 
 SplitButton (wxWindow *parent, wxWindowID id=wxID_ANY, const wxString &label=wxEmptyString, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, const wxString &name="splitbutton")
 
bool Create (wxWindow *parent, wxWindowID id=wxID_ANY, const wxString &label=wxEmptyString, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, const wxString &name="splitbutton")
 for two-step creation
 
 ~SplitButton ()
 
wxMenuGetSplitButtonMenu ()
 returns a pointer to the drop down menu
 
bool Enable (bool enable=true) override
 enable or disable the control
 
wxBitmap GetBitmap () const
 returns the currently active bitmap
 
void SetBitmap (const wxBitmapBundle &bitmap)
 sets bitmap bundle
 
wxMenuLoadMenu (const wxString &name)
 loads the drop down menu from the XRC ressource
 
void SetLabel (const wxString &label) override
 set the label string
 
wxString GetLabel () const override
 return the label of the button
 

Protected Member Functions

void OnKillFocus (wxFocusEvent &event)
 some event handler to mimic default mouse over behaviour
 
void OnMouseLeave (wxMouseEvent &event)
 
void OnMouseEnter (wxMouseEvent &event)
 
void OnLeftButtonUp (wxMouseEvent &event)
 handle left mouse button on button and drop down button
 
void OnLeftButtonDown (wxMouseEvent &event)
 
void OnPaint (wxPaintEvent &WXUNUSED(event))
 paint handler to draw to the button
 
bool HasBitmap () const
 return true if buttons has a bitmap assigned
 
void UpdateMinSize ()
 update the internal size calculation
 

Private Attributes

int m_stateButton = 0
 
int m_stateMenu = 0
 
bool m_IsEnabled = true
 
const int m_arrowButtonWidth = 20
 
wxString m_label
 
wxMenum_dropDownMenu = nullptr
 
wxBitmapBundle m_bitmap
 

Detailed Description

Definition at line 29 of file SplitButton.h.

Constructor & Destructor Documentation

◆ SplitButton() [1/2]

SplitButton::SplitButton ( )
inline

constructor

Definition at line 33 of file SplitButton.h.

◆ SplitButton() [2/2]

SplitButton::SplitButton ( wxWindow *  parent,
wxWindowID  id = wxID_ANY,
const wxString label = wxEmptyString,
const wxPoint pos = wxDefaultPosition,
const wxSize size = wxDefaultSize,
const wxString name = "splitbutton" 
)
inline

Definition at line 34 of file SplitButton.h.

References Create(), and threshold().

◆ ~SplitButton()

SplitButton::~SplitButton ( )

Definition at line 58 of file SplitButton.cpp.

References m_dropDownMenu.

Member Function Documentation

◆ Create()

bool SplitButton::Create ( wxWindow *  parent,
wxWindowID  id = wxID_ANY,
const wxString label = wxEmptyString,
const wxPoint pos = wxDefaultPosition,
const wxSize size = wxDefaultSize,
const wxString name = "splitbutton" 
)

◆ Enable()

bool SplitButton::Enable ( bool  enable = true)
override

enable or disable the control

Definition at line 224 of file SplitButton.cpp.

References m_IsEnabled, m_stateButton, m_stateMenu, and threshold().

Referenced by GLPreviewFrame::panoramaChanged().

◆ GetBitmap()

wxBitmap SplitButton::GetBitmap ( ) const

returns the currently active bitmap

Definition at line 243 of file SplitButton.cpp.

References HasBitmap(), m_bitmap, and threshold().

Referenced by OnPaint().

◆ GetLabel()

wxString SplitButton::GetLabel ( ) const
override

return the label of the button

Definition at line 271 of file SplitButton.cpp.

References m_label.

◆ GetSplitButtonMenu()

wxMenu * SplitButton::GetSplitButtonMenu ( )

returns a pointer to the drop down menu

Definition at line 64 of file SplitButton.cpp.

References m_dropDownMenu.

Referenced by GLPreviewFrame::AddUserDefinedAssistant(), GLPreviewFrame::AddUserDefinedSequence(), and GLPreviewFrame::GLPreviewFrame().

◆ HasBitmap()

bool SplitButton::HasBitmap ( ) const
protected

return true if buttons has a bitmap assigned

Definition at line 194 of file SplitButton.cpp.

References m_bitmap.

Referenced by GetBitmap(), OnPaint(), and UpdateMinSize().

◆ LoadMenu()

wxMenu * SplitButton::LoadMenu ( const wxString name)

loads the drop down menu from the XRC ressource

Definition at line 258 of file SplitButton.cpp.

References m_dropDownMenu.

Referenced by GLPreviewFrame::GLPreviewFrame().

◆ OnKillFocus()

void SplitButton::OnKillFocus ( wxFocusEvent event)
protected

some event handler to mimic default mouse over behaviour

Definition at line 69 of file SplitButton.cpp.

References m_stateButton, and m_stateMenu.

Referenced by Create().

◆ OnLeftButtonDown()

void SplitButton::OnLeftButtonDown ( wxMouseEvent event)
protected

Definition at line 123 of file SplitButton.cpp.

References m_arrowButtonWidth, m_dropDownMenu, m_stateButton, m_stateMenu, and threshold().

Referenced by Create().

◆ OnLeftButtonUp()

void SplitButton::OnLeftButtonUp ( wxMouseEvent event)
protected

handle left mouse button on button and drop down button

Definition at line 96 of file SplitButton.cpp.

References m_arrowButtonWidth, m_stateButton, m_stateMenu, and threshold().

Referenced by Create().

◆ OnMouseEnter()

void SplitButton::OnMouseEnter ( wxMouseEvent event)
protected

Definition at line 87 of file SplitButton.cpp.

References m_stateButton, m_stateMenu, and threshold().

Referenced by Create().

◆ OnMouseLeave()

void SplitButton::OnMouseLeave ( wxMouseEvent event)
protected

Definition at line 78 of file SplitButton.cpp.

References m_stateButton, and m_stateMenu.

Referenced by Create().

◆ OnPaint()

void SplitButton::OnPaint ( wxPaintEvent WXUNUSEDevent)
protected

paint handler to draw to the button

Definition at line 158 of file SplitButton.cpp.

References GetBitmap(), HasBitmap(), m_arrowButtonWidth, m_IsEnabled, m_label, m_stateButton, m_stateMenu, and threshold().

Referenced by Create().

◆ SetBitmap()

void SplitButton::SetBitmap ( const wxBitmapBundle bitmap)

sets bitmap bundle

Definition at line 252 of file SplitButton.cpp.

References m_bitmap, and UpdateMinSize().

Referenced by GLPreviewFrame::GLPreviewFrame().

◆ SetLabel()

void SplitButton::SetLabel ( const wxString label)
override

set the label string

Definition at line 265 of file SplitButton.cpp.

References m_label, and UpdateMinSize().

Referenced by GLPreviewFrame::panoramaChanged().

◆ UpdateMinSize()

void SplitButton::UpdateMinSize ( )
protected

update the internal size calculation

Definition at line 199 of file SplitButton.cpp.

References HasBitmap(), m_arrowButtonWidth, m_bitmap, m_label, and threshold().

Referenced by Create(), SetBitmap(), and SetLabel().

Member Data Documentation

◆ m_arrowButtonWidth

const int SplitButton::m_arrowButtonWidth = 20
private

Definition at line 87 of file SplitButton.h.

Referenced by OnLeftButtonDown(), OnLeftButtonUp(), OnPaint(), and UpdateMinSize().

◆ m_bitmap

wxBitmapBundle SplitButton::m_bitmap
private

Definition at line 90 of file SplitButton.h.

Referenced by GetBitmap(), HasBitmap(), SetBitmap(), and UpdateMinSize().

◆ m_dropDownMenu

wxMenu* SplitButton::m_dropDownMenu = nullptr
private

Definition at line 89 of file SplitButton.h.

Referenced by Create(), GetSplitButtonMenu(), LoadMenu(), OnLeftButtonDown(), and ~SplitButton().

◆ m_IsEnabled

bool SplitButton::m_IsEnabled = true
private

Definition at line 86 of file SplitButton.h.

Referenced by Enable(), and OnPaint().

◆ m_label

wxString SplitButton::m_label
private

Definition at line 88 of file SplitButton.h.

Referenced by Create(), GetLabel(), OnPaint(), SetLabel(), and UpdateMinSize().

◆ m_stateButton

int SplitButton::m_stateButton = 0
private

◆ m_stateMenu

int SplitButton::m_stateMenu = 0
private

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