finalcut/src/flabel.h

138 lines
3.8 KiB
C
Raw Normal View History

// File: flabel.h
// Provides: class FLabel
//
// Inheritance diagram
// ═══════════════════
//
// ▕▔▔▔▔▔▔▔▔▔▏ ▕▔▔▔▔▔▔▔▔▔▏
// ▕ FObject ▏ ▕ FTerm ▏
// ▕▁▁▁▁▁▁▁▁▁▏ ▕▁▁▁▁▁▁▁▁▁▏
// ▲ ▲
// │ │
// └─────┬─────┘
// │
// ▕▔▔▔▔▔▔▔▔▔▏
// ▕ FWidget ▏
// ▕▁▁▁▁▁▁▁▁▁▏
// ▲
// │
// ▕▔▔▔▔▔▔▔▔▏
// ▕ FLabel ▏
// ▕▁▁▁▁▁▁▁▁▏
2015-05-23 13:35:12 +02:00
#ifndef _FLABEL_H
#define _FLABEL_H
#include "fwidget.h"
2015-05-23 13:35:12 +02:00
#define NO_EMPHASIS 0x00000000
#define EMPHASIS 0x00000001
//----------------------------------------------------------------------
// class FLabel
//----------------------------------------------------------------------
#pragma pack(push)
#pragma pack(1)
class FLabel : public FWidget
{
private:
std::vector<FString> multiline_text;
bool multiline;
2015-05-23 13:35:12 +02:00
FString text;
int emphasis;
uInt alignment;
uChar emphasis_color;
uChar ellipsis_color;
bool reverse_mode;
FWidget* accel_widget;
private:
FLabel (const FLabel&);
FLabel& operator = (const FLabel&);
void init();
uChar getHotkey();
int getHotkeyPos (wchar_t*&, wchar_t*&, uInt);
2015-05-23 13:35:12 +02:00
void setHotkeyAccelerator();
2015-07-18 21:36:57 +02:00
int getXOffset (int);
2015-09-27 16:45:28 +02:00
void printLine (wchar_t*&, uInt, int, int = 0);
2015-05-23 13:35:12 +02:00
void draw();
public:
2015-09-27 16:45:28 +02:00
explicit FLabel (FWidget* = 0); // constructor
FLabel (const FString&, FWidget* = 0); // constructor
2015-05-23 13:35:12 +02:00
virtual ~FLabel(); // destructor
const char* getClassName() const;
void hide();
void onMouseDown (FMouseEvent*);
void onAccel (FAccelEvent*);
void cb_accel_widget_destroyed (FWidget*, void*);
2015-09-27 16:45:28 +02:00
void setAccelWidget (FWidget* = 0);
2015-05-23 13:35:12 +02:00
FTerm* getAccelWidget();
void setAlignment(uInt);
uInt getAlignment();
bool setEmphasis(bool);
bool setEmphasis();
bool unsetEmphasis();
bool hasEmphasis();
bool setReverseMode(bool);
bool setReverseMode();
bool unsetReverseMode();
bool hasReverseMode();
2015-09-22 04:18:20 +02:00
using FWidget::setEnable;
2015-05-23 13:35:12 +02:00
bool setEnable (bool);
void setNumber(long);
void setText (const FString&);
FString& getText();
};
#pragma pack(pop)
// FLabel inline functions
//----------------------------------------------------------------------
inline const char* FLabel::getClassName() const
{ return "FLabel"; }
//----------------------------------------------------------------------
inline FTerm* FLabel::getAccelWidget ()
{ return accel_widget; }
//----------------------------------------------------------------------
inline uInt FLabel::getAlignment()
{ return alignment; }
//----------------------------------------------------------------------
inline bool FLabel::setEmphasis()
{ return setEmphasis(true); }
//----------------------------------------------------------------------
inline bool FLabel::unsetEmphasis()
{ return setEmphasis(false); }
//----------------------------------------------------------------------
inline bool FLabel::hasEmphasis()
{ return ((emphasis & EMPHASIS) != 0); }
//----------------------------------------------------------------------
inline bool FLabel::setReverseMode()
{ return setReverseMode(true); }
//----------------------------------------------------------------------
inline bool FLabel::unsetReverseMode()
{ return setReverseMode(false); }
//----------------------------------------------------------------------
inline bool FLabel::hasReverseMode()
{ return reverse_mode; }
//----------------------------------------------------------------------
inline FString& FLabel::getText()
2015-09-22 04:18:20 +02:00
{ return text; }
2015-05-23 13:35:12 +02:00
#endif // _FLABEL_H