2015-09-25 21:37:19 +02:00
|
|
|
// File: fwidget.h
|
|
|
|
// Provides: class FWidget
|
|
|
|
//
|
|
|
|
// Inheritance diagram
|
|
|
|
// ═══════════════════
|
|
|
|
//
|
|
|
|
// ▕▔▔▔▔▔▔▔▔▔▏ ▕▔▔▔▔▔▔▔▔▔▏
|
|
|
|
// ▕ FObject ▏ ▕ FTerm ▏
|
|
|
|
// ▕▁▁▁▁▁▁▁▁▁▏ ▕▁▁▁▁▁▁▁▁▁▏
|
|
|
|
// ▲ ▲
|
|
|
|
// │ │
|
|
|
|
// └─────┬─────┘
|
|
|
|
// │
|
|
|
|
// ▕▔▔▔▔▔▔▔▔▔▏ 1 1▕▔▔▔▔▔▔▔▔▔▔▔▔▏
|
|
|
|
// ▕ FWidget ▏-┬- - - -▕ FStatusBar ▏
|
|
|
|
// ▕▁▁▁▁▁▁▁▁▁▏ : ▕▁▁▁▁▁▁▁▁▁▁▁▁▏
|
|
|
|
// :
|
|
|
|
// : 1▕▔▔▔▔▔▔▔▔▔▔▏
|
|
|
|
// :- - - -▕ FMenuBar ▏
|
|
|
|
// : ▕▁▁▁▁▁▁▁▁▁▁▏
|
|
|
|
// :
|
|
|
|
// : *▕▔▔▔▔▔▔▔▔▔▏
|
|
|
|
// :- - - -▕ FString ▏
|
|
|
|
// : ▕▁▁▁▁▁▁▁▁▁▏
|
|
|
|
// :
|
|
|
|
// : *▕▔▔▔▔▔▔▔▔▏
|
|
|
|
// :- - - -▕ FEvent ▏
|
|
|
|
// : ▕▁▁▁▁▁▁▁▁▏
|
|
|
|
// :
|
|
|
|
// : *▕▔▔▔▔▔▔▔▔▔▔▔▏
|
|
|
|
// :- - - -▕ FKeyEvent ▏
|
|
|
|
// : ▕▁▁▁▁▁▁▁▁▁▁▁▏
|
|
|
|
// :
|
|
|
|
// : *▕▔▔▔▔▔▔▔▔▔▔▔▔▔▏
|
|
|
|
// :- - - -▕ FMouseEvent ▏
|
|
|
|
// : ▕▁▁▁▁▁▁▁▁▁▁▁▁▁▏
|
|
|
|
// :
|
|
|
|
// : *▕▔▔▔▔▔▔▔▔▔▔▔▔▔▏
|
|
|
|
// :- - - -▕ FWheelEvent ▏
|
|
|
|
// : ▕▁▁▁▁▁▁▁▁▁▁▁▁▁▏
|
|
|
|
// :
|
|
|
|
// : *▕▔▔▔▔▔▔▔▔▔▔▔▔▔▏
|
|
|
|
// :- - - -▕ FFocusEvent ▏
|
|
|
|
// : ▕▁▁▁▁▁▁▁▁▁▁▁▁▁▏
|
|
|
|
// :
|
|
|
|
// : *▕▔▔▔▔▔▔▔▔▔▔▔▔▔▏
|
|
|
|
// :- - - -▕ FAccelEvent ▏
|
|
|
|
// : ▕▁▁▁▁▁▁▁▁▁▁▁▁▁▏
|
|
|
|
// :
|
|
|
|
// : *▕▔▔▔▔▔▔▔▔▔▔▔▔▔▔▏
|
|
|
|
// :- - - -▕ FResizeEvent ▏
|
|
|
|
// : ▕▁▁▁▁▁▁▁▁▁▁▁▁▁▁▏
|
|
|
|
// :
|
|
|
|
// : *▕▔▔▔▔▔▔▔▔▔▔▔▔▏
|
|
|
|
// :- - - -▕ FShowEvent ▏
|
|
|
|
// : ▕▁▁▁▁▁▁▁▁▁▁▁▁▏
|
|
|
|
// :
|
|
|
|
// : *▕▔▔▔▔▔▔▔▔▔▔▔▔▏
|
|
|
|
// :- - - -▕ FHideEvent ▏
|
|
|
|
// : ▕▁▁▁▁▁▁▁▁▁▁▁▁▏
|
|
|
|
// :
|
|
|
|
// : *▕▔▔▔▔▔▔▔▔▔▔▔▔▔▏
|
|
|
|
// └- - - -▕ FCloseEvent ▏
|
|
|
|
// ▕▁▁▁▁▁▁▁▁▁▁▁▁▁▏
|
2015-05-23 13:35:12 +02:00
|
|
|
|
|
|
|
#ifndef _FWIDGET_H
|
|
|
|
#define _FWIDGET_H
|
|
|
|
|
|
|
|
#include "fterm.h"
|
|
|
|
|
2015-09-25 21:37:19 +02:00
|
|
|
|
2015-09-24 19:01:27 +02:00
|
|
|
// Callback macros
|
|
|
|
#define _FUNCTION_CALLBACK(h) \
|
|
|
|
reinterpret_cast<FWidget::FCallback>((h))
|
|
|
|
|
|
|
|
#define _METHOD_CALLBACK(i,h) \
|
|
|
|
reinterpret_cast<FWidget*>((i)) \
|
|
|
|
, reinterpret_cast<FWidget::FMemberCallback>((h))
|
|
|
|
|
2015-05-23 13:35:12 +02:00
|
|
|
class FStatusBar;
|
2015-08-09 23:44:11 +02:00
|
|
|
class FMenuBar;
|
2015-05-23 13:35:12 +02:00
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// class FWidget
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
|
|
|
#pragma pack(push)
|
|
|
|
#pragma pack(1)
|
|
|
|
|
|
|
|
class FWidget : public FObject, public FTerm
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
typedef std::vector<FWidget*> widgetList;
|
|
|
|
static widgetList* window_list;
|
2016-07-14 23:55:22 +02:00
|
|
|
static widgetList* dialog_list;
|
2015-05-23 13:35:12 +02:00
|
|
|
static widgetList* close_widget;
|
|
|
|
|
|
|
|
typedef void (*FCallback)(FWidget*, void*);
|
|
|
|
typedef void (FWidget::*FMemberCallback)(FWidget*, void*);
|
|
|
|
typedef void* data_ptr;
|
|
|
|
|
|
|
|
struct callback_data
|
|
|
|
{
|
|
|
|
FString cb_signal;
|
|
|
|
FCallback cb_handler;
|
|
|
|
data_ptr data;
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef std::vector<callback_data> CallbackObjects;
|
2016-09-25 23:53:48 +02:00
|
|
|
CallbackObjects callback_objects;
|
2015-05-23 13:35:12 +02:00
|
|
|
|
|
|
|
struct member_callback_data
|
|
|
|
{
|
|
|
|
FString cb_signal;
|
|
|
|
FWidget* cb_instance;
|
|
|
|
FMemberCallback cb_handler;
|
|
|
|
data_ptr data;
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef std::vector<member_callback_data> MemberCallbackObjects;
|
2016-09-25 23:53:48 +02:00
|
|
|
MemberCallbackObjects member_callback_objects;
|
2015-05-23 13:35:12 +02:00
|
|
|
|
|
|
|
struct accelerator
|
|
|
|
{
|
|
|
|
int key;
|
|
|
|
FWidget* object;
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef std::vector<accelerator> Accelerators;
|
|
|
|
Accelerators* accelerator_list;
|
|
|
|
|
2016-06-26 16:08:03 +02:00
|
|
|
protected:
|
2015-05-23 13:35:12 +02:00
|
|
|
static struct widget_colors
|
|
|
|
{
|
2016-01-08 01:00:05 +01:00
|
|
|
short term_fg;
|
|
|
|
short term_bg;
|
|
|
|
short list_fg;
|
|
|
|
short list_bg;
|
|
|
|
short selected_list_fg;
|
|
|
|
short selected_list_bg;
|
|
|
|
short current_element_focus_fg;
|
|
|
|
short current_element_focus_bg;
|
|
|
|
short current_element_fg;
|
|
|
|
short current_element_bg;
|
|
|
|
short current_inc_search_element_fg;
|
|
|
|
short selected_current_element_focus_fg;
|
|
|
|
short selected_current_element_focus_bg;
|
|
|
|
short selected_current_element_fg;
|
|
|
|
short selected_current_element_bg;
|
|
|
|
short label_fg;
|
|
|
|
short label_bg;
|
|
|
|
short label_inactive_fg;
|
|
|
|
short label_inactive_bg;
|
|
|
|
short label_hotkey_fg;
|
|
|
|
short label_hotkey_bg;
|
|
|
|
short label_emphasis_fg;
|
|
|
|
short label_ellipsis_fg;
|
|
|
|
short inputfield_active_focus_fg;
|
|
|
|
short inputfield_active_focus_bg;
|
|
|
|
short inputfield_active_fg;
|
|
|
|
short inputfield_active_bg;
|
|
|
|
short inputfield_inactive_fg;
|
|
|
|
short inputfield_inactive_bg;
|
|
|
|
short dialog_fg;
|
2016-09-11 16:48:39 +02:00
|
|
|
short dialog_resize_fg;
|
2016-01-08 01:00:05 +01:00
|
|
|
short dialog_emphasis_fg;
|
|
|
|
short dialog_bg;
|
|
|
|
short error_box_fg;
|
|
|
|
short error_box_emphasis_fg;
|
|
|
|
short error_box_bg;
|
|
|
|
short shadow_fg;
|
|
|
|
short shadow_bg;
|
|
|
|
short toggle_button_active_focus_fg;
|
|
|
|
short toggle_button_active_focus_bg;
|
|
|
|
short toggle_button_active_fg;
|
|
|
|
short toggle_button_active_bg;
|
|
|
|
short toggle_button_inactive_fg;
|
|
|
|
short toggle_button_inactive_bg;
|
|
|
|
short button_active_focus_fg;
|
|
|
|
short button_active_focus_bg;
|
|
|
|
short button_active_fg;
|
|
|
|
short button_active_bg;
|
|
|
|
short button_inactive_fg;
|
|
|
|
short button_inactive_bg;
|
|
|
|
short button_hotkey_fg;
|
|
|
|
short titlebar_active_fg;
|
|
|
|
short titlebar_active_bg;
|
|
|
|
short titlebar_inactive_fg;
|
|
|
|
short titlebar_inactive_bg;
|
|
|
|
short titlebar_button_fg;
|
|
|
|
short titlebar_button_bg;
|
2016-09-11 16:48:39 +02:00
|
|
|
short titlebar_button_focus_fg;
|
|
|
|
short titlebar_button_focus_bg;
|
2016-01-08 01:00:05 +01:00
|
|
|
short menu_active_focus_fg;
|
|
|
|
short menu_active_focus_bg;
|
|
|
|
short menu_active_fg;
|
|
|
|
short menu_active_bg;
|
|
|
|
short menu_inactive_fg;
|
|
|
|
short menu_inactive_bg;
|
|
|
|
short menu_hotkey_fg;
|
|
|
|
short menu_hotkey_bg;
|
|
|
|
short statusbar_fg;
|
|
|
|
short statusbar_bg;
|
|
|
|
short statusbar_hotkey_fg;
|
|
|
|
short statusbar_hotkey_bg;
|
|
|
|
short statusbar_separator_fg;
|
|
|
|
short statusbar_active_fg;
|
|
|
|
short statusbar_active_bg;
|
|
|
|
short statusbar_active_hotkey_fg;
|
|
|
|
short statusbar_active_hotkey_bg;
|
|
|
|
short scrollbar_fg;
|
|
|
|
short scrollbar_bg;
|
|
|
|
short scrollbar_button_fg;
|
|
|
|
short scrollbar_button_bg;
|
|
|
|
short progressbar_fg;
|
|
|
|
short progressbar_bg;
|
2015-05-23 13:35:12 +02:00
|
|
|
} wc;
|
|
|
|
// widget_colors wc;
|
|
|
|
|
2016-09-25 23:53:48 +02:00
|
|
|
int flags;
|
|
|
|
static uInt modal_dialogs;
|
|
|
|
|
|
|
|
private:
|
|
|
|
bool enable;
|
|
|
|
bool visible;
|
|
|
|
bool shown;
|
|
|
|
bool focus;
|
|
|
|
bool focusable;
|
2016-09-27 00:46:05 +02:00
|
|
|
bool visible_cursor;
|
|
|
|
FPoint widget_cursor_position;
|
2016-09-25 23:53:48 +02:00
|
|
|
|
|
|
|
struct widget_size_hints
|
|
|
|
{
|
|
|
|
widget_size_hints()
|
|
|
|
: min_width (INT_MIN)
|
|
|
|
, min_height (INT_MIN)
|
|
|
|
, max_width (INT_MAX)
|
|
|
|
, max_height (INT_MAX)
|
|
|
|
{ }
|
|
|
|
~widget_size_hints()
|
|
|
|
{ }
|
|
|
|
void setMinimum (int w, int h)
|
|
|
|
{
|
|
|
|
min_width = w;
|
|
|
|
min_height = h;
|
|
|
|
}
|
|
|
|
void setMaximum (int w, int h)
|
|
|
|
{
|
|
|
|
max_width = w;
|
|
|
|
max_height = h;
|
|
|
|
}
|
|
|
|
int min_width;
|
|
|
|
int min_height;
|
|
|
|
int max_width;
|
|
|
|
int max_height;
|
|
|
|
} size_hints;
|
|
|
|
|
2016-06-26 16:08:03 +02:00
|
|
|
struct dbl_line_mask
|
|
|
|
{
|
|
|
|
dbl_line_mask() : top(), right(), bottom(), left()
|
|
|
|
{ }
|
|
|
|
~dbl_line_mask()
|
|
|
|
{ }
|
|
|
|
std::vector<bool> top;
|
|
|
|
std::vector<bool> right;
|
|
|
|
std::vector<bool> bottom;
|
|
|
|
std::vector<bool> left;
|
|
|
|
} double_flatline_mask;
|
2015-06-21 23:27:10 +02:00
|
|
|
|
2016-09-25 23:53:48 +02:00
|
|
|
struct widget_padding
|
|
|
|
{
|
|
|
|
widget_padding() : top(0), left(0), bottom(0), right(0)
|
|
|
|
{ }
|
|
|
|
~widget_padding()
|
|
|
|
{ }
|
|
|
|
int top;
|
|
|
|
int left;
|
|
|
|
int bottom;
|
|
|
|
int right;
|
|
|
|
} padding;
|
|
|
|
|
|
|
|
bool ignore_padding;
|
|
|
|
|
|
|
|
// widget size
|
|
|
|
FRect wsize;
|
|
|
|
FRect adjust_wsize;
|
|
|
|
FRect adjust_wsize_term;
|
|
|
|
FRect adjust_wsize_shadow;
|
|
|
|
FRect adjust_wsize_term_shadow;
|
|
|
|
// widget offset
|
|
|
|
FRect offset;
|
|
|
|
// offset of the widget client area
|
|
|
|
FRect client_offset;
|
|
|
|
// widget shadow size (on the right and bottom side)
|
|
|
|
FPoint wshadow;
|
|
|
|
|
|
|
|
// default widget foreground and background color
|
|
|
|
short foreground_color;
|
|
|
|
short background_color;
|
2015-05-23 13:35:12 +02:00
|
|
|
|
2016-09-25 23:53:48 +02:00
|
|
|
term_area* print_area;
|
|
|
|
FString statusbar_message;
|
2015-05-23 13:35:12 +02:00
|
|
|
|
|
|
|
static FStatusBar* statusbar;
|
2016-09-25 23:53:48 +02:00
|
|
|
static FMenuBar* menubar;
|
|
|
|
static FWidget* show_root_widget;
|
|
|
|
static FWidget* redraw_root_widget;
|
|
|
|
|
2015-10-14 04:06:26 +02:00
|
|
|
friend class FTerm;
|
2015-05-23 13:35:12 +02:00
|
|
|
friend class FApplication;
|
|
|
|
friend class FToggleButton;
|
|
|
|
|
|
|
|
private:
|
|
|
|
FWidget (const FWidget&);
|
|
|
|
FWidget& operator = (const FWidget&);
|
2015-10-17 19:40:43 +02:00
|
|
|
void init();
|
|
|
|
void finish();
|
|
|
|
void processDestroy();
|
|
|
|
virtual void draw();
|
|
|
|
static void setColorTheme();
|
|
|
|
term_area* getPrintArea();
|
|
|
|
void setPrintArea (term_area*);
|
2015-05-23 13:35:12 +02:00
|
|
|
|
|
|
|
protected:
|
2015-10-17 19:40:43 +02:00
|
|
|
virtual void adjustSize();
|
2016-05-16 21:11:32 +02:00
|
|
|
void adjustSizeGlobal();
|
2015-10-17 19:40:43 +02:00
|
|
|
virtual void setStatusBar (FStatusBar*);
|
|
|
|
virtual void setMenuBar (FMenuBar*);
|
2015-05-23 13:35:12 +02:00
|
|
|
// Event handlers
|
2015-10-17 19:40:43 +02:00
|
|
|
bool event (FEvent*);
|
|
|
|
virtual void onKeyPress (FKeyEvent*);
|
|
|
|
virtual void onKeyUp (FKeyEvent*);
|
|
|
|
virtual void onKeyDown (FKeyEvent*);
|
|
|
|
virtual void onMouseDown (FMouseEvent*);
|
|
|
|
virtual void onMouseUp (FMouseEvent*);
|
|
|
|
virtual void onMouseDoubleClick (FMouseEvent*);
|
|
|
|
virtual void onWheel (FWheelEvent*);
|
|
|
|
virtual void onMouseMove (FMouseEvent*);
|
|
|
|
virtual void onFocusIn (FFocusEvent*);
|
|
|
|
virtual void onFocusOut (FFocusEvent*);
|
|
|
|
virtual void onAccel (FAccelEvent*);
|
|
|
|
virtual void onResize (FResizeEvent*);
|
|
|
|
virtual void onShow (FShowEvent*);
|
|
|
|
virtual void onHide (FHideEvent*);
|
|
|
|
virtual void onClose (FCloseEvent*);
|
2016-06-12 11:56:06 +02:00
|
|
|
// Change child focus
|
2016-05-22 19:18:16 +02:00
|
|
|
virtual bool focusNextChild();
|
|
|
|
virtual bool focusPrevChild();
|
2015-05-23 13:35:12 +02:00
|
|
|
|
|
|
|
public:
|
2015-09-27 16:45:28 +02:00
|
|
|
explicit FWidget (FWidget* = 0); // constructor
|
2015-05-23 13:35:12 +02:00
|
|
|
~FWidget(); // destructor
|
|
|
|
|
|
|
|
const char* getClassName() const;
|
|
|
|
FWidget* getRootWidget() const;
|
|
|
|
static FWidget* getMainWidget();
|
|
|
|
static void setMainWidget (FWidget*);
|
|
|
|
static FWidget* childWidgetAt (FWidget*, const FPoint&);
|
|
|
|
static FWidget* childWidgetAt (FWidget*, int, int);
|
|
|
|
virtual FWidget* getFocusWidget() const;
|
|
|
|
virtual void setFocusWidget(FWidget*);
|
|
|
|
static FWidget* getClickedWidget();
|
|
|
|
static void setClickedWidget(FWidget*);
|
2015-10-23 00:24:20 +02:00
|
|
|
static FWidget* getOpenMenu();
|
|
|
|
static void setOpenMenu(FWidget*);
|
2015-05-23 13:35:12 +02:00
|
|
|
int numOfFocusableChildren();
|
2016-07-03 20:08:39 +02:00
|
|
|
FWidget* getParentWidget() const;
|
2015-05-23 13:35:12 +02:00
|
|
|
bool isRootWidget() const;
|
2016-09-25 23:53:48 +02:00
|
|
|
bool isWindowWidget() const;
|
|
|
|
bool isDialogWidget() const;
|
|
|
|
bool isMenuWidget() const;
|
2015-05-23 13:35:12 +02:00
|
|
|
virtual bool close();
|
|
|
|
|
|
|
|
static FStatusBar* statusBar();
|
2015-08-09 23:44:11 +02:00
|
|
|
static FMenuBar* menuBar();
|
2015-11-01 22:45:23 +01:00
|
|
|
virtual void setStatusbarMessage (FString);
|
2015-10-17 19:40:43 +02:00
|
|
|
void clearStatusbarMessage();
|
|
|
|
FString getStatusbarMessage();
|
|
|
|
|
|
|
|
void addCallback ( FString
|
|
|
|
, FCallback
|
|
|
|
, void* = null );
|
|
|
|
void addCallback ( FString
|
|
|
|
, FWidget*
|
|
|
|
, FMemberCallback
|
|
|
|
, void* = null );
|
|
|
|
void delCallback (FCallback);
|
|
|
|
void delCallback (FWidget*);
|
2016-07-30 14:34:13 +02:00
|
|
|
void delCallbacks();
|
2015-10-17 19:40:43 +02:00
|
|
|
void emitCallback (FString);
|
|
|
|
|
2015-11-12 01:33:16 +01:00
|
|
|
void addAccelerator (int);
|
|
|
|
virtual void addAccelerator (int, FWidget*);
|
|
|
|
void delAccelerator ();
|
|
|
|
virtual void delAccelerator (FWidget*);
|
2015-10-17 19:40:43 +02:00
|
|
|
|
|
|
|
virtual void redraw();
|
|
|
|
virtual void resize();
|
|
|
|
virtual void show();
|
|
|
|
virtual void hide();
|
|
|
|
bool setVisible();
|
|
|
|
bool isVisible() const;
|
|
|
|
bool isShown() const;
|
|
|
|
|
|
|
|
virtual bool setEnable(bool);
|
|
|
|
virtual bool setEnable();
|
|
|
|
virtual bool unsetEnable();
|
|
|
|
virtual bool setDisable();
|
|
|
|
bool isEnabled() const;
|
|
|
|
|
|
|
|
virtual bool setVisibleCursor(bool);
|
|
|
|
virtual bool setVisibleCursor();
|
|
|
|
virtual bool unsetVisibleCursor();
|
|
|
|
bool hasVisibleCursor() const;
|
|
|
|
|
2016-05-22 19:18:16 +02:00
|
|
|
virtual bool focusFirstChild();
|
|
|
|
virtual bool focusLastChild();
|
2016-06-19 23:18:53 +02:00
|
|
|
virtual bool setFocus (bool);
|
2015-10-17 19:40:43 +02:00
|
|
|
virtual bool setFocus();
|
|
|
|
virtual bool unsetFocus();
|
|
|
|
bool hasFocus() const;
|
|
|
|
bool acceptFocus() const;
|
|
|
|
void setFocusable();
|
|
|
|
void unsetFocusable();
|
|
|
|
|
2016-06-19 23:18:53 +02:00
|
|
|
bool ignorePadding (bool);
|
2015-10-17 19:40:43 +02:00
|
|
|
bool ignorePadding();
|
|
|
|
bool acceptPadding();
|
2016-09-29 04:29:12 +02:00
|
|
|
bool isPaddingIgnored();
|
2015-10-17 19:40:43 +02:00
|
|
|
|
2016-01-08 01:00:05 +01:00
|
|
|
short getForegroundColor() const;
|
|
|
|
short getBackgroundColor() const;
|
2015-10-17 19:40:43 +02:00
|
|
|
int getX() const;
|
|
|
|
int getY() const;
|
|
|
|
const FPoint getPos() const;
|
2016-09-25 23:53:48 +02:00
|
|
|
int getTermX() const;
|
|
|
|
int getTermY() const;
|
|
|
|
const FPoint getTermPos() const;
|
2015-10-17 19:40:43 +02:00
|
|
|
int getWidth() const;
|
|
|
|
int getHeight() const;
|
|
|
|
int getTopPadding() const;
|
|
|
|
int getLeftPadding() const;
|
|
|
|
int getBottomPadding() const;
|
|
|
|
int getRightPadding() const;
|
|
|
|
int getClientWidth() const;
|
|
|
|
int getClientHeight() const;
|
2016-09-11 16:48:39 +02:00
|
|
|
int getMaxWidth() const;
|
2016-09-25 23:53:48 +02:00
|
|
|
int getMaxHeight() const;
|
2015-10-17 19:40:43 +02:00
|
|
|
const FPoint& getShadow() const;
|
|
|
|
const FRect& getGeometry() const;
|
2016-09-25 23:53:48 +02:00
|
|
|
const FRect& getGeometryWithShadow();
|
|
|
|
const FRect& getTermGeometry();
|
|
|
|
const FRect& getTermGeometryWithShadow();
|
|
|
|
FPoint termToWidgetPos (const FPoint&);
|
2016-01-08 01:00:05 +01:00
|
|
|
void setForegroundColor (short);
|
|
|
|
void setBackgroundColor (short);
|
2016-09-25 23:53:48 +02:00
|
|
|
void setColor();
|
2016-01-08 01:00:05 +01:00
|
|
|
void setColor (short, short);
|
2015-10-17 19:40:43 +02:00
|
|
|
void setX (int, bool = true);
|
|
|
|
void setY (int, bool = true);
|
2015-12-16 23:57:14 +01:00
|
|
|
virtual void setPos (const FPoint&, bool = true);
|
|
|
|
virtual void setPos (int, int, bool = true);
|
2016-09-29 04:29:12 +02:00
|
|
|
virtual void setWidth (int, bool = true);
|
|
|
|
virtual void setHeight (int, bool = true);
|
|
|
|
virtual void setSize (int, int, bool = true);
|
2015-10-17 19:40:43 +02:00
|
|
|
void setTopPadding (int, bool = true);
|
|
|
|
void setLeftPadding (int, bool = true);
|
|
|
|
void setBottomPadding (int, bool = true);
|
|
|
|
void setRightPadding (int, bool = true);
|
2016-09-25 23:53:48 +02:00
|
|
|
void setParentOffset();
|
|
|
|
void setTermOffset();
|
|
|
|
void setTermOffsetWithPadding();
|
|
|
|
void getTermSize();
|
|
|
|
void setTermSize (int, int);
|
2015-10-17 19:40:43 +02:00
|
|
|
virtual void setGeometry (const FRect&, bool = true);
|
|
|
|
virtual void setGeometry (int, int, int, int, bool = true);
|
2016-09-25 23:53:48 +02:00
|
|
|
void setShadowSize (int, int);
|
|
|
|
void setMinimumSize (int, int);
|
|
|
|
void setMaximumSize (int, int);
|
|
|
|
void setFixedSize (int, int);
|
2015-10-17 19:40:43 +02:00
|
|
|
virtual void move (const FPoint&);
|
2015-11-12 01:33:16 +01:00
|
|
|
virtual void move (int, int);
|
2015-10-17 19:40:43 +02:00
|
|
|
int getFlags() const;
|
|
|
|
|
|
|
|
bool setCursor();
|
|
|
|
FPoint getCursorPos();
|
|
|
|
bool setCursorPos (const FPoint&);
|
|
|
|
bool setCursorPos (register int, register int);
|
|
|
|
void unsetCursorPos();
|
|
|
|
|
2016-09-25 23:53:48 +02:00
|
|
|
void printPos (const FPoint&);
|
|
|
|
void printPos (register int, register int);
|
2015-10-17 19:40:43 +02:00
|
|
|
|
2016-01-08 01:00:05 +01:00
|
|
|
static void setNormal();
|
|
|
|
|
2015-12-24 02:34:30 +01:00
|
|
|
static bool setBold (register bool);
|
2015-10-17 19:40:43 +02:00
|
|
|
static bool setBold();
|
|
|
|
static bool unsetBold();
|
|
|
|
static bool isBold();
|
|
|
|
|
2015-12-24 02:34:30 +01:00
|
|
|
static bool setDim (register bool);
|
|
|
|
static bool setDim();
|
|
|
|
static bool unsetDim();
|
|
|
|
static bool isDim();
|
|
|
|
|
|
|
|
static bool setItalic (register bool);
|
|
|
|
static bool setItalic();
|
|
|
|
static bool unsetItalic();
|
|
|
|
static bool isItalic();
|
|
|
|
|
2016-01-08 01:00:05 +01:00
|
|
|
static bool setUnderline (register bool);
|
|
|
|
static bool setUnderline();
|
|
|
|
static bool unsetUnderline();
|
|
|
|
static bool isUnderline();
|
|
|
|
|
|
|
|
static bool setBlink (register bool);
|
|
|
|
static bool setBlink();
|
|
|
|
static bool unsetBlink();
|
|
|
|
static bool isBlink();
|
|
|
|
|
2015-12-24 02:34:30 +01:00
|
|
|
static bool setReverse (register bool);
|
2015-10-17 19:40:43 +02:00
|
|
|
static bool setReverse();
|
|
|
|
static bool unsetReverse();
|
|
|
|
static bool isReverse();
|
|
|
|
|
2016-01-08 01:00:05 +01:00
|
|
|
static bool setStandout (register bool);
|
|
|
|
static bool setStandout();
|
|
|
|
static bool unsetStandout();
|
|
|
|
static bool isStandout();
|
|
|
|
|
|
|
|
static bool setInvisible (register bool);
|
|
|
|
static bool setInvisible();
|
|
|
|
static bool unsetInvisible();
|
|
|
|
static bool isInvisible();
|
|
|
|
|
|
|
|
static bool setProtected (register bool);
|
|
|
|
static bool setProtected();
|
|
|
|
static bool unsetProtected();
|
|
|
|
static bool isProtected();
|
|
|
|
|
|
|
|
static bool setCrossedOut (register bool);
|
|
|
|
static bool setCrossedOut();
|
|
|
|
static bool unsetCrossedOut();
|
|
|
|
static bool isCrossedOut();
|
|
|
|
|
|
|
|
static bool setDoubleUnderline (register bool);
|
|
|
|
static bool setDoubleUnderline();
|
|
|
|
static bool unsetDoubleUnderline();
|
|
|
|
static bool isDoubleUnderline();
|
|
|
|
|
|
|
|
static bool setAltCharset (register bool);
|
|
|
|
static bool setAltCharset();
|
|
|
|
static bool unsetAltCharset();
|
|
|
|
static bool isAltCharset();
|
|
|
|
|
|
|
|
static bool setPCcharset (register bool);
|
|
|
|
static bool setPCcharset();
|
|
|
|
static bool unsetPCcharset();
|
|
|
|
static bool isPCcharset();
|
2015-10-17 19:40:43 +02:00
|
|
|
|
2016-08-14 23:27:34 +02:00
|
|
|
static bool setTransparent (register bool);
|
|
|
|
static bool setTransparent();
|
|
|
|
static bool unsetTransparent();
|
|
|
|
static bool isTransparent();
|
|
|
|
|
|
|
|
static bool setTransShadow (register bool);
|
|
|
|
static bool setTransShadow();
|
|
|
|
static bool unsetTransShadow();
|
|
|
|
static bool isTransShadow();
|
|
|
|
|
2016-08-27 23:23:42 +02:00
|
|
|
static bool setInheritBackground (register bool);
|
|
|
|
static bool setInheritBackground();
|
|
|
|
static bool unsetInheritBackground();
|
|
|
|
static bool isInheritBackground();
|
|
|
|
|
2015-10-17 19:40:43 +02:00
|
|
|
void drawShadow();
|
|
|
|
void clearShadow();
|
|
|
|
void drawFlatBorder();
|
|
|
|
void clearFlatBorder();
|
2016-09-03 15:17:48 +02:00
|
|
|
void setDoubleFlatLine (int, bool = true);
|
|
|
|
void unsetDoubleFlatLine (int);
|
|
|
|
void setDoubleFlatLine (int, int, bool = true);
|
|
|
|
void unsetDoubleFlatLine (int, int);
|
|
|
|
std::vector<bool>& doubleFlatLine_ref (int);
|
2016-09-25 23:53:48 +02:00
|
|
|
virtual void drawBorder (int, int, int, int);
|
2015-10-17 19:40:43 +02:00
|
|
|
virtual void drawBorder();
|
2015-05-23 13:35:12 +02:00
|
|
|
|
2015-10-17 19:40:43 +02:00
|
|
|
static void quit();
|
2015-05-23 13:35:12 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#pragma pack(pop)
|
|
|
|
|
2015-10-17 19:40:43 +02:00
|
|
|
// FWidget inline functions
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline void FWidget::processDestroy()
|
|
|
|
{ emitCallback("destroy"); }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline void FWidget::setPrintArea (term_area* area)
|
|
|
|
{ print_area = area; }
|
|
|
|
|
2015-05-23 13:35:12 +02:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline const char* FWidget::getClassName() const
|
|
|
|
{ return "FWidget"; }
|
|
|
|
|
2015-10-17 19:40:43 +02:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline FWidget* FWidget::childWidgetAt (FWidget* p, const FPoint& pos)
|
|
|
|
{ return childWidgetAt (p, pos.getX(), pos.getY()); }
|
|
|
|
|
2015-05-23 13:35:12 +02:00
|
|
|
//----------------------------------------------------------------------
|
2016-07-03 20:08:39 +02:00
|
|
|
inline FWidget* FWidget::getParentWidget() const
|
2015-09-20 05:44:50 +02:00
|
|
|
{ return static_cast<FWidget*>(getParent()); }
|
2015-05-23 13:35:12 +02:00
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FWidget::isRootWidget() const
|
|
|
|
{ return (! hasParent()); }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline void FWidget::clearStatusbarMessage()
|
|
|
|
{ statusbar_message.clear(); }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline FString FWidget::getStatusbarMessage()
|
|
|
|
{ return statusbar_message; }
|
|
|
|
|
2015-11-12 01:33:16 +01:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline void FWidget::addAccelerator (int key)
|
|
|
|
{ addAccelerator (key, this); }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline void FWidget::delAccelerator()
|
|
|
|
{ delAccelerator(this); }
|
|
|
|
|
2015-05-23 13:35:12 +02:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FWidget::setVisible()
|
|
|
|
{ return visible = true; }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FWidget::isVisible() const
|
|
|
|
{ return visible; }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FWidget::isShown() const
|
|
|
|
{ return shown; }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
2016-09-25 23:53:48 +02:00
|
|
|
inline bool FWidget::isWindowWidget() const
|
|
|
|
{ return ((flags & fc::window_widget) != 0); }
|
2015-05-23 13:35:12 +02:00
|
|
|
|
2016-06-12 23:06:58 +02:00
|
|
|
//----------------------------------------------------------------------
|
2016-09-25 23:53:48 +02:00
|
|
|
inline bool FWidget::isDialogWidget() const
|
|
|
|
{ return ((flags & fc::dialog_widget) != 0); }
|
2016-06-12 23:06:58 +02:00
|
|
|
|
2016-05-16 23:26:04 +02:00
|
|
|
//----------------------------------------------------------------------
|
2016-09-25 23:53:48 +02:00
|
|
|
inline bool FWidget::isMenuWidget() const
|
|
|
|
{ return ((flags & fc::menu_widget) != 0); }
|
2016-05-16 23:26:04 +02:00
|
|
|
|
2015-05-23 13:35:12 +02:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FWidget::isEnabled() const
|
|
|
|
{ return enable; }
|
|
|
|
|
2015-10-17 19:40:43 +02:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FWidget::setVisibleCursor (bool on)
|
2016-09-27 00:46:05 +02:00
|
|
|
{ return visible_cursor = (on) ? true : false; }
|
2015-10-17 19:40:43 +02:00
|
|
|
|
2015-05-23 13:35:12 +02:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FWidget::setVisibleCursor()
|
|
|
|
{ return setVisibleCursor(true); }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FWidget::unsetVisibleCursor()
|
|
|
|
{ return setVisibleCursor(false); }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FWidget::hasVisibleCursor() const
|
2016-09-27 00:46:05 +02:00
|
|
|
{ return visible_cursor; }
|
2015-05-23 13:35:12 +02:00
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FWidget::setFocus()
|
|
|
|
{ return setFocus(true); }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FWidget::unsetFocus()
|
|
|
|
{ return setFocus(false); }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FWidget::hasFocus() const
|
|
|
|
{ return focus; }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FWidget::acceptFocus() const
|
|
|
|
{ return focusable; }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FWidget::ignorePadding (bool on)
|
|
|
|
{ return ignore_padding = on; }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FWidget::ignorePadding()
|
|
|
|
{ return ignore_padding = true; }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FWidget::acceptPadding()
|
|
|
|
{ return ignore_padding = false; }
|
|
|
|
|
2016-09-29 04:29:12 +02:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FWidget::isPaddingIgnored()
|
|
|
|
{ return ignore_padding; }
|
|
|
|
|
2015-05-23 13:35:12 +02:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline void FWidget::setFocusable()
|
|
|
|
{ focusable = true; }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline void FWidget::unsetFocusable()
|
|
|
|
{ focusable = false; }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
2016-01-08 01:00:05 +01:00
|
|
|
inline short FWidget::getForegroundColor() const
|
2016-09-25 23:53:48 +02:00
|
|
|
{ return foreground_color; }
|
2015-05-23 13:35:12 +02:00
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
2016-01-08 01:00:05 +01:00
|
|
|
inline short FWidget::getBackgroundColor() const
|
2016-09-25 23:53:48 +02:00
|
|
|
{ return background_color; }
|
2015-05-23 13:35:12 +02:00
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
2016-09-25 23:53:48 +02:00
|
|
|
inline int FWidget::getX() const // x-position relative to the widget
|
|
|
|
{ return adjust_wsize.getX(); }
|
2015-05-23 13:35:12 +02:00
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
2016-09-25 23:53:48 +02:00
|
|
|
inline int FWidget::getY() const // y-position relative to the widget
|
|
|
|
{ return adjust_wsize.getY(); }
|
2015-05-23 13:35:12 +02:00
|
|
|
|
2015-09-27 16:00:13 +02:00
|
|
|
//----------------------------------------------------------------------
|
2016-09-25 23:53:48 +02:00
|
|
|
inline const FPoint FWidget::getPos() const // position relative to the widget
|
|
|
|
{ return adjust_wsize.getPos(); }
|
2015-09-27 16:00:13 +02:00
|
|
|
|
2015-05-23 13:35:12 +02:00
|
|
|
//----------------------------------------------------------------------
|
2016-09-25 23:53:48 +02:00
|
|
|
inline int FWidget::getTermX() const // x-position on terminal
|
|
|
|
{ return offset.getX1() + adjust_wsize.getX(); }
|
2015-05-23 13:35:12 +02:00
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
2016-09-25 23:53:48 +02:00
|
|
|
inline int FWidget::getTermY() const // y-position on terminal
|
|
|
|
{ return offset.getY1() + adjust_wsize.getY(); }
|
2015-05-23 13:35:12 +02:00
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
2016-09-25 23:53:48 +02:00
|
|
|
inline const FPoint FWidget::getTermPos() const // position on terminal
|
|
|
|
{ return FPoint(getTermX(), getTermY()); }
|
2015-05-23 13:35:12 +02:00
|
|
|
|
2015-10-17 19:40:43 +02:00
|
|
|
//----------------------------------------------------------------------
|
2016-09-25 23:53:48 +02:00
|
|
|
inline FPoint FWidget::termToWidgetPos (const FPoint& tPos)
|
2015-10-17 19:40:43 +02:00
|
|
|
{
|
2016-09-25 23:53:48 +02:00
|
|
|
return FPoint ( tPos.getX() + 1 - offset.getX1() - adjust_wsize.getX()
|
|
|
|
, tPos.getY() + 1 - offset.getY1() - adjust_wsize.getY() );
|
2015-10-17 19:40:43 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
2016-01-08 01:00:05 +01:00
|
|
|
inline void FWidget::setForegroundColor (short color)
|
2015-10-17 19:40:43 +02:00
|
|
|
{
|
2016-01-10 00:56:52 +01:00
|
|
|
// valid colors -1..254
|
|
|
|
if ( color == fc::Default || color >> 8 == 0 )
|
2016-09-25 23:53:48 +02:00
|
|
|
foreground_color = color;
|
2015-10-17 19:40:43 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
2016-01-08 01:00:05 +01:00
|
|
|
inline void FWidget::setBackgroundColor (short color)
|
2015-10-17 19:40:43 +02:00
|
|
|
{
|
2016-01-10 00:56:52 +01:00
|
|
|
// valid colors -1..254
|
|
|
|
if ( color == fc::Default || color >> 8 == 0 )
|
2016-09-25 23:53:48 +02:00
|
|
|
background_color = color;
|
2015-10-17 19:40:43 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline void FWidget::setPos (const FPoint& p, bool adjust)
|
|
|
|
{ setPos (p.getX(), p.getY(), adjust); }
|
|
|
|
|
2015-05-23 13:35:12 +02:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline int FWidget::getWidth() const
|
2016-09-25 23:53:48 +02:00
|
|
|
{ return adjust_wsize.getWidth(); }
|
2015-05-23 13:35:12 +02:00
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline int FWidget::getHeight() const
|
2016-09-25 23:53:48 +02:00
|
|
|
{ return adjust_wsize.getHeight(); }
|
2015-05-23 13:35:12 +02:00
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline int FWidget::getTopPadding() const
|
2016-09-25 23:53:48 +02:00
|
|
|
{ return padding.top; }
|
2015-05-23 13:35:12 +02:00
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline int FWidget::getLeftPadding() const
|
2016-09-25 23:53:48 +02:00
|
|
|
{ return padding.left; }
|
2015-05-23 13:35:12 +02:00
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline int FWidget::getBottomPadding() const
|
2016-09-25 23:53:48 +02:00
|
|
|
{ return padding.bottom; }
|
2015-05-23 13:35:12 +02:00
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline int FWidget::getRightPadding() const
|
2016-09-25 23:53:48 +02:00
|
|
|
{ return padding.right; }
|
2015-05-23 13:35:12 +02:00
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline int FWidget::getClientWidth() const
|
2016-09-25 23:53:48 +02:00
|
|
|
{ return client_offset.getWidth(); }
|
2015-05-23 13:35:12 +02:00
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline int FWidget::getClientHeight() const
|
2016-09-25 23:53:48 +02:00
|
|
|
{ return client_offset.getHeight(); }
|
2015-05-23 13:35:12 +02:00
|
|
|
|
2016-09-11 16:48:39 +02:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline int FWidget::getMaxWidth() const
|
2016-09-25 23:53:48 +02:00
|
|
|
{ return offset.getWidth(); }
|
2016-09-11 16:48:39 +02:00
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
2016-09-25 23:53:48 +02:00
|
|
|
inline int FWidget::getMaxHeight() const
|
|
|
|
{ return offset.getHeight(); }
|
2016-09-11 16:48:39 +02:00
|
|
|
|
2015-05-23 13:35:12 +02:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline const FPoint& FWidget::getShadow() const
|
2016-09-25 23:53:48 +02:00
|
|
|
{ return wshadow; }
|
2015-05-23 13:35:12 +02:00
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline const FRect& FWidget::getGeometry() const
|
2016-09-25 23:53:48 +02:00
|
|
|
{ return adjust_wsize; }
|
2015-05-23 13:35:12 +02:00
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
2016-09-25 23:53:48 +02:00
|
|
|
inline const FRect& FWidget::getGeometryWithShadow()
|
|
|
|
{
|
|
|
|
adjust_wsize_shadow.setCoordinates
|
|
|
|
(
|
|
|
|
adjust_wsize.x1_ref(),
|
|
|
|
adjust_wsize.y1_ref(),
|
|
|
|
adjust_wsize.x2_ref() + wshadow.x_ref(),
|
|
|
|
adjust_wsize.y2_ref() + wshadow.y_ref()
|
|
|
|
);
|
|
|
|
return adjust_wsize_shadow;
|
|
|
|
}
|
2015-05-23 13:35:12 +02:00
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
2016-09-25 23:53:48 +02:00
|
|
|
inline const FRect& FWidget::getTermGeometry()
|
|
|
|
{
|
|
|
|
adjust_wsize_term.setCoordinates
|
|
|
|
(
|
|
|
|
adjust_wsize.x1_ref() + offset.x1_ref(),
|
|
|
|
adjust_wsize.y1_ref() + offset.y1_ref(),
|
|
|
|
adjust_wsize.x2_ref() + offset.x1_ref(),
|
|
|
|
adjust_wsize.y2_ref() + offset.y1_ref()
|
|
|
|
);
|
|
|
|
return adjust_wsize_term;
|
|
|
|
}
|
2015-05-23 13:35:12 +02:00
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
2016-09-25 23:53:48 +02:00
|
|
|
inline const FRect& FWidget::getTermGeometryWithShadow()
|
|
|
|
{
|
|
|
|
adjust_wsize_term_shadow.setCoordinates
|
|
|
|
(
|
|
|
|
adjust_wsize.x1_ref() + offset.x1_ref(),
|
|
|
|
adjust_wsize.y1_ref() + offset.y1_ref(),
|
|
|
|
adjust_wsize.x2_ref() + offset.x1_ref() + wshadow.x_ref(),
|
|
|
|
adjust_wsize.y2_ref() + offset.y1_ref() + wshadow.y_ref()
|
|
|
|
);
|
|
|
|
return adjust_wsize_term_shadow;
|
|
|
|
}
|
2015-05-23 13:35:12 +02:00
|
|
|
|
2015-10-17 19:40:43 +02:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline void FWidget::setGeometry (const FRect& box, bool adjust)
|
|
|
|
{
|
|
|
|
setGeometry ( box.getX()
|
|
|
|
, box.getY()
|
|
|
|
, box.getWidth()
|
|
|
|
, box.getHeight()
|
|
|
|
, adjust );
|
|
|
|
}
|
|
|
|
|
2016-09-25 23:53:48 +02:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline void FWidget::setShadowSize (int right, int bottom)
|
|
|
|
{ wshadow.setPoint (right, bottom); }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline void FWidget::setMinimumSize (int min_width, int min_height)
|
|
|
|
{ size_hints.setMinimum (min_width, min_height); }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline void FWidget::setMaximumSize (int max_width, int max_height)
|
|
|
|
{ size_hints.setMaximum (max_width, max_height); }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline void FWidget::setFixedSize (int width, int height)
|
|
|
|
{
|
|
|
|
size_hints.setMinimum (width, height);
|
|
|
|
size_hints.setMaximum (width, height);
|
|
|
|
}
|
|
|
|
|
2015-10-17 19:40:43 +02:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline void FWidget::move (const FPoint& pos)
|
|
|
|
{ move( pos.getX(), pos.getY() ); }
|
|
|
|
|
2015-05-23 13:35:12 +02:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline int FWidget::getFlags() const
|
|
|
|
{ return flags; }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline FPoint FWidget::getCursorPos()
|
2016-09-27 00:46:05 +02:00
|
|
|
{ return widget_cursor_position; }
|
2015-05-23 13:35:12 +02:00
|
|
|
|
2015-10-17 19:40:43 +02:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FWidget::setCursorPos (const FPoint& pos)
|
|
|
|
{ return setCursorPos (pos.getX(), pos.getY()); }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline void FWidget::unsetCursorPos()
|
2016-09-27 00:46:05 +02:00
|
|
|
{ widget_cursor_position.setPoint(-1,-1); }
|
2015-10-17 19:40:43 +02:00
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
2016-09-25 23:53:48 +02:00
|
|
|
inline void FWidget::printPos (const FPoint& pos)
|
|
|
|
{ printPos (pos.getX(), pos.getY()); }
|
2015-10-17 19:40:43 +02:00
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
2016-09-25 23:53:48 +02:00
|
|
|
inline void FWidget::printPos (register int x, register int y)
|
|
|
|
{
|
|
|
|
cursor->setPoint ( offset.getX1() + adjust_wsize.getX() - 1 + x,
|
|
|
|
offset.getY1() + adjust_wsize.getY() - 1 + y );
|
|
|
|
}
|
2015-10-17 19:40:43 +02:00
|
|
|
|
2016-01-08 01:00:05 +01:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline void FWidget::setNormal()
|
|
|
|
{
|
|
|
|
next_attribute.bold = \
|
|
|
|
next_attribute.dim = \
|
|
|
|
next_attribute.italic = \
|
|
|
|
next_attribute.underline = \
|
|
|
|
next_attribute.blink = \
|
|
|
|
next_attribute.reverse = \
|
|
|
|
next_attribute.standout = \
|
|
|
|
next_attribute.invisible = \
|
|
|
|
next_attribute.protect = \
|
|
|
|
next_attribute.crossed_out = \
|
|
|
|
next_attribute.dbl_underline = \
|
|
|
|
next_attribute.alt_charset = \
|
2016-08-14 23:27:34 +02:00
|
|
|
next_attribute.pc_charset = \
|
|
|
|
next_attribute.transparent = \
|
2016-08-27 23:23:42 +02:00
|
|
|
next_attribute.trans_shadow = \
|
|
|
|
next_attribute.inherit_bg = false;
|
2016-01-08 01:00:05 +01:00
|
|
|
|
2016-01-10 00:56:52 +01:00
|
|
|
next_attribute.fg_color = fc::Default;
|
|
|
|
next_attribute.bg_color = fc::Default;
|
2016-01-08 01:00:05 +01:00
|
|
|
}
|
|
|
|
|
2015-10-17 19:40:43 +02:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FWidget::setBold (register bool on)
|
2016-01-08 01:00:05 +01:00
|
|
|
{ return (next_attribute.bold = on); }
|
2015-10-17 19:40:43 +02:00
|
|
|
|
2015-05-23 13:35:12 +02:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FWidget::setBold()
|
|
|
|
{ return setBold(true); }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FWidget::unsetBold()
|
|
|
|
{ return setBold(false); }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FWidget::isBold()
|
2016-01-08 01:00:05 +01:00
|
|
|
{ return next_attribute.bold; }
|
2015-05-23 13:35:12 +02:00
|
|
|
|
2015-12-24 02:34:30 +01:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FWidget::setDim (register bool on)
|
2016-01-08 01:00:05 +01:00
|
|
|
{ return (next_attribute.dim = on); }
|
2015-12-24 02:34:30 +01:00
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FWidget::setDim()
|
|
|
|
{ return setDim(true); }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FWidget::unsetDim()
|
|
|
|
{ return setDim(false); }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FWidget::isDim()
|
2016-01-08 01:00:05 +01:00
|
|
|
{ return next_attribute.dim; }
|
2015-12-24 02:34:30 +01:00
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FWidget::setItalic (register bool on)
|
2016-01-08 01:00:05 +01:00
|
|
|
{ return (next_attribute.italic = on); }
|
2015-12-24 02:34:30 +01:00
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FWidget::setItalic()
|
|
|
|
{ return setItalic(true); }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FWidget::unsetItalic()
|
|
|
|
{ return setItalic(false); }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FWidget::isItalic()
|
2016-01-08 01:00:05 +01:00
|
|
|
{ return next_attribute.italic; }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FWidget::setUnderline (register bool on)
|
|
|
|
{ return (next_attribute.underline = on); }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FWidget::setUnderline()
|
|
|
|
{ return setUnderline(true); }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FWidget::unsetUnderline()
|
|
|
|
{ return setUnderline(false); }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FWidget::isUnderline()
|
|
|
|
{ return next_attribute.underline; }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FWidget::setBlink (register bool on)
|
|
|
|
{ return (next_attribute.blink = on); }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FWidget::setBlink()
|
|
|
|
{ return setBlink(true); }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FWidget::unsetBlink()
|
|
|
|
{ return setBlink(false); }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FWidget::isBlink()
|
|
|
|
{ return next_attribute.blink; }
|
2015-12-24 02:34:30 +01:00
|
|
|
|
2015-10-17 19:40:43 +02:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FWidget::setReverse (register bool on)
|
2016-01-08 01:00:05 +01:00
|
|
|
{ return (next_attribute.reverse = on); }
|
2015-10-17 19:40:43 +02:00
|
|
|
|
2015-05-23 13:35:12 +02:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FWidget::setReverse()
|
|
|
|
{ return setReverse(true); }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FWidget::unsetReverse()
|
|
|
|
{ return setReverse(false); }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FWidget::isReverse()
|
2016-01-08 01:00:05 +01:00
|
|
|
{ return next_attribute.reverse; }
|
2015-05-23 13:35:12 +02:00
|
|
|
|
2015-10-17 19:40:43 +02:00
|
|
|
//----------------------------------------------------------------------
|
2016-01-08 01:00:05 +01:00
|
|
|
inline bool FWidget::setStandout (register bool on)
|
|
|
|
{ return (next_attribute.standout = on); }
|
2015-10-17 19:40:43 +02:00
|
|
|
|
2015-05-23 13:35:12 +02:00
|
|
|
//----------------------------------------------------------------------
|
2016-01-08 01:00:05 +01:00
|
|
|
inline bool FWidget::setStandout()
|
|
|
|
{ return setStandout(true); }
|
2015-05-23 13:35:12 +02:00
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
2016-01-08 01:00:05 +01:00
|
|
|
inline bool FWidget::unsetStandout()
|
|
|
|
{ return setStandout(false); }
|
2015-05-23 13:35:12 +02:00
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
2016-01-08 01:00:05 +01:00
|
|
|
inline bool FWidget::isStandout()
|
|
|
|
{ return next_attribute.standout; }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FWidget::setInvisible (register bool on)
|
|
|
|
{ return (next_attribute.invisible = on); }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FWidget::setInvisible()
|
|
|
|
{ return setInvisible(true); }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FWidget::unsetInvisible()
|
|
|
|
{ return setInvisible(false); }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FWidget::isInvisible()
|
|
|
|
{ return next_attribute.invisible; }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FWidget::setProtected (register bool on)
|
|
|
|
{ return (next_attribute.protect = on); }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FWidget::setProtected()
|
|
|
|
{ return setProtected(true); }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FWidget::unsetProtected()
|
|
|
|
{ return setProtected(false); }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FWidget::isProtected()
|
|
|
|
{ return next_attribute.protect; }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FWidget::setCrossedOut (register bool on)
|
|
|
|
{ return (next_attribute.crossed_out = on); }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FWidget::setCrossedOut()
|
|
|
|
{ return setCrossedOut(true); }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FWidget::unsetCrossedOut()
|
|
|
|
{ return setCrossedOut(false); }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FWidget::isCrossedOut()
|
|
|
|
{ return next_attribute.crossed_out; }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FWidget::setDoubleUnderline (register bool on)
|
|
|
|
{ return (next_attribute.dbl_underline = on); }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FWidget::setDoubleUnderline()
|
|
|
|
{ return setDoubleUnderline(true); }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FWidget::unsetDoubleUnderline()
|
|
|
|
{ return setDoubleUnderline(false); }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FWidget::isDoubleUnderline()
|
|
|
|
{ return next_attribute.dbl_underline; }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FWidget::setAltCharset (register bool on)
|
|
|
|
{ return (next_attribute.alt_charset = on); }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FWidget::setAltCharset()
|
|
|
|
{ return setAltCharset(true); }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FWidget::unsetAltCharset()
|
|
|
|
{ return setAltCharset(false); }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FWidget::isAltCharset()
|
|
|
|
{ return next_attribute.alt_charset; }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FWidget::setPCcharset (register bool on)
|
|
|
|
{ return (next_attribute.pc_charset = on); }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FWidget::setPCcharset()
|
|
|
|
{ return setPCcharset(true); }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FWidget::unsetPCcharset()
|
|
|
|
{ return setPCcharset(false); }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FWidget::isPCcharset()
|
|
|
|
{ return next_attribute.pc_charset; }
|
2015-05-23 13:35:12 +02:00
|
|
|
|
2016-08-14 23:27:34 +02:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FWidget::setTransparent (register bool on)
|
|
|
|
{ return (next_attribute.transparent = on); }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FWidget::setTransparent()
|
|
|
|
{ return setTransparent(true); }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FWidget::unsetTransparent()
|
|
|
|
{ return setTransparent(false); }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FWidget::isTransparent()
|
|
|
|
{ return next_attribute.transparent; }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FWidget::setTransShadow (register bool on)
|
|
|
|
{ return (next_attribute.trans_shadow = on); }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FWidget::setTransShadow()
|
|
|
|
{ return setTransShadow(true); }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FWidget::unsetTransShadow()
|
|
|
|
{ return setTransShadow(false); }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FWidget::isTransShadow()
|
|
|
|
{ return next_attribute.trans_shadow; }
|
|
|
|
|
2016-08-27 23:23:42 +02:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FWidget::setInheritBackground (register bool on)
|
|
|
|
{ return (next_attribute.inherit_bg = on); }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FWidget::setInheritBackground()
|
|
|
|
{ return setInheritBackground(true); }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FWidget::unsetInheritBackground()
|
|
|
|
{ return setInheritBackground(false); }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FWidget::isInheritBackground()
|
|
|
|
{ return next_attribute.inherit_bg; }
|
|
|
|
|
2015-06-21 23:27:10 +02:00
|
|
|
//----------------------------------------------------------------------
|
2016-09-25 23:53:48 +02:00
|
|
|
inline void FWidget::unsetDoubleFlatLine (int side)
|
2015-06-21 23:27:10 +02:00
|
|
|
{ setDoubleFlatLine(side, false); }
|
|
|
|
|
2016-09-03 15:17:48 +02:00
|
|
|
//----------------------------------------------------------------------
|
2016-09-25 23:53:48 +02:00
|
|
|
inline void FWidget::unsetDoubleFlatLine (int side, int pos)
|
2016-09-03 15:17:48 +02:00
|
|
|
{ setDoubleFlatLine(side, pos, false); }
|
|
|
|
|
2016-09-25 23:53:48 +02:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline void FWidget::drawBorder()
|
|
|
|
{ drawBorder (1, getWidth(), 1, getHeight()); }
|
|
|
|
|
2015-05-23 13:35:12 +02:00
|
|
|
|
|
|
|
// NewFont elements
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
const wchar_t NF_Drive[5] =
|
|
|
|
{
|
|
|
|
fc::NF_shadow_box_left,
|
|
|
|
fc::NF_shadow_box_middle,
|
|
|
|
fc::NF_shadow_box_hdd,
|
|
|
|
fc::NF_shadow_box_right,
|
|
|
|
'\0'
|
|
|
|
};
|
|
|
|
const wchar_t NF_CD_ROM[5] =
|
|
|
|
{
|
|
|
|
fc::NF_shadow_box_left,
|
|
|
|
fc::NF_shadow_box_middle,
|
|
|
|
fc::NF_shadow_box_cd,
|
|
|
|
fc::NF_shadow_box_right,
|
|
|
|
'\0'
|
|
|
|
};
|
|
|
|
const wchar_t NF_Net_Drive[5] =
|
|
|
|
{
|
|
|
|
fc::NF_shadow_box_left,
|
|
|
|
fc::NF_shadow_box_middle,
|
|
|
|
fc::NF_shadow_box_net,
|
|
|
|
fc::NF_shadow_box_right,
|
|
|
|
'\0'
|
|
|
|
};
|
|
|
|
const wchar_t CHECKBOX[4] =
|
|
|
|
{
|
|
|
|
fc::NF_shadow_box_left,
|
|
|
|
fc::NF_shadow_box_middle,
|
|
|
|
fc::NF_shadow_box_right,
|
|
|
|
'\0'
|
|
|
|
};
|
|
|
|
const wchar_t CHECKBOX_ON[4] =
|
|
|
|
{
|
|
|
|
fc::NF_shadow_box_left,
|
|
|
|
fc::NF_shadow_box_checked,
|
|
|
|
fc::NF_shadow_box_right,
|
|
|
|
'\0'
|
|
|
|
};
|
|
|
|
const wchar_t RADIO_BUTTON[4] =
|
|
|
|
{
|
|
|
|
fc::NF_radio_button1,
|
|
|
|
fc::NF_radio_button2,
|
|
|
|
fc::NF_radio_button3,
|
|
|
|
'\0'
|
|
|
|
};
|
|
|
|
const wchar_t CHECKED_RADIO_BUTTON[4] =
|
|
|
|
{
|
|
|
|
fc::NF_radio_button1,
|
|
|
|
fc::NF_radio_button2_checked,
|
|
|
|
fc::NF_radio_button3,
|
|
|
|
'\0'
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // _FWIDGET_H
|