2017-11-04 07:03:53 +01:00
|
|
|
/***********************************************************************
|
|
|
|
* fbuttongroup.h - The FButtonGroup widget organizes FToggleButton *
|
|
|
|
* widgets in a group. *
|
|
|
|
* *
|
|
|
|
* This file is part of the Final Cut widget toolkit *
|
|
|
|
* *
|
2018-02-17 19:12:48 +01:00
|
|
|
* Copyright 2014-2018 Markus Gans *
|
2017-11-04 07:03:53 +01:00
|
|
|
* *
|
|
|
|
* The Final Cut is free software; you can redistribute it and/or *
|
|
|
|
* modify it under the terms of the GNU Lesser General Public License *
|
|
|
|
* as published by the Free Software Foundation; either version 3 of *
|
|
|
|
* the License, or (at your option) any later version. *
|
|
|
|
* *
|
|
|
|
* The Final Cut is distributed in the hope that it will be useful, *
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
|
|
* GNU Lesser General Public License for more details. *
|
|
|
|
* *
|
|
|
|
* You should have received a copy of the GNU Lesser General Public *
|
|
|
|
* License along with this program. If not, see *
|
|
|
|
* <http://www.gnu.org/licenses/>. *
|
|
|
|
***********************************************************************/
|
2017-10-02 07:32:33 +02:00
|
|
|
|
|
|
|
/* Inheritance diagram
|
|
|
|
* ═══════════════════
|
|
|
|
*
|
2017-10-29 14:27:50 +01:00
|
|
|
* ▕▔▔▔▔▔▔▔▔▔▏
|
|
|
|
* ▕ FTerm ▏
|
|
|
|
* ▕▁▁▁▁▁▁▁▁▁▏
|
|
|
|
* ▲
|
|
|
|
* │
|
2017-10-02 07:32:33 +02:00
|
|
|
* ▕▔▔▔▔▔▔▔▔▔▏ ▕▔▔▔▔▔▔▔▔▔▏
|
2017-10-29 14:27:50 +01:00
|
|
|
* ▕ FVTerm ▏ ▕ FObject ▏
|
2017-10-02 07:32:33 +02:00
|
|
|
* ▕▁▁▁▁▁▁▁▁▁▏ ▕▁▁▁▁▁▁▁▁▁▏
|
|
|
|
* ▲ ▲
|
|
|
|
* │ │
|
|
|
|
* └─────┬─────┘
|
|
|
|
* │
|
|
|
|
* ▕▔▔▔▔▔▔▔▔▔▏
|
|
|
|
* ▕ FWidget ▏
|
|
|
|
* ▕▁▁▁▁▁▁▁▁▁▏
|
|
|
|
* ▲
|
|
|
|
* │
|
|
|
|
* ▕▔▔▔▔▔▔▔▔▔▔▔▔▔▔▏
|
|
|
|
* ▕ FButtonGroup ▏
|
|
|
|
* ▕▁▁▁▁▁▁▁▁▁▁▁▁▁▁▏
|
|
|
|
*/
|
2015-05-23 13:35:12 +02:00
|
|
|
|
2017-04-09 20:08:53 +02:00
|
|
|
#ifndef FBUTTONGROUP_H
|
|
|
|
#define FBUTTONGROUP_H
|
2015-05-23 13:35:12 +02:00
|
|
|
|
2017-10-31 00:41:59 +01:00
|
|
|
#if !defined (USE_FINAL_H) && !defined (COMPILE_FINAL_CUT)
|
|
|
|
#error "Only <final/final.h> can be included directly."
|
|
|
|
#endif
|
|
|
|
|
2017-09-17 21:32:46 +02:00
|
|
|
#include "final/fscrollview.h"
|
2015-05-23 13:35:12 +02:00
|
|
|
|
2018-09-20 23:59:01 +02:00
|
|
|
namespace finalcut
|
|
|
|
{
|
2015-05-23 13:35:12 +02:00
|
|
|
|
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)
|
|
|
|
|
2017-02-20 00:00:53 +01:00
|
|
|
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
|
2018-09-24 04:02:35 +02:00
|
|
|
virtual bool setEnable(bool);
|
|
|
|
virtual bool setEnable();
|
|
|
|
virtual bool unsetEnable();
|
|
|
|
virtual bool setDisable();
|
2017-09-11 03:06:02 +02:00
|
|
|
void setText (const FString&);
|
|
|
|
|
|
|
|
// Inquiries
|
|
|
|
bool isChecked(int) const;
|
|
|
|
bool hasFocusedButton() const;
|
|
|
|
bool hasCheckedButton() const;
|
|
|
|
|
|
|
|
// Methods
|
2018-09-24 04:02:35 +02:00
|
|
|
virtual void hide();
|
2017-09-11 03:06:02 +02:00
|
|
|
void insert (FToggleButton*);
|
|
|
|
void remove (FToggleButton*);
|
|
|
|
void checkScrollSize (FToggleButton*);
|
|
|
|
void checkScrollSize (const FRect&);
|
|
|
|
|
|
|
|
// Event handlers
|
2018-09-24 04:02:35 +02:00
|
|
|
virtual void onMouseDown (FMouseEvent*);
|
|
|
|
virtual void onAccel (FAccelEvent*);
|
|
|
|
virtual void onFocusIn (FFocusEvent*);
|
2017-09-11 03:06:02 +02:00
|
|
|
|
|
|
|
// 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();
|
2018-02-17 19:12:48 +01:00
|
|
|
int getHotkeyPos (wchar_t[], wchar_t[], uInt);
|
|
|
|
void drawText (wchar_t[], int, uInt);
|
2017-09-11 03:06:02 +02:00
|
|
|
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
|
|
|
|
2018-09-20 23:59:01 +02:00
|
|
|
} // namespace finalcut
|
|
|
|
|
2017-04-09 20:08:53 +02:00
|
|
|
#endif // FBUTTONGROUP_H
|