New FToolTip widget to show assisted information
This commit is contained in:
parent
c25ee14fe7
commit
9ccc5a4f27
|
@ -1,3 +1,7 @@
|
||||||
|
2016-10-01 Markus Gans <guru.mail@muenster.de>
|
||||||
|
* Add an always-on-top mode for window objects
|
||||||
|
* New FToolTip widget to show assisted information
|
||||||
|
|
||||||
2016-09-30 Markus Gans <guru.mail@muenster.de>
|
2016-09-30 Markus Gans <guru.mail@muenster.de>
|
||||||
* Using arrow keys to move or to resize a window
|
* Using arrow keys to move or to resize a window
|
||||||
|
|
||||||
|
|
|
@ -55,7 +55,7 @@
|
||||||
│ FTerm │◄─┘ : : ├────┤ FProgressbar │ └──┤ FSwitch ├-------:
|
│ FTerm │◄─┘ : : ├────┤ FProgressbar │ └──┤ FSwitch ├-------:
|
||||||
└┬─┬─┬──┘ : : │ └──────────────┘ └─────────┘ :
|
└┬─┬─┬──┘ : : │ └──────────────┘ └─────────┘ :
|
||||||
:1:1:1 : : │ ┌────────────┐ : *┌─────────┐
|
:1:1:1 : : │ ┌────────────┐ : *┌─────────┐
|
||||||
: : └----------: : ├────┤ FScrollbar │ ├---┤ FString │
|
: : └----------┤ : ├────┤ FScrollbar │ ├---┤ FString │
|
||||||
: :1 : : │ └────────────┘ : └─────────┘
|
: :1 : : │ └────────────┘ : └─────────┘
|
||||||
:┌┴──────────┐ : : │ ┌───────────┐1 :
|
:┌┴──────────┐ : : │ ┌───────────┐1 :
|
||||||
:│ FOptiAttr │ : : ├────┤ FTextView ├---------------------------:
|
:│ FOptiAttr │ : : ├────┤ FTextView ├---------------------------:
|
||||||
|
@ -70,13 +70,16 @@
|
||||||
: : │ ┌─────────────┐1 :
|
: : │ ┌─────────────┐1 :
|
||||||
: : ┌───┴─────┐ ┌─────────┐ ┌──┤ FFileDialog ├----:
|
: : ┌───┴─────┐ ┌─────────┐ ┌──┤ FFileDialog ├----:
|
||||||
: : │ FWindow │◄─┤ FDialog │◄──┤ └─────────────┘ :
|
: : │ FWindow │◄─┤ FDialog │◄──┤ └─────────────┘ :
|
||||||
: : └───┬─────┘ └────┬────┘ │ ┌─────────────┐1 :
|
: : └──┬──┬───┘ └────┬────┘ │ ┌─────────────┐1 :
|
||||||
: : ▲ 1: └──┤ FMessageBox ├----:
|
: : ▲ ▲ 1: └──┤ FMessageBox ├----:
|
||||||
: : │ : └─────────────┘ :
|
: : │ │ : └─────────────┘ :
|
||||||
: : │ └------------------------------:
|
: : │ │ └------------------------------:
|
||||||
|
: : │ │ ┌──────────┐ :
|
||||||
|
: : │ └──────┤ FToolTip │ :
|
||||||
|
: : │ └──────────┘ :
|
||||||
: : └───────────────┐ ┌──────────┐ :
|
: : └───────────────┐ ┌──────────┐ :
|
||||||
: : │ ┌───┤ FMenuBar │ :
|
: : │ ┌───┤ FMenuBar │ :
|
||||||
: : ┌───────────┐ └─────┤ └──────────┘ :
|
: : ┌───────────┐ └──────┤ └──────────┘ :
|
||||||
: : │ FMenuList │◄──────────┤ ┌───────┐ :
|
: : │ FMenuList │◄──────────┤ ┌───────┐ :
|
||||||
: : └────┬──────┘ └───┤ FMenu │◄──┐ :
|
: : └────┬──────┘ └───┤ FMenu │◄──┐ :
|
||||||
: : : └───────┘ │ :
|
: : : └───────┘ │ :
|
||||||
|
@ -92,7 +95,7 @@
|
||||||
: : └---------------------------------------┘ :
|
: : └---------------------------------------┘ :
|
||||||
: └---------------------------------------------------┘
|
: └---------------------------------------------------┘
|
||||||
: *┌────────┐
|
: *┌────────┐
|
||||||
:---┤ FPoint │
|
├---┤ FPoint │
|
||||||
: └────────┘
|
: └────────┘
|
||||||
: *┌───────┐
|
: *┌───────┐
|
||||||
└---┤ FRect │
|
└---┤ FRect │
|
||||||
|
|
|
@ -33,6 +33,7 @@ libfinal_la_SOURCES = \
|
||||||
fdialog.cpp \
|
fdialog.cpp \
|
||||||
fwindow.cpp \
|
fwindow.cpp \
|
||||||
fmessagebox.cpp \
|
fmessagebox.cpp \
|
||||||
|
ftooltip.cpp \
|
||||||
ffiledialog.cpp \
|
ffiledialog.cpp \
|
||||||
ftextview.cpp \
|
ftextview.cpp \
|
||||||
fstatusbar.cpp \
|
fstatusbar.cpp \
|
||||||
|
@ -73,6 +74,7 @@ finalcutinclude_HEADERS = \
|
||||||
fcheckmenuitem.h \
|
fcheckmenuitem.h \
|
||||||
fmenulist.h \
|
fmenulist.h \
|
||||||
fmessagebox.h \
|
fmessagebox.h \
|
||||||
|
ftooltip.h \
|
||||||
fobject.h \
|
fobject.h \
|
||||||
fpoint.h \
|
fpoint.h \
|
||||||
foptiattr.h \
|
foptiattr.h \
|
||||||
|
|
|
@ -26,6 +26,7 @@ INCLUDE_HEADERS = \
|
||||||
fradiomenuitem.h \
|
fradiomenuitem.h \
|
||||||
fcheckmenuitem.h \
|
fcheckmenuitem.h \
|
||||||
fmessagebox.h \
|
fmessagebox.h \
|
||||||
|
ftooltip.h \
|
||||||
fobject.h \
|
fobject.h \
|
||||||
foptiattr.h \
|
foptiattr.h \
|
||||||
foptimove.h \
|
foptimove.h \
|
||||||
|
@ -77,6 +78,7 @@ OBJS = \
|
||||||
fdialog.o \
|
fdialog.o \
|
||||||
fwindow.o \
|
fwindow.o \
|
||||||
fmessagebox.o \
|
fmessagebox.o \
|
||||||
|
ftooltip.o \
|
||||||
ffiledialog.o \
|
ffiledialog.o \
|
||||||
ftextview.o \
|
ftextview.o \
|
||||||
fstatusbar.o \
|
fstatusbar.o \
|
||||||
|
|
|
@ -26,6 +26,7 @@ INCLUDE_HEADERS = \
|
||||||
fradiomenuitem.h \
|
fradiomenuitem.h \
|
||||||
fcheckmenuitem.h \
|
fcheckmenuitem.h \
|
||||||
fmessagebox.h \
|
fmessagebox.h \
|
||||||
|
ftooltip.h \
|
||||||
fobject.h \
|
fobject.h \
|
||||||
foptiattr.h \
|
foptiattr.h \
|
||||||
foptimove.h \
|
foptimove.h \
|
||||||
|
@ -77,6 +78,7 @@ OBJS = \
|
||||||
fdialog.o \
|
fdialog.o \
|
||||||
fwindow.o \
|
fwindow.o \
|
||||||
fmessagebox.o \
|
fmessagebox.o \
|
||||||
|
ftooltip.o \
|
||||||
ffiledialog.o \
|
ffiledialog.o \
|
||||||
ftextview.o \
|
ftextview.o \
|
||||||
fstatusbar.o \
|
fstatusbar.o \
|
||||||
|
|
|
@ -133,9 +133,9 @@ am_libfinal_la_OBJECTS = fstring.lo fpoint.lo frect.lo fscrollbar.lo \
|
||||||
ftogglebutton.lo fradiobutton.lo fcheckbox.lo fswitch.lo \
|
ftogglebutton.lo fradiobutton.lo fcheckbox.lo fswitch.lo \
|
||||||
flabel.lo flistbox.lo fmenu.lo fdialoglistmenu.lo fmenubar.lo \
|
flabel.lo flistbox.lo fmenu.lo fdialoglistmenu.lo fmenubar.lo \
|
||||||
fmenuitem.lo fradiomenuitem.lo fcheckmenuitem.lo fmenulist.lo \
|
fmenuitem.lo fradiomenuitem.lo fcheckmenuitem.lo fmenulist.lo \
|
||||||
fdialog.lo fwindow.lo fmessagebox.lo ffiledialog.lo \
|
fdialog.lo fwindow.lo fmessagebox.lo ftooltip.lo \
|
||||||
ftextview.lo fstatusbar.lo fterm.lo fevent.lo foptiattr.lo \
|
ffiledialog.lo ftextview.lo fstatusbar.lo fterm.lo fevent.lo \
|
||||||
foptimove.lo fapp.lo fwidget.lo fobject.lo
|
foptiattr.lo foptimove.lo fapp.lo fwidget.lo fobject.lo
|
||||||
libfinal_la_OBJECTS = $(am_libfinal_la_OBJECTS)
|
libfinal_la_OBJECTS = $(am_libfinal_la_OBJECTS)
|
||||||
AM_V_lt = $(am__v_lt_@AM_V@)
|
AM_V_lt = $(am__v_lt_@AM_V@)
|
||||||
am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
|
am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
|
||||||
|
@ -397,6 +397,7 @@ libfinal_la_SOURCES = \
|
||||||
fdialog.cpp \
|
fdialog.cpp \
|
||||||
fwindow.cpp \
|
fwindow.cpp \
|
||||||
fmessagebox.cpp \
|
fmessagebox.cpp \
|
||||||
|
ftooltip.cpp \
|
||||||
ffiledialog.cpp \
|
ffiledialog.cpp \
|
||||||
ftextview.cpp \
|
ftextview.cpp \
|
||||||
fstatusbar.cpp \
|
fstatusbar.cpp \
|
||||||
|
@ -435,6 +436,7 @@ finalcutinclude_HEADERS = \
|
||||||
fcheckmenuitem.h \
|
fcheckmenuitem.h \
|
||||||
fmenulist.h \
|
fmenulist.h \
|
||||||
fmessagebox.h \
|
fmessagebox.h \
|
||||||
|
ftooltip.h \
|
||||||
fobject.h \
|
fobject.h \
|
||||||
fpoint.h \
|
fpoint.h \
|
||||||
foptiattr.h \
|
foptiattr.h \
|
||||||
|
@ -563,6 +565,7 @@ distclean-compile:
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fterm.Plo@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fterm.Plo@am__quote@
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ftextview.Plo@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ftextview.Plo@am__quote@
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ftogglebutton.Plo@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ftogglebutton.Plo@am__quote@
|
||||||
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ftooltip.Plo@am__quote@
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fwidget.Plo@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fwidget.Plo@am__quote@
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fwindow.Plo@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fwindow.Plo@am__quote@
|
||||||
|
|
||||||
|
|
34
src/fapp.cpp
34
src/fapp.cpp
|
@ -19,10 +19,11 @@ FWidget* FApplication::active_window = 0; // the active window
|
||||||
FWidget* FApplication::focus_widget = 0; // has keyboard input focus
|
FWidget* FApplication::focus_widget = 0; // has keyboard input focus
|
||||||
FWidget* FApplication::clicked_widget = 0; // is focused by click
|
FWidget* FApplication::clicked_widget = 0; // is focused by click
|
||||||
FWidget* FApplication::open_menu = 0; // currently open menu
|
FWidget* FApplication::open_menu = 0; // currently open menu
|
||||||
|
FWidget* FApplication::move_size_widget = 0; // move/size by keyboard
|
||||||
FPoint* FApplication::zero_point = 0; // zero point (x=0, y=0)
|
FPoint* FApplication::zero_point = 0; // zero point (x=0, y=0)
|
||||||
int FApplication::quit_code = 0;
|
int FApplication::quit_code = 0;
|
||||||
bool FApplication::quit_now = false;
|
bool FApplication::quit_now = false;
|
||||||
bool FApplication::move_size_mode = false; // move/size by keyboard
|
|
||||||
std::deque<FApplication::eventPair>* FApplication::event_queue = 0;
|
std::deque<FApplication::eventPair>* FApplication::event_queue = 0;
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -250,8 +251,8 @@ void FApplication::processKeyboardEvent()
|
||||||
|
|
||||||
if ( focus_widget )
|
if ( focus_widget )
|
||||||
{
|
{
|
||||||
if ( move_size_mode )
|
if ( move_size_widget )
|
||||||
widget = FWindow::getWindowWidget(focus_widget);
|
widget = move_size_widget;
|
||||||
else
|
else
|
||||||
widget = focus_widget;
|
widget = focus_widget;
|
||||||
}
|
}
|
||||||
|
@ -357,7 +358,7 @@ void FApplication::processKeyboardEvent()
|
||||||
for (; n < fifo_buf_size; n++)
|
for (; n < fifo_buf_size; n++)
|
||||||
fifo_buf[n-len] = '\0';
|
fifo_buf[n-len] = '\0';
|
||||||
|
|
||||||
input_data_pending = bool(fifo_buf[0] != '\0');
|
unprocessedInput() = bool(fifo_buf[0] != '\0');
|
||||||
processMouseEvent();
|
processMouseEvent();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -386,7 +387,7 @@ void FApplication::processKeyboardEvent()
|
||||||
for (; n < fifo_buf_size; n++) // Fill rest with '\0'
|
for (; n < fifo_buf_size; n++) // Fill rest with '\0'
|
||||||
fifo_buf[n-len] = '\0';
|
fifo_buf[n-len] = '\0';
|
||||||
|
|
||||||
input_data_pending = bool(fifo_buf[0] != '\0');
|
unprocessedInput() = bool(fifo_buf[0] != '\0');
|
||||||
processMouseEvent();
|
processMouseEvent();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -415,7 +416,7 @@ void FApplication::processKeyboardEvent()
|
||||||
for (; n < fifo_buf_size; n++) // Fill rest with '\0'
|
for (; n < fifo_buf_size; n++) // Fill rest with '\0'
|
||||||
fifo_buf[n-len] = '\0';
|
fifo_buf[n-len] = '\0';
|
||||||
|
|
||||||
input_data_pending = bool(fifo_buf[0] != '\0');
|
unprocessedInput() = bool(fifo_buf[0] != '\0');
|
||||||
processMouseEvent();
|
processMouseEvent();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -484,7 +485,7 @@ void FApplication::processKeyboardEvent()
|
||||||
{
|
{
|
||||||
FKeyEvent k_press_ev (fc::KeyPress_Event, fc::Fkey_escape);
|
FKeyEvent k_press_ev (fc::KeyPress_Event, fc::Fkey_escape);
|
||||||
sendEvent (widget, &k_press_ev);
|
sendEvent (widget, &k_press_ev);
|
||||||
input_data_pending = false;
|
unprocessedInput() = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -780,7 +781,7 @@ bool FApplication::processDialogSwitchAccelerator()
|
||||||
if ( s > 0 && s >= n )
|
if ( s > 0 && s >= n )
|
||||||
{
|
{
|
||||||
// unset the move/size mode
|
// unset the move/size mode
|
||||||
setMoveSizeMode(false);
|
move_size_widget = 0;
|
||||||
FAccelEvent a_ev (fc::Accelerator_Event, focus_widget);
|
FAccelEvent a_ev (fc::Accelerator_Event, focus_widget);
|
||||||
sendEvent (dialog_list->at(n-1), &a_ev);
|
sendEvent (dialog_list->at(n-1), &a_ev);
|
||||||
return true;
|
return true;
|
||||||
|
@ -811,7 +812,7 @@ bool FApplication::processAccelerator (FWidget*& widget)
|
||||||
if ( iter->key == key )
|
if ( iter->key == key )
|
||||||
{
|
{
|
||||||
// unset the move/size mode
|
// unset the move/size mode
|
||||||
setMoveSizeMode(false);
|
move_size_widget = 0;
|
||||||
FAccelEvent a_ev (fc::Accelerator_Event, focus_widget);
|
FAccelEvent a_ev (fc::Accelerator_Event, focus_widget);
|
||||||
sendEvent (iter->object, &a_ev);
|
sendEvent (iter->object, &a_ev);
|
||||||
accpt = a_ev.isAccepted();
|
accpt = a_ev.isAccepted();
|
||||||
|
@ -1346,9 +1347,9 @@ bool FApplication::processGpmEvent()
|
||||||
mouse->setPoint(gpm_ev.x, gpm_ev.y);
|
mouse->setPoint(gpm_ev.x, gpm_ev.y);
|
||||||
|
|
||||||
if ( gpmEvent(false) == mouse_event )
|
if ( gpmEvent(false) == mouse_event )
|
||||||
input_data_pending = true;
|
unprocessedInput() = true;
|
||||||
else
|
else
|
||||||
input_data_pending = false;
|
unprocessedInput() = false;
|
||||||
|
|
||||||
GPM_DRAWPOINTER(&gpm_ev);
|
GPM_DRAWPOINTER(&gpm_ev);
|
||||||
gpmMouseEvent = false;
|
gpmMouseEvent = false;
|
||||||
|
@ -1419,7 +1420,12 @@ void FApplication::processMouseEvent()
|
||||||
}
|
}
|
||||||
|
|
||||||
// unset the move/size mode
|
// unset the move/size mode
|
||||||
setMoveSizeMode(false);
|
if ( move_size_widget )
|
||||||
|
{
|
||||||
|
FWidget* w = move_size_widget;
|
||||||
|
move_size_widget = 0;
|
||||||
|
w->redraw();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// close the open menu
|
// close the open menu
|
||||||
|
@ -1662,7 +1668,7 @@ int FApplication::processTimerEvent()
|
||||||
|
|
||||||
getCurrentTime (currentTime);
|
getCurrentTime (currentTime);
|
||||||
|
|
||||||
if ( modify_timer )
|
if ( isTimerInUpdating() )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if ( ! timer_list )
|
if ( ! timer_list )
|
||||||
|
@ -1705,7 +1711,7 @@ void FApplication::processTerminalUpdate()
|
||||||
|
|
||||||
if ( terminal_update_pending )
|
if ( terminal_update_pending )
|
||||||
{
|
{
|
||||||
if ( ! input_data_pending )
|
if ( ! unprocessedInput() )
|
||||||
{
|
{
|
||||||
updateTerminal();
|
updateTerminal();
|
||||||
terminal_update_pending = false;
|
terminal_update_pending = false;
|
||||||
|
|
25
src/fapp.h
25
src/fapp.h
|
@ -38,6 +38,7 @@
|
||||||
|
|
||||||
#include "fevent.h"
|
#include "fevent.h"
|
||||||
#include "fwidget.h"
|
#include "fwidget.h"
|
||||||
|
#include "fwindow.h"
|
||||||
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -109,7 +110,7 @@ class FApplication : public FWidget
|
||||||
struct timeval time_keypressed;
|
struct timeval time_keypressed;
|
||||||
struct timeval time_mousepressed;
|
struct timeval time_mousepressed;
|
||||||
FPoint new_mouse_position;
|
FPoint new_mouse_position;
|
||||||
static bool move_size_mode;
|
static FWidget* move_size_widget;
|
||||||
static FWidget* main_widget;
|
static FWidget* main_widget;
|
||||||
static FWidget* active_window;
|
static FWidget* active_window;
|
||||||
static FWidget* focus_widget;
|
static FWidget* focus_widget;
|
||||||
|
@ -147,9 +148,21 @@ class FApplication : public FWidget
|
||||||
void processTerminalUpdate();
|
void processTerminalUpdate();
|
||||||
void processCloseWidget();
|
void processCloseWidget();
|
||||||
bool processNextEvent();
|
bool processNextEvent();
|
||||||
friend class FDialog;
|
|
||||||
friend class FWidget;
|
// Friend functions from FWidget
|
||||||
friend class FWindow;
|
friend FWidget* FWidget::getMainWidget();
|
||||||
|
friend FWidget* FWidget::getFocusWidget() const;
|
||||||
|
friend void FWidget::setFocusWidget (FWidget*);
|
||||||
|
friend FWidget* FWidget::getClickedWidget();
|
||||||
|
friend void FWidget::setClickedWidget (FWidget*);
|
||||||
|
friend FWidget* FWidget::getMoveSizeWidget();
|
||||||
|
friend void FWidget::setMoveSizeWidget (FWidget*);
|
||||||
|
friend FWidget* FWidget::getOpenMenu();
|
||||||
|
friend void FWidget::setOpenMenu (FWidget*);
|
||||||
|
|
||||||
|
// Friend functions from FWindow
|
||||||
|
friend bool FWindow::activateWindow (bool);
|
||||||
|
friend FWindow* FWindow::getActiveWindow();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// Constructor
|
// Constructor
|
||||||
|
@ -162,7 +175,6 @@ class FApplication : public FWidget
|
||||||
char** argv() const;
|
char** argv() const;
|
||||||
FWidget* mainWidget() const;
|
FWidget* mainWidget() const;
|
||||||
FWidget* focusWidget() const;
|
FWidget* focusWidget() const;
|
||||||
bool unprocessedInput() const;
|
|
||||||
static void print_cmd_Options();
|
static void print_cmd_Options();
|
||||||
void setMainWidget (FWidget*);
|
void setMainWidget (FWidget*);
|
||||||
int exec(); // run
|
int exec(); // run
|
||||||
|
@ -201,8 +213,5 @@ inline FWidget* FApplication::mainWidget() const
|
||||||
inline FWidget* FApplication::focusWidget() const
|
inline FWidget* FApplication::focusWidget() const
|
||||||
{ return focus_widget; }
|
{ return focus_widget; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
|
||||||
inline bool FApplication::unprocessedInput() const
|
|
||||||
{ return input_data_pending; }
|
|
||||||
|
|
||||||
#endif // _FAPPLICATION_H
|
#endif // _FAPPLICATION_H
|
||||||
|
|
|
@ -61,7 +61,6 @@ class FButton : public FWidget
|
||||||
void draw();
|
void draw();
|
||||||
void updateButtonColor();
|
void updateButtonColor();
|
||||||
void processClick();
|
void processClick();
|
||||||
friend class FDialog;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
#include "fwidget.h"
|
#include "fwidget.h"
|
||||||
|
|
||||||
|
|
||||||
|
// class forward declaration
|
||||||
class FToggleButton;
|
class FToggleButton;
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
|
@ -26,6 +26,7 @@ FDialog::FDialog(FWidget* parent)
|
||||||
, move_size_item()
|
, move_size_item()
|
||||||
, zoom_item()
|
, zoom_item()
|
||||||
, close_item()
|
, close_item()
|
||||||
|
, tooltip()
|
||||||
{
|
{
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
@ -45,6 +46,7 @@ FDialog::FDialog (const FString& txt, FWidget* parent)
|
||||||
, move_size_item()
|
, move_size_item()
|
||||||
, zoom_item()
|
, zoom_item()
|
||||||
, close_item()
|
, close_item()
|
||||||
|
, tooltip(0)
|
||||||
{
|
{
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
@ -103,6 +105,7 @@ void FDialog::init()
|
||||||
createArea (vwin);
|
createArea (vwin);
|
||||||
addDialog(this);
|
addDialog(this);
|
||||||
addWindow(this);
|
addWindow(this);
|
||||||
|
alwaysOnTop();
|
||||||
setActiveWindow(this);
|
setActiveWindow(this);
|
||||||
setTransparentShadow();
|
setTransparentShadow();
|
||||||
|
|
||||||
|
@ -173,7 +176,7 @@ void FDialog::drawBorder()
|
||||||
int y1 = 2;
|
int y1 = 2;
|
||||||
int y2 = 1 + getHeight() - 1;
|
int y2 = 1 + getHeight() - 1;
|
||||||
|
|
||||||
if ( (getMoveSizeMode() || ! resize_click_pos.isNull()) && ! isZoomed() )
|
if ( (getMoveSizeWidget() || ! resize_click_pos.isNull()) && ! isZoomed() )
|
||||||
setColor (wc.dialog_resize_fg, getBackgroundColor());
|
setColor (wc.dialog_resize_fg, getBackgroundColor());
|
||||||
else
|
else
|
||||||
setColor();
|
setColor();
|
||||||
|
@ -203,29 +206,7 @@ void FDialog::drawBorder()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
printPos (x1, y1);
|
FWidget::drawBorder(x1, y1, x2, y2);
|
||||||
print (fc::BoxDrawingsDownAndRight); // ┌
|
|
||||||
|
|
||||||
for (int x=x1+1; x < x2; x++)
|
|
||||||
print (fc::BoxDrawingsHorizontal); // ─
|
|
||||||
|
|
||||||
print (fc::BoxDrawingsDownAndLeft); // ┐
|
|
||||||
printPos (x1, y2);
|
|
||||||
print (fc::BoxDrawingsUpAndRight); // └
|
|
||||||
|
|
||||||
for (int x=x1+1; x < x2; x++)
|
|
||||||
print (fc::BoxDrawingsHorizontal); // ─
|
|
||||||
|
|
||||||
print (fc::BoxDrawingsUpAndLeft); // ┘
|
|
||||||
|
|
||||||
for (int y=y1+1; y < y2; y++)
|
|
||||||
{
|
|
||||||
printPos (x1, y);
|
|
||||||
print (fc::BoxDrawingsVertical); // │
|
|
||||||
printPos (x2, y);
|
|
||||||
print (fc::BoxDrawingsVertical); // │
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -478,25 +459,33 @@ void FDialog::setZoomItem()
|
||||||
move_size_item->setEnable();
|
move_size_item->setEnable();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#include "fmessagebox.h"
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FDialog::cb_move (FWidget*, void*)
|
void FDialog::cb_move (FWidget*, void*)
|
||||||
{
|
{
|
||||||
if ( isZoomed() )
|
if ( isZoomed() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
setMoveSizeMode(true);
|
setMoveSizeWidget(this);
|
||||||
save_geometry = getGeometry();
|
save_geometry = getGeometry();
|
||||||
|
|
||||||
redraw();
|
redraw();
|
||||||
|
tooltip = new FToolTip(this);
|
||||||
|
|
||||||
// Tooltip
|
if ( isResizeable() )
|
||||||
// ┌──────────────────────────┐
|
{
|
||||||
// │ Arrow keys: Move │
|
tooltip->setText ( " Arrow keys: Move\n"
|
||||||
// │Meta + Arrow keys: Resize │
|
"Meta + Arrow keys: Resize\n"
|
||||||
// │ Enter: Done │
|
" Enter: Done\n"
|
||||||
// │ Esc: Cancel │
|
" Esc: Cancel" );
|
||||||
// └──────────────────────────┘
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
tooltip->setText ( "Arrow keys: Move\n"
|
||||||
|
" Enter: Done\n"
|
||||||
|
" Esc: Cancel" );
|
||||||
|
}
|
||||||
|
|
||||||
|
tooltip->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -575,6 +564,14 @@ void FDialog::drawDialogShadow()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FDialog::draw()
|
void FDialog::draw()
|
||||||
{
|
{
|
||||||
|
if ( tooltip && ! getMoveSizeWidget() )
|
||||||
|
{
|
||||||
|
if ( tooltip )
|
||||||
|
delete tooltip;
|
||||||
|
|
||||||
|
tooltip = 0;
|
||||||
|
}
|
||||||
|
|
||||||
updateVTerm(false);
|
updateVTerm(false);
|
||||||
// fill the background
|
// fill the background
|
||||||
setColor();
|
setColor();
|
||||||
|
@ -634,7 +631,7 @@ void FDialog::onKeyPress (FKeyEvent* ev)
|
||||||
selectFirstMenuItem();
|
selectFirstMenuItem();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( getMoveSizeMode() )
|
if ( getMoveSizeWidget() )
|
||||||
{
|
{
|
||||||
switch ( ev->key() )
|
switch ( ev->key() )
|
||||||
{
|
{
|
||||||
|
@ -696,14 +693,24 @@ void FDialog::onKeyPress (FKeyEvent* ev)
|
||||||
|
|
||||||
case fc::Fkey_return:
|
case fc::Fkey_return:
|
||||||
case fc::Fkey_enter:
|
case fc::Fkey_enter:
|
||||||
setMoveSizeMode(false);
|
setMoveSizeWidget(0);
|
||||||
|
|
||||||
|
if ( tooltip )
|
||||||
|
delete tooltip;
|
||||||
|
|
||||||
|
tooltip = 0;
|
||||||
redraw();
|
redraw();
|
||||||
ev->accept();
|
ev->accept();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case fc::Fkey_escape:
|
case fc::Fkey_escape:
|
||||||
case fc::Fkey_escape_mintty:
|
case fc::Fkey_escape_mintty:
|
||||||
setMoveSizeMode(false);
|
setMoveSizeWidget(0);
|
||||||
|
|
||||||
|
if ( tooltip )
|
||||||
|
delete tooltip;
|
||||||
|
|
||||||
|
tooltip = 0;
|
||||||
move (save_geometry.getPos());
|
move (save_geometry.getPos());
|
||||||
|
|
||||||
if ( isResizeable() )
|
if ( isResizeable() )
|
||||||
|
@ -1141,13 +1148,25 @@ void FDialog::onWindowInactive (FEvent*)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FDialog::onWindowRaised (FEvent*)
|
void FDialog::onWindowRaised (FEvent*)
|
||||||
{
|
{
|
||||||
widgetList::const_iterator iter, end;
|
|
||||||
|
|
||||||
if ( ! (isVisible() && isShown()) )
|
if ( ! (isVisible() && isShown()) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
putArea (getTermPos(), vwin);
|
putArea (getTermPos(), vwin);
|
||||||
|
|
||||||
|
// handle always-on-top windows
|
||||||
|
if ( always_on_top_list && ! always_on_top_list->empty() )
|
||||||
|
{
|
||||||
|
widgetList::const_iterator iter, end;
|
||||||
|
iter = always_on_top_list->begin();
|
||||||
|
end = always_on_top_list->end();
|
||||||
|
|
||||||
|
while ( iter != end )
|
||||||
|
{
|
||||||
|
putArea ((*iter)->getTermPos(), (*iter)->getVWin());
|
||||||
|
++iter;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ( ! window_list )
|
if ( ! window_list )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
|
|
||||||
#include "fmenu.h"
|
#include "fmenu.h"
|
||||||
#include "fmenuitem.h"
|
#include "fmenuitem.h"
|
||||||
|
#include "ftooltip.h"
|
||||||
#include "fwindow.h"
|
#include "fwindow.h"
|
||||||
|
|
||||||
|
|
||||||
|
@ -62,6 +63,7 @@ class FDialog : public FWindow
|
||||||
FMenuItem* move_size_item;
|
FMenuItem* move_size_item;
|
||||||
FMenuItem* zoom_item;
|
FMenuItem* zoom_item;
|
||||||
FMenuItem* close_item;
|
FMenuItem* close_item;
|
||||||
|
FToolTip* tooltip;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Disable copy constructor
|
// Disable copy constructor
|
||||||
|
@ -154,7 +156,8 @@ class FDialog : public FWindow
|
||||||
void setText (const FString&);
|
void setText (const FString&);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend class FMenu;
|
// Friend function from FMenu
|
||||||
|
friend void FMenu::hideSuperMenus();
|
||||||
};
|
};
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
|
|
||||||
|
|
|
@ -61,8 +61,9 @@ class fc
|
||||||
window_widget = 0x00000080,
|
window_widget = 0x00000080,
|
||||||
dialog_widget = 0x00000100,
|
dialog_widget = 0x00000100,
|
||||||
menu_widget = 0x00000200,
|
menu_widget = 0x00000200,
|
||||||
flat = 0x00000400,
|
always_on_top = 0x00000400,
|
||||||
no_underline = 0x00000800
|
flat = 0x00000800,
|
||||||
|
no_underline = 0x00001000
|
||||||
};
|
};
|
||||||
|
|
||||||
// internal character encoding
|
// internal character encoding
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// File: ffiledialog.h
|
// File: ffiledialog.h
|
||||||
// Provides: class FFileDialog.h
|
// Provides: class FFileDialog
|
||||||
//
|
//
|
||||||
// Inheritance diagram
|
// Inheritance diagram
|
||||||
// ═══════════════════
|
// ═══════════════════
|
||||||
|
|
47
src/final.h
47
src/final.h
|
@ -4,31 +4,32 @@
|
||||||
#define _FINAL_H
|
#define _FINAL_H
|
||||||
|
|
||||||
#include "fapp.h"
|
#include "fapp.h"
|
||||||
#include "fterm.h"
|
|
||||||
#include "fwidget.h"
|
|
||||||
#include "fpoint.h"
|
|
||||||
#include "frect.h"
|
|
||||||
#include "fstring.h"
|
|
||||||
#include "fdialog.h"
|
|
||||||
#include "flabel.h"
|
|
||||||
#include "fbutton.h"
|
|
||||||
#include "fradiobutton.h"
|
|
||||||
#include "fcheckbox.h"
|
|
||||||
#include "fswitch.h"
|
|
||||||
#include "fbuttongroup.h"
|
#include "fbuttongroup.h"
|
||||||
#include "flistbox.h"
|
#include "fbutton.h"
|
||||||
#include "ftextview.h"
|
#include "fcheckbox.h"
|
||||||
#include "flineedit.h"
|
|
||||||
#include "fmenu.h"
|
|
||||||
#include "fdialoglistmenu.h"
|
|
||||||
#include "fmenubar.h"
|
|
||||||
#include "fmenuitem.h"
|
|
||||||
#include "fcheckmenuitem.h"
|
#include "fcheckmenuitem.h"
|
||||||
#include "fradiomenuitem.h"
|
#include "fdialog.h"
|
||||||
#include "fstatusbar.h"
|
#include "fdialoglistmenu.h"
|
||||||
#include "fscrollbar.h"
|
|
||||||
#include "fprogressbar.h"
|
|
||||||
#include "fmessagebox.h"
|
|
||||||
#include "ffiledialog.h"
|
#include "ffiledialog.h"
|
||||||
|
#include "flabel.h"
|
||||||
|
#include "flineedit.h"
|
||||||
|
#include "flistbox.h"
|
||||||
|
#include "fmenubar.h"
|
||||||
|
#include "fmenu.h"
|
||||||
|
#include "fmenuitem.h"
|
||||||
|
#include "fmessagebox.h"
|
||||||
|
#include "fpoint.h"
|
||||||
|
#include "fprogressbar.h"
|
||||||
|
#include "fradiobutton.h"
|
||||||
|
#include "fradiomenuitem.h"
|
||||||
|
#include "frect.h"
|
||||||
|
#include "fscrollbar.h"
|
||||||
|
#include "fstatusbar.h"
|
||||||
|
#include "fstring.h"
|
||||||
|
#include "fswitch.h"
|
||||||
|
#include "fterm.h"
|
||||||
|
#include "ftextview.h"
|
||||||
|
#include "ftooltip.h"
|
||||||
|
#include "fwidget.h"
|
||||||
|
|
||||||
#endif // _FINAL_H
|
#endif // _FINAL_H
|
||||||
|
|
|
@ -107,8 +107,8 @@ void FMenu::init(FWidget* parent)
|
||||||
setMenuWidget();
|
setMenuWidget();
|
||||||
setGeometry (1, 1, 10, 2, false); // initialize geometry values
|
setGeometry (1, 1, 10, 2, false); // initialize geometry values
|
||||||
setTransparentShadow();
|
setTransparentShadow();
|
||||||
setMenuWidget();
|
|
||||||
addWindow(this);
|
addWindow(this);
|
||||||
|
alwaysOnTop();
|
||||||
hide();
|
hide();
|
||||||
|
|
||||||
setForegroundColor (wc.menu_active_fg);
|
setForegroundColor (wc.menu_active_fg);
|
||||||
|
@ -595,38 +595,24 @@ void FMenu::draw()
|
||||||
clearArea();
|
clearArea();
|
||||||
drawBorder();
|
drawBorder();
|
||||||
drawItems();
|
drawItems();
|
||||||
|
drawMenuShadow();
|
||||||
|
|
||||||
if ( isMonochron() )
|
if ( isMonochron() )
|
||||||
setReverse(false);
|
setReverse(false);
|
||||||
|
|
||||||
if ( (flags & fc::shadow) != 0 )
|
|
||||||
{
|
|
||||||
term_area* area = 0;
|
|
||||||
FWindow* area_widget = getWindowWidget(this);
|
|
||||||
drawMenuShadow();
|
|
||||||
|
|
||||||
if ( area_widget )
|
|
||||||
{
|
|
||||||
area = area_widget->getVWin();
|
|
||||||
|
|
||||||
if ( area )
|
|
||||||
putArea (getTermX(), getTermY(), area);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
updateVTerm(true);
|
updateVTerm(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FMenu::drawBorder()
|
void FMenu::drawBorder()
|
||||||
|
{
|
||||||
|
if ( isNewFont() )
|
||||||
{
|
{
|
||||||
int x1 = 1;
|
int x1 = 1;
|
||||||
int x2 = 1 + getWidth() - 1;
|
int x2 = 1 + getWidth() - 1;
|
||||||
int y1 = 1;
|
int y1 = 1;
|
||||||
int y2 = 1 + getHeight() - 1;
|
int y2 = 1 + getHeight() - 1;
|
||||||
|
|
||||||
if ( isNewFont() )
|
|
||||||
{
|
|
||||||
printPos (x1, y1);
|
printPos (x1, y1);
|
||||||
print (fc::NF_border_corner_upper_left); // ⎡
|
print (fc::NF_border_corner_upper_left); // ⎡
|
||||||
|
|
||||||
|
@ -658,28 +644,7 @@ void FMenu::drawBorder()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
printPos (x1, y1);
|
FWidget::drawBorder();
|
||||||
print (fc::BoxDrawingsDownAndRight); // ┌
|
|
||||||
|
|
||||||
for (int x=x1+1; x < x2; x++)
|
|
||||||
print (fc::BoxDrawingsHorizontal); // ─
|
|
||||||
|
|
||||||
print (fc::BoxDrawingsDownAndLeft); // ┐
|
|
||||||
printPos (x1, y2);
|
|
||||||
print (fc::BoxDrawingsUpAndRight); // └
|
|
||||||
|
|
||||||
for (int x=x1+1; x < x2; x++)
|
|
||||||
print (fc::BoxDrawingsHorizontal); // ─
|
|
||||||
|
|
||||||
print (fc::BoxDrawingsUpAndLeft); // ┘
|
|
||||||
|
|
||||||
for (int y=y1+1; y < y2; y++)
|
|
||||||
{
|
|
||||||
printPos (x1, y);
|
|
||||||
print (fc::BoxDrawingsVertical); // │
|
|
||||||
printPos (x2, y);
|
|
||||||
print (fc::BoxDrawingsVertical); // │
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,6 @@
|
||||||
#include "fmenulist.h"
|
#include "fmenulist.h"
|
||||||
#include "fmenuitem.h"
|
#include "fmenuitem.h"
|
||||||
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
// class FMenu
|
// class FMenu
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
|
|
||||||
#include "fwidget.h"
|
#include "fwidget.h"
|
||||||
|
|
||||||
|
// class forward declaration
|
||||||
class FDialog;
|
class FDialog;
|
||||||
class FMenu;
|
class FMenu;
|
||||||
class FMenuList;
|
class FMenuList;
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
#include "fobject.h"
|
#include "fobject.h"
|
||||||
|
|
||||||
// static class attributes
|
// static class attributes
|
||||||
bool FObject::modify_timer;
|
bool FObject::timer_modify_lock;
|
||||||
FObject::TimerList* FObject::timer_list = 0;
|
FObject::TimerList* FObject::timer_list = 0;
|
||||||
|
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ FObject::FObject (FObject* parent)
|
||||||
|
|
||||||
if ( parent == 0 )
|
if ( parent == 0 )
|
||||||
{
|
{
|
||||||
modify_timer = false;
|
timer_modify_lock = false;
|
||||||
timer_list = new TimerList();
|
timer_list = new TimerList();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -141,7 +141,7 @@ int FObject::addTimer (int interval)
|
||||||
timeval currentTime;
|
timeval currentTime;
|
||||||
int id = 1;
|
int id = 1;
|
||||||
|
|
||||||
modify_timer = true;
|
timer_modify_lock = true;
|
||||||
|
|
||||||
if ( ! timer_list )
|
if ( ! timer_list )
|
||||||
timer_list = new TimerList();
|
timer_list = new TimerList();
|
||||||
|
@ -182,7 +182,7 @@ int FObject::addTimer (int interval)
|
||||||
++iter;
|
++iter;
|
||||||
|
|
||||||
timer_list->insert (iter, t);
|
timer_list->insert (iter, t);
|
||||||
modify_timer = false;
|
timer_modify_lock = false;
|
||||||
|
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
@ -195,7 +195,7 @@ bool FObject::delTimer (int id)
|
||||||
if ( id <= 0 || id > int(timer_list->size()) )
|
if ( id <= 0 || id > int(timer_list->size()) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
modify_timer = true;
|
timer_modify_lock = true;
|
||||||
iter = timer_list->begin();
|
iter = timer_list->begin();
|
||||||
end = timer_list->end();
|
end = timer_list->end();
|
||||||
|
|
||||||
|
@ -205,11 +205,11 @@ bool FObject::delTimer (int id)
|
||||||
if ( iter != end )
|
if ( iter != end )
|
||||||
{
|
{
|
||||||
timer_list->erase(iter);
|
timer_list->erase(iter);
|
||||||
modify_timer = false;
|
timer_modify_lock = false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
modify_timer = false;
|
timer_modify_lock = false;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -224,7 +224,7 @@ bool FObject::delOwnTimer()
|
||||||
if ( timer_list->empty() )
|
if ( timer_list->empty() )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
modify_timer = true;
|
timer_modify_lock = true;
|
||||||
iter = timer_list->begin();
|
iter = timer_list->begin();
|
||||||
|
|
||||||
while ( iter != timer_list->end() )
|
while ( iter != timer_list->end() )
|
||||||
|
@ -235,7 +235,7 @@ bool FObject::delOwnTimer()
|
||||||
++iter;
|
++iter;
|
||||||
}
|
}
|
||||||
|
|
||||||
modify_timer = false;
|
timer_modify_lock = false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -248,9 +248,9 @@ bool FObject::delAllTimer()
|
||||||
if ( timer_list->empty() )
|
if ( timer_list->empty() )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
modify_timer = true;
|
timer_modify_lock = true;
|
||||||
timer_list->clear();
|
timer_list->clear();
|
||||||
modify_timer = false;
|
timer_modify_lock = false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -65,8 +65,7 @@ class FObject
|
||||||
FObject* parent_obj;
|
FObject* parent_obj;
|
||||||
object_list children_list;
|
object_list children_list;
|
||||||
bool has_parent;
|
bool has_parent;
|
||||||
static bool modify_timer;
|
static bool timer_modify_lock;
|
||||||
friend class FApplication;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// Constructor
|
// Constructor
|
||||||
|
@ -90,6 +89,7 @@ class FObject
|
||||||
bool delTimer (int);
|
bool delTimer (int);
|
||||||
bool delOwnTimer();
|
bool delOwnTimer();
|
||||||
bool delAllTimer();
|
bool delAllTimer();
|
||||||
|
bool isTimerInUpdating() const;
|
||||||
// Event handler
|
// Event handler
|
||||||
virtual bool event (FEvent*);
|
virtual bool event (FEvent*);
|
||||||
|
|
||||||
|
@ -134,6 +134,10 @@ inline bool FObject::hasChildren() const
|
||||||
inline int FObject::numOfChildren() const
|
inline int FObject::numOfChildren() const
|
||||||
{ return int(children_list.size()); }
|
{ return int(children_list.size()); }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline bool FObject::isTimerInUpdating() const
|
||||||
|
{ return timer_modify_lock; }
|
||||||
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
// Operator functions for timeval
|
// Operator functions for timeval
|
||||||
|
|
|
@ -34,6 +34,7 @@
|
||||||
#include "fwindow.h"
|
#include "fwindow.h"
|
||||||
|
|
||||||
|
|
||||||
|
// class forward declaration
|
||||||
class FStatusBar;
|
class FStatusBar;
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
|
@ -88,6 +88,7 @@
|
||||||
// parseKeyString return value
|
// parseKeyString return value
|
||||||
#define NEED_MORE_DATA -1
|
#define NEED_MORE_DATA -1
|
||||||
|
|
||||||
|
// class forward declaration
|
||||||
class FWidget;
|
class FWidget;
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -283,6 +284,7 @@ class FTerm
|
||||||
static uInt charEncode (uInt, fc::encoding);
|
static uInt charEncode (uInt, fc::encoding);
|
||||||
static uInt cp437_to_unicode (uChar);
|
static uInt cp437_to_unicode (uChar);
|
||||||
static void signal_handler (int);
|
static void signal_handler (int);
|
||||||
|
// Friend classes
|
||||||
friend class FWidget;
|
friend class FWidget;
|
||||||
friend class FApplication;
|
friend class FApplication;
|
||||||
|
|
||||||
|
@ -320,6 +322,7 @@ class FTerm
|
||||||
FTerm::term_area* getVWin() const;
|
FTerm::term_area* getVWin() const;
|
||||||
static bool isKeyTimeout (timeval*, register long);
|
static bool isKeyTimeout (timeval*, register long);
|
||||||
static int parseKeyString (char*, int, timeval*);
|
static int parseKeyString (char*, int, timeval*);
|
||||||
|
bool& unprocessedInput() const;
|
||||||
int getLineNumber();
|
int getLineNumber();
|
||||||
int getColumnNumber();
|
int getColumnNumber();
|
||||||
static FString getKeyName (int);
|
static FString getKeyName (int);
|
||||||
|
@ -509,6 +512,10 @@ inline const char* FTerm::getClassName() const
|
||||||
inline FTerm::term_area* FTerm::getVWin() const
|
inline FTerm::term_area* FTerm::getVWin() const
|
||||||
{ return vwin; }
|
{ return vwin; }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline bool& FTerm::unprocessedInput() const
|
||||||
|
{ return input_data_pending; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline int FTerm::getLineNumber()
|
inline int FTerm::getLineNumber()
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// File: ftogglebutton.h
|
// File: ftogglebutton.h
|
||||||
// Provides: class FToggleButton.h
|
// Provides: class FToggleButton
|
||||||
//
|
//
|
||||||
// Inheritance diagram
|
// Inheritance diagram
|
||||||
// ═══════════════════
|
// ═══════════════════
|
||||||
|
@ -26,6 +26,7 @@
|
||||||
#include "fwidget.h"
|
#include "fwidget.h"
|
||||||
|
|
||||||
|
|
||||||
|
// class forward declaration
|
||||||
class FButtonGroup;
|
class FButtonGroup;
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
|
@ -0,0 +1,194 @@
|
||||||
|
// File: ftooltip.cpp
|
||||||
|
// Provides: class FToolTip
|
||||||
|
|
||||||
|
#include "fapp.h"
|
||||||
|
#include "ftooltip.h"
|
||||||
|
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
// class FToolTip
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
|
||||||
|
// constructor and destructor
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
FToolTip::FToolTip (FWidget* parent)
|
||||||
|
: FWindow(parent)
|
||||||
|
, text()
|
||||||
|
, max_line_width(0)
|
||||||
|
{
|
||||||
|
init();
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
FToolTip::FToolTip (const FString& txt, FWidget* parent)
|
||||||
|
: FWindow(parent)
|
||||||
|
, text(txt)
|
||||||
|
, max_line_width(0)
|
||||||
|
{
|
||||||
|
init();
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
FToolTip::~FToolTip() // destructor
|
||||||
|
{
|
||||||
|
FApplication* fapp = static_cast<FApplication*>(getRootWidget());
|
||||||
|
|
||||||
|
if ( ! fapp->isQuit() )
|
||||||
|
{
|
||||||
|
FWidget* parent = getParentWidget();
|
||||||
|
FWindow* parent_win = 0;
|
||||||
|
|
||||||
|
if ( parent )
|
||||||
|
parent_win = getWindowWidget(parent);
|
||||||
|
|
||||||
|
if ( parent_win )
|
||||||
|
setActiveWindow (parent_win);
|
||||||
|
else
|
||||||
|
switchToPrevWindow();
|
||||||
|
}
|
||||||
|
|
||||||
|
delWindow(this);
|
||||||
|
|
||||||
|
if ( ! fapp->isQuit() )
|
||||||
|
{
|
||||||
|
const FRect& t_geometry = getTermGeometryWithShadow();
|
||||||
|
restoreVTerm (t_geometry);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( vwin != 0 )
|
||||||
|
{
|
||||||
|
if ( vwin->changes != 0 )
|
||||||
|
delete[] vwin->changes;
|
||||||
|
|
||||||
|
if ( vwin->text != 0 )
|
||||||
|
delete[] vwin->text;
|
||||||
|
|
||||||
|
delete vwin;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// private methods of FToolTip
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
void FToolTip::init()
|
||||||
|
{
|
||||||
|
setAlwaysOnTop();
|
||||||
|
ignorePadding();
|
||||||
|
// initialize geometry values
|
||||||
|
setGeometry (1, 1, 3, 3, false);
|
||||||
|
setMinimumSize (3, 3);
|
||||||
|
createArea (vwin);
|
||||||
|
addWindow(this);
|
||||||
|
alwaysOnTop();
|
||||||
|
|
||||||
|
setForegroundColor (wc.tooltip_fg);
|
||||||
|
setBackgroundColor (wc.tooltip_bg);
|
||||||
|
|
||||||
|
calculateDimensions();
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
void FToolTip::calculateDimensions()
|
||||||
|
{
|
||||||
|
int x, y, w, h;
|
||||||
|
FWidget* r = getRootWidget();
|
||||||
|
text_split = text.split("\n");
|
||||||
|
text_num_lines = uInt(text_split.size());
|
||||||
|
text_components = &text_split[0];
|
||||||
|
max_line_width = 0;
|
||||||
|
|
||||||
|
for (uInt i=0; i < text_num_lines; i++)
|
||||||
|
{
|
||||||
|
uInt len = text_components[i].getLength();
|
||||||
|
|
||||||
|
if ( len > max_line_width )
|
||||||
|
max_line_width = len;
|
||||||
|
}
|
||||||
|
|
||||||
|
h = int(text_num_lines) + 2 ;
|
||||||
|
w = int(max_line_width + 4);
|
||||||
|
|
||||||
|
if ( r )
|
||||||
|
{
|
||||||
|
x = 1 + int((r->getWidth()-w)/2);
|
||||||
|
y = 1 + int((r->getHeight()-h)/2);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
x = y = 1;
|
||||||
|
|
||||||
|
setGeometry (x, y, w, h);
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
void FToolTip::adjustSize()
|
||||||
|
{
|
||||||
|
calculateDimensions();
|
||||||
|
FWindow::adjustSize();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// public methods of FToolTip
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
void FToolTip::draw()
|
||||||
|
{
|
||||||
|
updateVTerm(false);
|
||||||
|
setColor();
|
||||||
|
|
||||||
|
if ( getMaxColor() < 16 )
|
||||||
|
setBold();
|
||||||
|
|
||||||
|
clearArea();
|
||||||
|
drawBorder();
|
||||||
|
|
||||||
|
for (int i=0; i < int(text_num_lines); i++)
|
||||||
|
{
|
||||||
|
printPos (3, 2 + i);
|
||||||
|
print(text_components[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
unsetBold();
|
||||||
|
updateVTerm(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
void FToolTip::show()
|
||||||
|
{
|
||||||
|
if ( ! isVisible() )
|
||||||
|
return;
|
||||||
|
|
||||||
|
FWindow::show();
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
void FToolTip::hide()
|
||||||
|
{
|
||||||
|
FWindow::hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
void FToolTip::onMouseDown (FMouseEvent*)
|
||||||
|
{
|
||||||
|
setClickedWidget(0);
|
||||||
|
close();
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
void FToolTip::setText (const FString& txt)
|
||||||
|
{
|
||||||
|
text = txt;
|
||||||
|
calculateDimensions();
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
void FToolTip::setText (const std::string& txt)
|
||||||
|
{
|
||||||
|
FString message_text(txt);
|
||||||
|
setText( message_text );
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
void FToolTip::setText (const char* txt)
|
||||||
|
{
|
||||||
|
FString message_text(txt);
|
||||||
|
setText( message_text );
|
||||||
|
}
|
|
@ -0,0 +1,87 @@
|
||||||
|
// File: ftooltip.h
|
||||||
|
// Provides: class FTooltip
|
||||||
|
//
|
||||||
|
// Inheritance diagram
|
||||||
|
// ═══════════════════
|
||||||
|
//
|
||||||
|
// ▕▔▔▔▔▔▔▔▔▔▏ ▕▔▔▔▔▔▔▔▔▔▏
|
||||||
|
// ▕ FObject ▏ ▕ FTerm ▏
|
||||||
|
// ▕▁▁▁▁▁▁▁▁▁▏ ▕▁▁▁▁▁▁▁▁▁▏
|
||||||
|
// ▲ ▲
|
||||||
|
// │ │
|
||||||
|
// └─────┬─────┘
|
||||||
|
// │
|
||||||
|
// ▕▔▔▔▔▔▔▔▔▔▏
|
||||||
|
// ▕ FWidget ▏
|
||||||
|
// ▕▁▁▁▁▁▁▁▁▁▏
|
||||||
|
// ▲
|
||||||
|
// │
|
||||||
|
// ▕▔▔▔▔▔▔▔▔▔▏
|
||||||
|
// ▕ FWindow ▏
|
||||||
|
// ▕▁▁▁▁▁▁▁▁▁▏
|
||||||
|
// ▲
|
||||||
|
// │
|
||||||
|
// ▕▔▔▔▔▔▔▔▔▔▔▏
|
||||||
|
// ▕ FToolTip ▏
|
||||||
|
// ▕▁▁▁▁▁▁▁▁▁▁▏
|
||||||
|
|
||||||
|
#ifndef _FTOOLTIP_H
|
||||||
|
#define _FTOOLTIP_H
|
||||||
|
|
||||||
|
#include "fwindow.h"
|
||||||
|
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
// class FToolTip
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
|
||||||
|
#pragma pack(push)
|
||||||
|
#pragma pack(1)
|
||||||
|
|
||||||
|
class FToolTip : public FWindow
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
FString text;
|
||||||
|
FString* text_components;
|
||||||
|
std::vector<FString> text_split;
|
||||||
|
uInt max_line_width;
|
||||||
|
uInt text_num_lines;
|
||||||
|
|
||||||
|
private:
|
||||||
|
// Disable copy constructor
|
||||||
|
FToolTip (const FToolTip&);
|
||||||
|
// Disable assignment operator (=)
|
||||||
|
FToolTip& operator = (const FToolTip&);
|
||||||
|
|
||||||
|
void init();
|
||||||
|
void calculateDimensions();
|
||||||
|
virtual void adjustSize();
|
||||||
|
|
||||||
|
public:
|
||||||
|
// Constructor
|
||||||
|
explicit FToolTip (FWidget* = 0);
|
||||||
|
FToolTip (const FString&, FWidget* = 0);
|
||||||
|
// Destructor
|
||||||
|
virtual ~FToolTip ();
|
||||||
|
|
||||||
|
const char* getClassName() const;
|
||||||
|
virtual void draw();
|
||||||
|
void show();
|
||||||
|
void hide();
|
||||||
|
// Event handler
|
||||||
|
void onMouseDown (FMouseEvent*);
|
||||||
|
const FString getText() const;
|
||||||
|
void setText (const FString&);
|
||||||
|
void setText (const std::string&);
|
||||||
|
void setText (const char*);
|
||||||
|
};
|
||||||
|
#pragma pack(pop)
|
||||||
|
|
||||||
|
|
||||||
|
// FToolTip inline functions
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline const char* FToolTip::getClassName() const
|
||||||
|
{ return "FToolTip"; }
|
||||||
|
|
||||||
|
|
||||||
|
#endif // _FTOOLTIP_H
|
|
@ -19,6 +19,7 @@ FWidget* FWidget::show_root_widget = 0;
|
||||||
FWidget* FWidget::redraw_root_widget = 0;
|
FWidget* FWidget::redraw_root_widget = 0;
|
||||||
FWidget::widgetList* FWidget::window_list = 0;
|
FWidget::widgetList* FWidget::window_list = 0;
|
||||||
FWidget::widgetList* FWidget::dialog_list = 0;
|
FWidget::widgetList* FWidget::dialog_list = 0;
|
||||||
|
FWidget::widgetList* FWidget::always_on_top_list = 0;
|
||||||
FWidget::widgetList* FWidget::close_widget = 0;
|
FWidget::widgetList* FWidget::close_widget = 0;
|
||||||
FWidget::widget_colors FWidget::wc;
|
FWidget::widget_colors FWidget::wc;
|
||||||
|
|
||||||
|
@ -32,7 +33,7 @@ FWidget::FWidget (FWidget* parent)
|
||||||
: FObject(parent)
|
: FObject(parent)
|
||||||
, callback_objects()
|
, callback_objects()
|
||||||
, member_callback_objects()
|
, member_callback_objects()
|
||||||
, accelerator_list()
|
, accelerator_list(0)
|
||||||
, flags(0)
|
, flags(0)
|
||||||
, enable(true)
|
, enable(true)
|
||||||
, visible(true)
|
, visible(true)
|
||||||
|
@ -122,6 +123,7 @@ void FWidget::init()
|
||||||
{
|
{
|
||||||
window_list = new widgetList();
|
window_list = new widgetList();
|
||||||
dialog_list = new widgetList();
|
dialog_list = new widgetList();
|
||||||
|
always_on_top_list = new widgetList();
|
||||||
close_widget = new widgetList();
|
close_widget = new widgetList();
|
||||||
|
|
||||||
// determine width and height of the terminal
|
// determine width and height of the terminal
|
||||||
|
@ -165,6 +167,12 @@ void FWidget::finish()
|
||||||
dialog_list = 0;
|
dialog_list = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( always_on_top_list )
|
||||||
|
{
|
||||||
|
delete always_on_top_list;
|
||||||
|
always_on_top_list = 0;
|
||||||
|
}
|
||||||
|
|
||||||
if ( window_list )
|
if ( window_list )
|
||||||
{
|
{
|
||||||
delete window_list;
|
delete window_list;
|
||||||
|
@ -192,6 +200,8 @@ void FWidget::setColorTheme()
|
||||||
wc.error_box_fg = fc::White;
|
wc.error_box_fg = fc::White;
|
||||||
wc.error_box_emphasis_fg = fc::Yellow;
|
wc.error_box_emphasis_fg = fc::Yellow;
|
||||||
wc.error_box_bg = fc::LightRed;
|
wc.error_box_bg = fc::LightRed;
|
||||||
|
wc.tooltip_fg = fc::Black;
|
||||||
|
wc.tooltip_bg = fc::Yellow;
|
||||||
wc.shadow_fg = fc::Black;
|
wc.shadow_fg = fc::Black;
|
||||||
wc.shadow_bg = fc::LightGray; // only for transparent shadow
|
wc.shadow_bg = fc::LightGray; // only for transparent shadow
|
||||||
wc.current_element_focus_fg = fc::White;
|
wc.current_element_focus_fg = fc::White;
|
||||||
|
@ -283,6 +293,8 @@ void FWidget::setColorTheme()
|
||||||
wc.error_box_fg = fc::Black;
|
wc.error_box_fg = fc::Black;
|
||||||
wc.error_box_emphasis_fg = fc::Red;
|
wc.error_box_emphasis_fg = fc::Red;
|
||||||
wc.error_box_bg = fc::LightGray;
|
wc.error_box_bg = fc::LightGray;
|
||||||
|
wc.tooltip_fg = fc::LightGray;
|
||||||
|
wc.tooltip_bg = fc::Cyan;
|
||||||
wc.shadow_fg = fc::Black;
|
wc.shadow_fg = fc::Black;
|
||||||
wc.shadow_bg = fc::LightGray; // only for transparent shadow
|
wc.shadow_bg = fc::LightGray; // only for transparent shadow
|
||||||
wc.current_element_focus_fg = fc::LightGray;
|
wc.current_element_focus_fg = fc::LightGray;
|
||||||
|
@ -390,7 +402,12 @@ void FWidget::adjustSize()
|
||||||
FWidget* p = getParentWidget();
|
FWidget* p = getParentWidget();
|
||||||
|
|
||||||
if ( isWindowWidget() )
|
if ( isWindowWidget() )
|
||||||
|
{
|
||||||
|
if ( ignore_padding && ! isDialogWidget() )
|
||||||
|
setTermOffset();
|
||||||
|
else
|
||||||
offset = rootObject->client_offset;
|
offset = rootObject->client_offset;
|
||||||
|
}
|
||||||
else if ( ignore_padding && p )
|
else if ( ignore_padding && p )
|
||||||
{
|
{
|
||||||
offset.setCoordinates ( p->getTermX() - 1
|
offset.setCoordinates ( p->getTermX() - 1
|
||||||
|
@ -954,6 +971,18 @@ void FWidget::setClickedWidget(FWidget* obj)
|
||||||
FApplication::clicked_widget = obj;
|
FApplication::clicked_widget = obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
FWidget* FWidget::getMoveSizeWidget()
|
||||||
|
{
|
||||||
|
return FApplication::move_size_widget;
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
void FWidget::setMoveSizeWidget (FWidget* obj)
|
||||||
|
{
|
||||||
|
FApplication::move_size_widget = obj;
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
FWidget* FWidget::getOpenMenu()
|
FWidget* FWidget::getOpenMenu()
|
||||||
{
|
{
|
||||||
|
@ -967,18 +996,6 @@ void FWidget::setOpenMenu(FWidget* obj)
|
||||||
FApplication::open_menu = obj;
|
FApplication::open_menu = obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
|
||||||
bool FWidget::getMoveSizeMode()
|
|
||||||
{
|
|
||||||
return FApplication::move_size_mode;
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
|
||||||
void FWidget::setMoveSizeMode (bool on)
|
|
||||||
{
|
|
||||||
FApplication::move_size_mode = on;
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
int FWidget::numOfFocusableChildren()
|
int FWidget::numOfFocusableChildren()
|
||||||
{
|
{
|
||||||
|
@ -2353,7 +2370,7 @@ std::vector<bool>& FWidget::doubleFlatLine_ref (int side)
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FWidget::drawBorder (int x1, int x2, int y1, int y2)
|
void FWidget::drawBorder (int x1, int y1, int x2, int y2)
|
||||||
{
|
{
|
||||||
if ( x1 > x2 )
|
if ( x1 > x2 )
|
||||||
std::swap (x1, x2);
|
std::swap (x1, x2);
|
||||||
|
@ -2373,11 +2390,6 @@ void FWidget::drawBorder (int x1, int x2, int y1, int y2)
|
||||||
if ( y2 > getHeight() )
|
if ( y2 > getHeight() )
|
||||||
y2 = getHeight();
|
y2 = getHeight();
|
||||||
|
|
||||||
if ( FWidget* p = getParentWidget() )
|
|
||||||
setColor (wc.dialog_fg, p->getBackgroundColor());
|
|
||||||
else
|
|
||||||
setColor (wc.dialog_fg, wc.dialog_bg);
|
|
||||||
|
|
||||||
if ( isNewFont() )
|
if ( isNewFont() )
|
||||||
{
|
{
|
||||||
printPos (x1, y1);
|
printPos (x1, y1);
|
||||||
|
|
|
@ -77,6 +77,7 @@
|
||||||
reinterpret_cast<FWidget*>((i)) \
|
reinterpret_cast<FWidget*>((i)) \
|
||||||
, reinterpret_cast<FWidget::FMemberCallback>((h))
|
, reinterpret_cast<FWidget::FMemberCallback>((h))
|
||||||
|
|
||||||
|
// class forward declaration
|
||||||
class FStatusBar;
|
class FStatusBar;
|
||||||
class FMenuBar;
|
class FMenuBar;
|
||||||
|
|
||||||
|
@ -93,6 +94,7 @@ class FWidget : public FObject, public FTerm
|
||||||
typedef std::vector<FWidget*> widgetList;
|
typedef std::vector<FWidget*> widgetList;
|
||||||
static widgetList* window_list;
|
static widgetList* window_list;
|
||||||
static widgetList* dialog_list;
|
static widgetList* dialog_list;
|
||||||
|
static widgetList* always_on_top_list;
|
||||||
static widgetList* close_widget;
|
static widgetList* close_widget;
|
||||||
|
|
||||||
typedef void (*FCallback)(FWidget*, void*);
|
typedef void (*FCallback)(FWidget*, void*);
|
||||||
|
@ -168,6 +170,8 @@ class FWidget : public FObject, public FTerm
|
||||||
short error_box_fg;
|
short error_box_fg;
|
||||||
short error_box_emphasis_fg;
|
short error_box_emphasis_fg;
|
||||||
short error_box_bg;
|
short error_box_bg;
|
||||||
|
short tooltip_fg;
|
||||||
|
short tooltip_bg;
|
||||||
short shadow_fg;
|
short shadow_fg;
|
||||||
short shadow_bg;
|
short shadow_bg;
|
||||||
short toggle_button_active_focus_fg;
|
short toggle_button_active_focus_fg;
|
||||||
|
@ -366,10 +370,10 @@ class FWidget : public FObject, public FTerm
|
||||||
virtual void setFocusWidget (FWidget*);
|
virtual void setFocusWidget (FWidget*);
|
||||||
static FWidget* getClickedWidget();
|
static FWidget* getClickedWidget();
|
||||||
static void setClickedWidget (FWidget*);
|
static void setClickedWidget (FWidget*);
|
||||||
|
static FWidget* getMoveSizeWidget();
|
||||||
|
static void setMoveSizeWidget (FWidget*);
|
||||||
static FWidget* getOpenMenu();
|
static FWidget* getOpenMenu();
|
||||||
static void setOpenMenu (FWidget*);
|
static void setOpenMenu (FWidget*);
|
||||||
static bool getMoveSizeMode();
|
|
||||||
static void setMoveSizeMode (bool);
|
|
||||||
int numOfFocusableChildren();
|
int numOfFocusableChildren();
|
||||||
FWidget* getParentWidget() const;
|
FWidget* getParentWidget() const;
|
||||||
bool isRootWidget() const;
|
bool isRootWidget() const;
|
||||||
|
@ -1218,7 +1222,7 @@ inline void FWidget::unsetDoubleFlatLine (int side, int pos)
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline void FWidget::drawBorder()
|
inline void FWidget::drawBorder()
|
||||||
{ drawBorder (1, getWidth(), 1, getHeight()); }
|
{ drawBorder (1, 1, getWidth(), getHeight()); }
|
||||||
|
|
||||||
|
|
||||||
// NewFont elements
|
// NewFont elements
|
||||||
|
|
|
@ -30,6 +30,33 @@ FWindow::~FWindow() // destructor
|
||||||
{
|
{
|
||||||
if ( previous_widget == this )
|
if ( previous_widget == this )
|
||||||
previous_widget = 0;
|
previous_widget = 0;
|
||||||
|
|
||||||
|
if ( isAlwaysOnTop() )
|
||||||
|
deleteFromAlwaysOnTopList (this);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// private methods of FWindow
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
void FWindow::deleteFromAlwaysOnTopList (FWidget* obj)
|
||||||
|
{
|
||||||
|
// delete the window object obj from the always-on-top list
|
||||||
|
if ( always_on_top_list && ! always_on_top_list->empty() )
|
||||||
|
{
|
||||||
|
widgetList::iterator iter;
|
||||||
|
iter = always_on_top_list->begin();
|
||||||
|
|
||||||
|
while ( iter != always_on_top_list->end() )
|
||||||
|
{
|
||||||
|
if ( *iter == obj )
|
||||||
|
{
|
||||||
|
always_on_top_list->erase (iter);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
++iter;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -58,6 +85,7 @@ bool FWindow::event (FEvent* ev)
|
||||||
default:
|
default:
|
||||||
return FWidget::event(ev);
|
return FWidget::event(ev);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -339,6 +367,7 @@ bool FWindow::raiseWindow (FWidget* obj)
|
||||||
window_list->push_back (obj);
|
window_list->push_back (obj);
|
||||||
FEvent ev(fc::WindowRaised_Event);
|
FEvent ev(fc::WindowRaised_Event);
|
||||||
FApplication::sendEvent(obj, &ev);
|
FApplication::sendEvent(obj, &ev);
|
||||||
|
alwaysOnTop();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -388,6 +417,24 @@ bool FWindow::lowerWindow (FWidget* obj)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
void FWindow::alwaysOnTop()
|
||||||
|
{
|
||||||
|
// Raise all always-on-top windows
|
||||||
|
if ( always_on_top_list && ! always_on_top_list->empty() )
|
||||||
|
{
|
||||||
|
widgetList::iterator iter;
|
||||||
|
iter = always_on_top_list->begin();
|
||||||
|
|
||||||
|
while ( iter != always_on_top_list->end() )
|
||||||
|
{
|
||||||
|
delWindow (*iter);
|
||||||
|
addWindow (*iter);
|
||||||
|
++iter;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
bool FWindow::zoomWindow()
|
bool FWindow::zoomWindow()
|
||||||
{
|
{
|
||||||
|
@ -582,3 +629,28 @@ bool FWindow::isHiddenWindow() const
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
bool FWindow::setAlwaysOnTop (bool on)
|
||||||
|
{
|
||||||
|
if ( isAlwaysOnTop() == on )
|
||||||
|
return true;
|
||||||
|
|
||||||
|
if ( on )
|
||||||
|
{
|
||||||
|
flags |= fc::always_on_top;
|
||||||
|
|
||||||
|
if ( always_on_top_list )
|
||||||
|
{
|
||||||
|
deleteFromAlwaysOnTopList (this);
|
||||||
|
always_on_top_list->push_back (this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
flags &= ~fc::always_on_top;
|
||||||
|
deleteFromAlwaysOnTopList (this);
|
||||||
|
}
|
||||||
|
|
||||||
|
return on;
|
||||||
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// File: fwindow.h
|
// File: fwindow.h
|
||||||
// Provides: class FWindow.h
|
// Provides: class FWindow
|
||||||
//
|
//
|
||||||
// Inheritance diagram
|
// Inheritance diagram
|
||||||
// ═══════════════════
|
// ═══════════════════
|
||||||
|
@ -58,6 +58,8 @@ class FWindow : public FWidget
|
||||||
// Disable assignment operator (=)
|
// Disable assignment operator (=)
|
||||||
FWindow& operator = (const FWindow&);
|
FWindow& operator = (const FWindow&);
|
||||||
|
|
||||||
|
void deleteFromAlwaysOnTopList (FWidget*);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Event handlers
|
// Event handlers
|
||||||
bool event (FEvent*);
|
bool event (FEvent*);
|
||||||
|
@ -94,6 +96,7 @@ class FWindow : public FWidget
|
||||||
bool raiseWindow ();
|
bool raiseWindow ();
|
||||||
static bool lowerWindow (FWidget*);
|
static bool lowerWindow (FWidget*);
|
||||||
bool lowerWindow ();
|
bool lowerWindow ();
|
||||||
|
static void alwaysOnTop();
|
||||||
bool zoomWindow ();
|
bool zoomWindow ();
|
||||||
bool isZoomed() const;
|
bool isZoomed() const;
|
||||||
bool setWindowWidget (bool);
|
bool setWindowWidget (bool);
|
||||||
|
@ -110,6 +113,10 @@ class FWindow : public FWidget
|
||||||
bool deactivateWindow();
|
bool deactivateWindow();
|
||||||
bool isActiveWindow() const;
|
bool isActiveWindow() const;
|
||||||
bool isHiddenWindow() const;
|
bool isHiddenWindow() const;
|
||||||
|
bool setAlwaysOnTop (bool);
|
||||||
|
bool setAlwaysOnTop();
|
||||||
|
bool unsetAlwaysOnTop();
|
||||||
|
bool isAlwaysOnTop();
|
||||||
};
|
};
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
|
|
||||||
|
@ -155,5 +162,17 @@ inline bool FWindow::deactivateWindow()
|
||||||
inline bool FWindow::isActiveWindow() const
|
inline bool FWindow::isActiveWindow() const
|
||||||
{ return window_active; }
|
{ return window_active; }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline bool FWindow::setAlwaysOnTop()
|
||||||
|
{ return setAlwaysOnTop(true); }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline bool FWindow::unsetAlwaysOnTop()
|
||||||
|
{ return setAlwaysOnTop(false); }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline bool FWindow::isAlwaysOnTop()
|
||||||
|
{ return ((flags & fc::always_on_top) != 0); }
|
||||||
|
|
||||||
|
|
||||||
#endif // _FWINDOW_H
|
#endif // _FWINDOW_H
|
||||||
|
|
Loading…
Reference in New Issue