finalcut/include/final/fbuttongroup.h

147 lines
3.9 KiB
C
Raw Normal View History

// File: fbuttongroup.h
// Provides: class FButtonGroup
//
// Inheritance diagram
// ═══════════════════
//
// ▕▔▔▔▔▔▔▔▔▔▏ ▕▔▔▔▔▔▔▔▔▔▏
// ▕ FObject ▏ ▕ FTerm ▏
// ▕▁▁▁▁▁▁▁▁▁▏ ▕▁▁▁▁▁▁▁▁▁▏
// ▲ ▲
// │ │
// └─────┬─────┘
// │
// ▕▔▔▔▔▔▔▔▔▏
// ▕ FVTerm ▏
// ▕▁▁▁▁▁▁▁▁▏
// ▲
// │
// ▕▔▔▔▔▔▔▔▔▔▏
// ▕ FWidget ▏
// ▕▁▁▁▁▁▁▁▁▁▏
// ▲
// │
// ▕▔▔▔▔▔▔▔▔▔▔▔▔▔▔▏
// ▕ FButtonGroup ▏
// ▕▁▁▁▁▁▁▁▁▁▁▁▁▁▁▏
2015-05-23 13:35:12 +02:00
#ifndef FBUTTONGROUP_H
#define FBUTTONGROUP_H
2015-05-23 13:35:12 +02:00
#include "final/fscrollview.h"
2015-05-23 13:35:12 +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 FScrollView
2015-05-23 13:35:12 +02:00
{
2017-09-11 03:06:02 +02:00
public:
// Constructors
explicit FButtonGroup (FWidget* = 0);
FButtonGroup (const FString&, FWidget* = 0);
// Destructor
virtual ~FButtonGroup();
// Accessor
const char* getClassName() const;
FToggleButton* getFirstButton();
FToggleButton* getLastButton();
FToggleButton* getButton (int) const;
uInt getCount() const;
FString& getText();
// Mutator
bool setEnable(bool);
bool setEnable();
bool unsetEnable();
bool setDisable();
void setText (const FString&);
// Inquiries
bool isChecked(int) const;
bool hasFocusedButton() const;
bool hasCheckedButton() const;
// Methods
void hide();
void insert (FToggleButton*);
void remove (FToggleButton*);
void checkScrollSize (FToggleButton*);
void checkScrollSize (const FRect&);
// Event handlers
void onMouseDown (FMouseEvent*);
void onAccel (FAccelEvent*);
void onFocusIn (FFocusEvent*);
// Callback method
void cb_buttonToggled (FWidget*, data_ptr);
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;
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); }
2017-03-12 00:29:56 +01:00
//----------------------------------------------------------------------
inline uInt FButtonGroup::getCount() const
{ return uInt(buttonlist.size()); }
2015-05-23 13:35:12 +02:00
//----------------------------------------------------------------------
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