2015-09-25 21:37:19 +02:00
|
|
|
// File: fswitch.h
|
|
|
|
// Provides: class FSwitch
|
|
|
|
//
|
|
|
|
// Inheritance diagram
|
|
|
|
// ═══════════════════
|
|
|
|
//
|
|
|
|
// ▕▔▔▔▔▔▔▔▔▔▏ ▕▔▔▔▔▔▔▔▔▔▏
|
|
|
|
// ▕ FObject ▏ ▕ FTerm ▏
|
|
|
|
// ▕▁▁▁▁▁▁▁▁▁▏ ▕▁▁▁▁▁▁▁▁▁▏
|
|
|
|
// ▲ ▲
|
|
|
|
// │ │
|
|
|
|
// └─────┬─────┘
|
|
|
|
// │
|
2016-10-11 04:57:36 +02:00
|
|
|
// ▕▔▔▔▔▔▔▔▔▏
|
|
|
|
// ▕ FVTerm ▏
|
|
|
|
// ▕▁▁▁▁▁▁▁▁▏
|
|
|
|
// ▲
|
|
|
|
// │
|
2015-09-25 21:37:19 +02:00
|
|
|
// ▕▔▔▔▔▔▔▔▔▔▏
|
|
|
|
// ▕ FWidget ▏
|
|
|
|
// ▕▁▁▁▁▁▁▁▁▁▏
|
|
|
|
// ▲
|
|
|
|
// │
|
|
|
|
// ▕▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▏
|
|
|
|
// ▕ FToggleButton ▏
|
|
|
|
// ▕▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▏
|
|
|
|
// ▲
|
|
|
|
// │
|
|
|
|
// ▕▔▔▔▔▔▔▔▔▔▏
|
|
|
|
// ▕ FSwitch ▏
|
|
|
|
// ▕▁▁▁▁▁▁▁▁▁▏
|
2015-07-04 22:51:47 +02:00
|
|
|
|
2017-04-09 20:08:53 +02:00
|
|
|
#ifndef FSWITCH_H
|
|
|
|
#define FSWITCH_H
|
2015-07-04 22:51:47 +02:00
|
|
|
|
|
|
|
#include "ftogglebutton.h"
|
|
|
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// class FSwitch
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
|
|
|
#pragma pack(push)
|
|
|
|
#pragma pack(1)
|
|
|
|
|
|
|
|
class FSwitch : public FToggleButton
|
|
|
|
{
|
|
|
|
public:
|
2016-09-30 04:55:28 +02:00
|
|
|
// Constructors
|
|
|
|
explicit FSwitch (FWidget* = 0);
|
|
|
|
FSwitch (const FString&, FWidget* = 0);
|
2016-11-02 00:37:58 +01:00
|
|
|
|
2016-09-30 04:55:28 +02:00
|
|
|
// Destructor
|
|
|
|
virtual ~FSwitch();
|
|
|
|
|
2016-11-02 00:37:58 +01:00
|
|
|
// Accessor
|
2015-07-04 22:51:47 +02:00
|
|
|
const char* getClassName() const;
|
2016-11-02 00:37:58 +01:00
|
|
|
|
|
|
|
// Mutator
|
2017-04-08 02:40:22 +02:00
|
|
|
void setText (const FString&);
|
2016-09-30 04:55:28 +02:00
|
|
|
|
|
|
|
// Event handlers
|
2015-07-04 22:51:47 +02:00
|
|
|
void onKeyPress (FKeyEvent*);
|
2015-07-06 23:15:34 +02:00
|
|
|
void onMouseDown (FMouseEvent*);
|
|
|
|
void onMouseUp (FMouseEvent*);
|
2016-11-02 00:37:58 +01:00
|
|
|
|
|
|
|
private:
|
|
|
|
// Disable copy constructor
|
|
|
|
FSwitch (const FSwitch&);
|
|
|
|
|
|
|
|
// Disable assignment operator (=)
|
|
|
|
FSwitch& operator = (const FSwitch&);
|
|
|
|
|
|
|
|
// Methods
|
|
|
|
void draw();
|
|
|
|
void drawCheckButton();
|
|
|
|
|
|
|
|
// Data Members
|
|
|
|
int switch_offset_pos;
|
|
|
|
bool button_pressed;
|
2015-07-04 22:51:47 +02:00
|
|
|
};
|
|
|
|
#pragma pack(pop)
|
|
|
|
|
|
|
|
|
|
|
|
// FSwitch inline functions
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline const char* FSwitch::getClassName() const
|
|
|
|
{ return "FSwitch"; }
|
|
|
|
|
2017-04-09 20:08:53 +02:00
|
|
|
#endif // FSWITCH_H
|