2015-09-25 21:37:19 +02:00
|
|
|
// File: flineedit.h
|
|
|
|
// Provides: class FLineEdit
|
|
|
|
//
|
|
|
|
// Inheritance diagram
|
|
|
|
// ═══════════════════
|
|
|
|
//
|
|
|
|
// ▕▔▔▔▔▔▔▔▔▔▏ ▕▔▔▔▔▔▔▔▔▔▏
|
|
|
|
// ▕ FObject ▏ ▕ FTerm ▏
|
|
|
|
// ▕▁▁▁▁▁▁▁▁▁▏ ▕▁▁▁▁▁▁▁▁▁▏
|
|
|
|
// ▲ ▲
|
|
|
|
// │ │
|
|
|
|
// └─────┬─────┘
|
|
|
|
// │
|
2016-10-11 04:57:36 +02:00
|
|
|
// ▕▔▔▔▔▔▔▔▔▏
|
|
|
|
// ▕ FVTerm ▏
|
|
|
|
// ▕▁▁▁▁▁▁▁▁▏
|
|
|
|
// ▲
|
|
|
|
// │
|
2015-09-25 21:37:19 +02:00
|
|
|
// ▕▔▔▔▔▔▔▔▔▔▏
|
|
|
|
// ▕ FWidget ▏
|
|
|
|
// ▕▁▁▁▁▁▁▁▁▁▏
|
|
|
|
// ▲
|
|
|
|
// │
|
|
|
|
// ▕▔▔▔▔▔▔▔▔▔▔▔▏
|
|
|
|
// ▕ FLineEdit ▏
|
|
|
|
// ▕▁▁▁▁▁▁▁▁▁▁▁▏
|
2015-05-23 13:35:12 +02:00
|
|
|
|
2017-04-09 20:08:53 +02:00
|
|
|
#ifndef FLINEEDIT_H
|
|
|
|
#define FLINEEDIT_H
|
2015-05-23 13:35:12 +02:00
|
|
|
|
2017-09-17 21:32:46 +02:00
|
|
|
#include "final/fwidget.h"
|
|
|
|
#include "final/flabel.h"
|
2015-05-23 13:35:12 +02:00
|
|
|
|
2015-09-25 21:37:19 +02:00
|
|
|
|
2015-05-23 13:35:12 +02:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// class FLineEdit
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
|
|
|
#pragma pack(push)
|
|
|
|
#pragma pack(1)
|
|
|
|
|
|
|
|
class FLineEdit : public FWidget
|
|
|
|
{
|
2017-09-11 03:06:02 +02:00
|
|
|
public:
|
|
|
|
// Enumeration
|
|
|
|
enum label_o
|
|
|
|
{
|
|
|
|
label_above = 0,
|
|
|
|
label_left = 1
|
|
|
|
};
|
|
|
|
|
|
|
|
// Constructor
|
|
|
|
explicit FLineEdit (FWidget* = 0);
|
|
|
|
FLineEdit (const FString&, FWidget* = 0);
|
|
|
|
|
|
|
|
// Destructor
|
|
|
|
virtual ~FLineEdit();
|
|
|
|
|
|
|
|
// Accessors
|
|
|
|
const char* getClassName() const;
|
|
|
|
FString getText() const;
|
|
|
|
int getLabelOrientation();
|
|
|
|
|
|
|
|
// Mutators
|
|
|
|
void setText (const FString&);
|
|
|
|
void setLabelText (const FString&);
|
|
|
|
void setLabelOrientation(const label_o);
|
|
|
|
bool setEnable(bool);
|
|
|
|
bool setEnable();
|
|
|
|
bool unsetEnable();
|
|
|
|
bool setDisable();
|
|
|
|
bool setFocus(bool);
|
|
|
|
bool setFocus();
|
|
|
|
bool unsetFocus();
|
|
|
|
bool setShadow(bool);
|
|
|
|
bool setShadow();
|
|
|
|
bool unsetShadow();
|
|
|
|
|
|
|
|
// Inquiry
|
|
|
|
bool hasShadow();
|
|
|
|
|
|
|
|
// Methods
|
|
|
|
void hide();
|
|
|
|
void clearText();
|
|
|
|
|
|
|
|
// Event handlers
|
|
|
|
void onKeyPress (FKeyEvent*);
|
|
|
|
void onMouseDown (FMouseEvent*);
|
|
|
|
void onMouseUp (FMouseEvent*);
|
|
|
|
void onMouseMove (FMouseEvent*);
|
|
|
|
void onTimer (FTimerEvent*);
|
|
|
|
void onAccel (FAccelEvent*);
|
|
|
|
void onHide (FHideEvent*);
|
|
|
|
void onFocusIn (FFocusEvent*);
|
|
|
|
void onFocusOut (FFocusEvent*);
|
|
|
|
|
|
|
|
protected:
|
|
|
|
void adjustLabel();
|
|
|
|
void adjustSize();
|
|
|
|
|
|
|
|
private:
|
|
|
|
// Enumeration
|
|
|
|
enum dragScroll
|
|
|
|
{
|
|
|
|
noScroll = 0,
|
|
|
|
scrollLeft = 1,
|
|
|
|
scrollRight = 2
|
|
|
|
};
|
|
|
|
|
|
|
|
// Disable copy constructor
|
|
|
|
FLineEdit (const FLineEdit&);
|
|
|
|
|
|
|
|
// Disable assignment operator (=)
|
|
|
|
FLineEdit& operator = (const FLineEdit&);
|
|
|
|
|
|
|
|
// Methods
|
|
|
|
void init();
|
|
|
|
bool hasHotkey();
|
|
|
|
void draw();
|
|
|
|
void drawInputField();
|
|
|
|
void processActivate();
|
|
|
|
void processChanged();
|
|
|
|
|
|
|
|
// Data Members
|
|
|
|
FString text;
|
|
|
|
FString label_text;
|
|
|
|
FLabel* label;
|
|
|
|
label_o label_orientation;
|
|
|
|
dragScroll drag_scroll;
|
|
|
|
bool scroll_timer;
|
|
|
|
int scroll_repeat;
|
|
|
|
bool insert_mode;
|
|
|
|
int cursor_pos;
|
|
|
|
int text_offset;
|
2015-05-23 13:35:12 +02:00
|
|
|
};
|
|
|
|
#pragma pack(pop)
|
|
|
|
|
|
|
|
|
|
|
|
// FLineEdit inline functions
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline const char* FLineEdit::getClassName() const
|
|
|
|
{ return "FLineEdit"; }
|
|
|
|
|
2016-11-02 00:37:58 +01:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline FString FLineEdit::getText() const
|
|
|
|
{ return text; }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline int FLineEdit::getLabelOrientation()
|
|
|
|
{ return int(label_orientation); }
|
|
|
|
|
2015-05-23 13:35:12 +02:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FLineEdit::setEnable()
|
|
|
|
{ return setEnable(true); }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FLineEdit::unsetEnable()
|
|
|
|
{ return setEnable(false); }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FLineEdit::setDisable()
|
|
|
|
{ return setEnable(false); }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FLineEdit::setFocus()
|
|
|
|
{ return setFocus(true); }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FLineEdit::unsetFocus()
|
|
|
|
{ return setFocus(false); }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FLineEdit::setShadow()
|
|
|
|
{ return setShadow(true); }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FLineEdit::unsetShadow()
|
|
|
|
{ return setShadow(false); }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FLineEdit::hasShadow()
|
2016-01-24 14:53:09 +01:00
|
|
|
{ return ((flags & fc::shadow) != 0); }
|
2015-05-23 13:35:12 +02:00
|
|
|
|
2017-04-09 20:08:53 +02:00
|
|
|
#endif // FLINEEDIT_H
|