2015-09-25 21:37:19 +02:00
|
|
|
// File: fbuttongroup.h
|
|
|
|
// Provides: class FButtonGroup
|
|
|
|
//
|
|
|
|
// Inheritance diagram
|
|
|
|
// ═══════════════════
|
|
|
|
//
|
|
|
|
// ▕▔▔▔▔▔▔▔▔▔▏ ▕▔▔▔▔▔▔▔▔▔▏
|
|
|
|
// ▕ FObject ▏ ▕ FTerm ▏
|
|
|
|
// ▕▁▁▁▁▁▁▁▁▁▏ ▕▁▁▁▁▁▁▁▁▁▏
|
|
|
|
// ▲ ▲
|
|
|
|
// │ │
|
|
|
|
// └─────┬─────┘
|
|
|
|
// │
|
2016-10-11 04:57:36 +02:00
|
|
|
// ▕▔▔▔▔▔▔▔▔▏
|
|
|
|
// ▕ FVTerm ▏
|
|
|
|
// ▕▁▁▁▁▁▁▁▁▏
|
|
|
|
// ▲
|
|
|
|
// │
|
2015-09-25 21:37:19 +02:00
|
|
|
// ▕▔▔▔▔▔▔▔▔▔▏
|
|
|
|
// ▕ FWidget ▏
|
|
|
|
// ▕▁▁▁▁▁▁▁▁▁▏
|
|
|
|
// ▲
|
|
|
|
// │
|
|
|
|
// ▕▔▔▔▔▔▔▔▔▔▔▔▔▔▔▏
|
|
|
|
// ▕ FButtonGroup ▏
|
|
|
|
// ▕▁▁▁▁▁▁▁▁▁▁▁▁▁▁▏
|
2015-05-23 13:35:12 +02:00
|
|
|
|
|
|
|
#ifndef _FBUTTONGROUP_H
|
|
|
|
#define _FBUTTONGROUP_H
|
|
|
|
|
|
|
|
#include "fwidget.h"
|
|
|
|
|
|
|
|
|
2016-10-01 23:18:49 +02:00
|
|
|
// class forward declaration
|
2015-05-23 13:35:12 +02:00
|
|
|
class FToggleButton;
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// class FButtonGroup
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
|
|
|
#pragma pack(push)
|
|
|
|
#pragma pack(1)
|
|
|
|
|
|
|
|
class FButtonGroup : public FWidget
|
|
|
|
{
|
|
|
|
public:
|
2016-09-30 04:55:28 +02:00
|
|
|
// Constructors
|
|
|
|
explicit FButtonGroup (FWidget* = 0);
|
|
|
|
FButtonGroup (const FString&, FWidget* = 0);
|
2016-11-02 00:37:58 +01:00
|
|
|
|
2016-09-30 04:55:28 +02:00
|
|
|
// Destructor
|
|
|
|
virtual ~FButtonGroup();
|
2015-05-23 13:35:12 +02:00
|
|
|
|
2016-11-02 00:37:58 +01:00
|
|
|
// Accessor
|
2016-09-30 04:55:28 +02:00
|
|
|
const char* getClassName() const;
|
2015-05-23 13:35:12 +02:00
|
|
|
FToggleButton* getFirstButton();
|
|
|
|
FToggleButton* getLastButton();
|
2016-11-02 00:37:58 +01:00
|
|
|
FString& getText();
|
|
|
|
|
|
|
|
// Mutator
|
|
|
|
bool setEnable(bool);
|
|
|
|
bool setEnable();
|
|
|
|
bool unsetEnable();
|
|
|
|
bool setDisable();
|
|
|
|
bool setBorder(bool);
|
|
|
|
bool setBorder();
|
|
|
|
bool unsetBorder();
|
|
|
|
void setText (const FString&);
|
|
|
|
|
|
|
|
// Inquiries
|
2016-09-30 04:55:28 +02:00
|
|
|
bool hasFocusedButton();
|
|
|
|
bool hasCheckedButton();
|
|
|
|
|
2016-11-02 00:37:58 +01:00
|
|
|
// Methods
|
|
|
|
void hide();
|
|
|
|
void insert (FToggleButton*);
|
|
|
|
void remove (FToggleButton*);
|
|
|
|
|
2016-09-30 04:55:28 +02:00
|
|
|
// Event handlers
|
|
|
|
void onMouseDown (FMouseEvent*);
|
|
|
|
void onAccel (FAccelEvent*);
|
|
|
|
void onFocusIn (FFocusEvent*);
|
|
|
|
|
|
|
|
// Callback method
|
|
|
|
void cb_buttonToggled (FWidget*, void*);
|
|
|
|
|
2016-11-02 00:37:58 +01:00
|
|
|
protected:
|
|
|
|
// Accessor
|
|
|
|
uChar getHotkey();
|
|
|
|
|
|
|
|
// Mutator
|
|
|
|
void setHotkeyAccelerator();
|
|
|
|
|
|
|
|
// Methods
|
|
|
|
virtual void draw();
|
|
|
|
void drawLabel();
|
|
|
|
|
|
|
|
private:
|
|
|
|
// Disable copy constructor
|
|
|
|
FButtonGroup (const FButtonGroup&);
|
|
|
|
|
|
|
|
// Disable assignment operator (=)
|
|
|
|
FButtonGroup& operator = (const FButtonGroup&);
|
|
|
|
|
|
|
|
// Inquiries
|
|
|
|
bool isRadioButton(FToggleButton*) const;
|
|
|
|
|
|
|
|
// Methods
|
|
|
|
void init();
|
|
|
|
void directFocus();
|
|
|
|
|
|
|
|
// Data Members
|
|
|
|
FString text;
|
|
|
|
bool border;
|
2017-01-28 22:03:15 +01:00
|
|
|
FObjectList buttonlist;
|
2015-05-23 13:35:12 +02:00
|
|
|
};
|
|
|
|
#pragma pack(pop)
|
|
|
|
|
|
|
|
|
|
|
|
// FButtonGroup inline functions
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline const char* FButtonGroup::getClassName() const
|
|
|
|
{ return "FButtonGroup"; }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FButtonGroup::setEnable()
|
|
|
|
{ return setEnable(true); }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FButtonGroup::unsetEnable()
|
|
|
|
{ return setEnable(false); }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FButtonGroup::setDisable()
|
|
|
|
{ return setEnable(false); }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FButtonGroup::setBorder()
|
|
|
|
{ return setBorder(true); }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FButtonGroup::unsetBorder()
|
|
|
|
{ return setBorder(false); }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline FString& FButtonGroup::getText()
|
2015-09-22 04:18:20 +02:00
|
|
|
{ return text; }
|
2015-05-23 13:35:12 +02:00
|
|
|
|
|
|
|
#endif // _FBUTTONGROUP_H
|