Move or resize a window with the arrow keys

This commit is contained in:
Markus Gans 2016-09-30 04:55:28 +02:00
parent c43a7f9bad
commit c25ee14fe7
49 changed files with 734 additions and 248 deletions

View File

@ -1,3 +1,6 @@
2016-09-30 Markus Gans <guru.mail@muenster.de>
* Using arrow keys to move or to resize a window
2016-09-28 Markus Gans <guru.mail@muenster.de> 2016-09-28 Markus Gans <guru.mail@muenster.de>
* The size is now dynamically changeable with the mouse * The size is now dynamically changeable with the mouse
in a resizable window. in a resizable window.

View File

@ -22,6 +22,7 @@ FWidget* FApplication::open_menu = 0; // currently open menu
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;
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -248,10 +249,15 @@ void FApplication::processKeyboardEvent()
FWidget* widget = 0; FWidget* widget = 0;
if ( focus_widget ) if ( focus_widget )
widget = static_cast<FWidget*>(focus_widget); {
if ( move_size_mode )
widget = FWindow::getWindowWidget(focus_widget);
else
widget = focus_widget;
}
else else
{ {
widget = static_cast<FWidget*>(main_widget); widget = main_widget;
if ( widget->numOfChildren() >= 1 ) if ( widget->numOfChildren() >= 1 )
widget->focusFirstChild(); widget->focusFirstChild();
@ -436,7 +442,7 @@ void FApplication::processKeyboardEvent()
// windows keyboard accelerator // windows keyboard accelerator
if ( ! accpt ) if ( ! accpt )
{ {
FWidget* window = static_cast<FWidget*>(active_window); FWidget* window = active_window;
if ( window ) if ( window )
accpt = processAccelerator (window); accpt = processAccelerator (window);
@ -773,6 +779,8 @@ bool FApplication::processDialogSwitchAccelerator()
if ( s > 0 && s >= n ) if ( s > 0 && s >= n )
{ {
// unset the move/size mode
setMoveSizeMode(false);
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;
@ -802,6 +810,8 @@ bool FApplication::processAccelerator (FWidget*& widget)
if ( iter->key == key ) if ( iter->key == key )
{ {
// unset the move/size mode
setMoveSizeMode(false);
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();
@ -1407,6 +1417,9 @@ void FApplication::processMouseEvent()
FWidget* child = childWidgetAt (window, *mouse); FWidget* child = childWidgetAt (window, *mouse);
clicked_widget = (child != 0) ? child : window; clicked_widget = (child != 0) ? child : window;
} }
// unset the move/size mode
setMoveSizeMode(false);
} }
// close the open menu // close the open menu

View File

@ -109,6 +109,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* main_widget; static FWidget* main_widget;
static FWidget* active_window; static FWidget* active_window;
static FWidget* focus_widget; static FWidget* focus_widget;
@ -116,8 +117,10 @@ class FApplication : public FWidget
static FWidget* open_menu; static FWidget* open_menu;
private: private:
FApplication (const FApplication&); // Disabled copy constructor // Disable copy constructor
FApplication& operator = (const FApplication&); // and operator '=' FApplication (const FApplication&);
// Disable assignment operator (=)
FApplication& operator = (const FApplication&);
void init(); void init();
void setExitMessage (std::string); void setExitMessage (std::string);
@ -149,8 +152,10 @@ class FApplication : public FWidget
friend class FWindow; friend class FWindow;
public: public:
FApplication (int&, char**& ); // constructor // Constructor
virtual ~FApplication(); // destructor FApplication (int&, char**& );
// Destructor
virtual ~FApplication();
const char* getClassName() const; const char* getClassName() const;
int argc() const; int argc() const;

View File

@ -49,8 +49,11 @@ class FButton : public FWidget
short button_inactive_bg; short button_inactive_bg;
private: private:
// Disable copy constructor
FButton (const FButton&); FButton (const FButton&);
// Disable assignment operator (=)
FButton& operator = (const FButton&); FButton& operator = (const FButton&);
void init(); void init();
uChar getHotkey(); uChar getHotkey();
void setHotkeyAccelerator(); void setHotkeyAccelerator();
@ -61,9 +64,11 @@ class FButton : public FWidget
friend class FDialog; friend class FDialog;
public: public:
explicit FButton (FWidget* = 0); // constructor // Constructors
FButton (const FString&, FWidget* = 0); // constructor explicit FButton (FWidget* = 0);
virtual ~FButton(); // destructor FButton (const FString&, FWidget* = 0);
// Destructor
virtual ~FButton();
const char* getClassName() const; const char* getClassName() const;
void setForegroundColor (short); void setForegroundColor (short);
@ -75,6 +80,7 @@ class FButton : public FWidget
void setInactiveBackgroundColor (short); void setInactiveBackgroundColor (short);
void hide(); void hide();
// Event handlers
void onKeyPress (FKeyEvent*); void onKeyPress (FKeyEvent*);
void onMouseDown (FMouseEvent*); void onMouseDown (FMouseEvent*);
void onMouseUp (FMouseEvent*); void onMouseUp (FMouseEvent*);
@ -87,7 +93,6 @@ class FButton : public FWidget
bool setNoUnderline(bool); bool setNoUnderline(bool);
bool setNoUnderline(); bool setNoUnderline();
bool unsetNoUnderline(); bool unsetNoUnderline();
bool setEnable(bool); bool setEnable(bool);
bool setEnable(); bool setEnable();
bool unsetEnable(); bool unsetEnable();

View File

@ -44,8 +44,11 @@ class FButtonGroup : public FWidget
FButtonGroup::FButtonList buttonlist; FButtonGroup::FButtonList buttonlist;
private: private:
// Disable copy constructor
FButtonGroup (const FButtonGroup&); FButtonGroup (const FButtonGroup&);
// Disable assignment operator (=)
FButtonGroup& operator = (const FButtonGroup&); FButtonGroup& operator = (const FButtonGroup&);
void init(); void init();
bool isRadioButton(FToggleButton*) const; bool isRadioButton(FToggleButton*) const;
void directFocus(); void directFocus();
@ -57,36 +60,41 @@ class FButtonGroup : public FWidget
void drawLabel(); void drawLabel();
public: public:
explicit FButtonGroup (FWidget* = 0); // constructor // Constructors
FButtonGroup (const FString&, FWidget* = 0); // constructor explicit FButtonGroup (FWidget* = 0);
virtual ~FButtonGroup(); // destructor FButtonGroup (const FString&, FWidget* = 0);
const char* getClassName() const; // Destructor
virtual ~FButtonGroup();
void hide(); const char* getClassName() const;
void hide();
FToggleButton* getFirstButton(); FToggleButton* getFirstButton();
FToggleButton* getLastButton(); FToggleButton* getLastButton();
bool hasFocusedButton(); bool hasFocusedButton();
bool hasCheckedButton(); bool hasCheckedButton();
void onMouseDown (FMouseEvent*);
void onAccel (FAccelEvent*);
void onFocusIn (FFocusEvent*);
void onFocusOut (FFocusEvent*);
void insert (FToggleButton*); // Event handlers
void remove (FToggleButton*); void onMouseDown (FMouseEvent*);
void onAccel (FAccelEvent*);
void onFocusIn (FFocusEvent*);
void onFocusOut (FFocusEvent*);
void cb_buttonToggled (FWidget*, void*); void insert (FToggleButton*);
void remove (FToggleButton*);
bool setEnable(bool); // Callback method
bool setEnable(); void cb_buttonToggled (FWidget*, void*);
bool unsetEnable();
bool setDisable(); bool setEnable(bool);
bool setBorder(bool); bool setEnable();
bool setBorder(); bool unsetEnable();
bool unsetBorder(); bool setDisable();
void setText (const FString&); bool setBorder(bool);
FString& getText(); bool setBorder();
bool unsetBorder();
void setText (const FString&);
FString& getText();
}; };
#pragma pack(pop) #pragma pack(pop)

View File

@ -41,16 +41,22 @@
class FCheckBox : public FToggleButton class FCheckBox : public FToggleButton
{ {
private: private:
// Disable copy constructor
FCheckBox (const FCheckBox&); FCheckBox (const FCheckBox&);
// Disable assignment operator (=)
FCheckBox& operator = (const FCheckBox&); FCheckBox& operator = (const FCheckBox&);
void init(); void init();
void draw(); void draw();
void drawCheckButton(); void drawCheckButton();
public: public:
explicit FCheckBox (FWidget* = 0); // constructor // Constructors
FCheckBox (const FString&, FWidget* = 0); // constructor explicit FCheckBox (FWidget* = 0);
virtual ~FCheckBox(); // destructor FCheckBox (const FString&, FWidget* = 0);
// Destructor
virtual ~FCheckBox();
const char* getClassName() const; const char* getClassName() const;
}; };
#pragma pack(pop) #pragma pack(pop)

View File

@ -41,18 +41,24 @@
class FCheckMenuItem : public FMenuItem class FCheckMenuItem : public FMenuItem
{ {
private: private:
// Disable copy constructor
FCheckMenuItem (const FCheckMenuItem&); FCheckMenuItem (const FCheckMenuItem&);
// Disable assignment operator (=)
FCheckMenuItem& operator = (const FCheckMenuItem&); FCheckMenuItem& operator = (const FCheckMenuItem&);
void init (FWidget*); void init (FWidget*);
void processToggle(); void processToggle();
void processClicked(); void processClicked();
public: public:
// Constructor
explicit FCheckMenuItem (FWidget* = 0); explicit FCheckMenuItem (FWidget* = 0);
FCheckMenuItem (FString&, FWidget* = 0); FCheckMenuItem (FString&, FWidget* = 0);
FCheckMenuItem (const std::string&, FWidget* = 0); FCheckMenuItem (const std::string&, FWidget* = 0);
FCheckMenuItem (const char*, FWidget* = 0); FCheckMenuItem (const char*, FWidget* = 0);
// Destructor
virtual ~FCheckMenuItem(); virtual ~FCheckMenuItem();
const char* getClassName() const; const char* getClassName() const;
}; };
#pragma pack(pop) #pragma pack(pop)

View File

@ -20,9 +20,10 @@ FDialog::FDialog(FWidget* parent)
, zoom_button_active(false) , zoom_button_active(false)
, titlebar_click_pos() , titlebar_click_pos()
, resize_click_pos() , resize_click_pos()
, old_geometry() , save_geometry()
, dialog_menu() , dialog_menu()
, dgl_menuitem() , dgl_menuitem()
, move_size_item()
, zoom_item() , zoom_item()
, close_item() , close_item()
{ {
@ -38,9 +39,10 @@ FDialog::FDialog (const FString& txt, FWidget* parent)
, zoom_button_active(false) , zoom_button_active(false)
, titlebar_click_pos() , titlebar_click_pos()
, resize_click_pos() , resize_click_pos()
, old_geometry() , save_geometry()
, dialog_menu() , dialog_menu()
, dgl_menuitem() , dgl_menuitem()
, move_size_item()
, zoom_item() , zoom_item()
, close_item() , close_item()
{ {
@ -133,6 +135,16 @@ void FDialog::init()
dgl_menuitem->unsetFocusable(); dgl_menuitem->unsetFocusable();
} }
move_size_item = new FMenuItem (dialog_menu);
move_size_item->setText ("&Move/Size");
move_size_item->setStatusbarMessage ("Move or change the size of the window");
move_size_item->addCallback
(
"clicked",
_METHOD_CALLBACK (this, &FDialog::cb_move)
);
zoom_item = new FMenuItem (dialog_menu); zoom_item = new FMenuItem (dialog_menu);
setZoomItem(); setZoomItem();
zoom_item->setDisable(); zoom_item->setDisable();
@ -161,10 +173,10 @@ void FDialog::drawBorder()
int y1 = 2; int y1 = 2;
int y2 = 1 + getHeight() - 1; int y2 = 1 + getHeight() - 1;
if ( resize_click_pos.isNull() || isZoomed() ) if ( (getMoveSizeMode() || ! resize_click_pos.isNull()) && ! isZoomed() )
setColor();
else
setColor (wc.dialog_resize_fg, getBackgroundColor()); setColor (wc.dialog_resize_fg, getBackgroundColor());
else
setColor();
if ( isNewFont() ) if ( isNewFont() )
{ {
@ -278,7 +290,7 @@ void FDialog::drawTitleBar()
else else
setColor (wc.titlebar_inactive_fg, wc.titlebar_inactive_bg); setColor (wc.titlebar_inactive_fg, wc.titlebar_inactive_bg);
if ( (flags & fc::resizeable) == 0 ) if ( ! isResizeable() )
zoom_btn = 0; zoom_btn = 0;
else if ( isNewFont() ) else if ( isNewFont() )
zoom_btn = 2; zoom_btn = 2;
@ -312,7 +324,7 @@ void FDialog::drawTitleBar()
unsetBold(); unsetBold();
// draw the zoom/unzoom button // draw the zoom/unzoom button
if ( (flags & fc::resizeable) != 0 ) if ( isResizeable() )
{ {
if ( zoom_button_pressed ) if ( zoom_button_pressed )
setColor (wc.titlebar_button_focus_fg, wc.titlebar_button_focus_bg); setColor (wc.titlebar_button_focus_fg, wc.titlebar_button_focus_bg);
@ -457,14 +469,35 @@ void FDialog::setZoomItem()
{ {
zoom_item->setText ("&Unzoom"); zoom_item->setText ("&Unzoom");
zoom_item->setStatusbarMessage ("Restore the window size"); zoom_item->setStatusbarMessage ("Restore the window size");
move_size_item->setDisable();
} }
else else
{ {
zoom_item->setText ("&Zoom"); zoom_item->setText ("&Zoom");
zoom_item->setStatusbarMessage ("Enlarge the window to the entire desktop"); zoom_item->setStatusbarMessage ("Enlarge the window to the entire desktop");
move_size_item->setEnable();
} }
} }
#include "fmessagebox.h"
//----------------------------------------------------------------------
void FDialog::cb_move (FWidget*, void*)
{
if ( isZoomed() )
return;
setMoveSizeMode(true);
save_geometry = getGeometry();
redraw();
// Tooltip
// ┌──────────────────────────┐
// │ Arrow keys: Move │
// │Meta + Arrow keys: Resize │
// │ Enter: Done │
// │ Esc: Cancel │
// └──────────────────────────┘
}
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FDialog::cb_zoom (FWidget*, void*) void FDialog::cb_zoom (FWidget*, void*)
@ -584,7 +617,7 @@ void FDialog::onKeyPress (FKeyEvent* ev)
if ( ! isEnabled() ) if ( ! isEnabled() )
return; return;
// cancel resize // cancel resize by mouse
if ( ! resize_click_pos.isNull() ) if ( ! resize_click_pos.isNull() )
{ {
resize_click_pos.setPoint (0,0); resize_click_pos.setPoint (0,0);
@ -601,6 +634,90 @@ void FDialog::onKeyPress (FKeyEvent* ev)
selectFirstMenuItem(); selectFirstMenuItem();
} }
if ( getMoveSizeMode() )
{
switch ( ev->key() )
{
case fc::Fkey_up:
move (getX(), getY() - 1);
redraw();
ev->accept();
break;
case fc::Fkey_down:
move (getX(), getY() + 1);
redraw();
ev->accept();
break;
case fc::Fkey_left:
move (getX() - 1, getY());
redraw();
ev->accept();
break;
case fc::Fkey_right:
move (getX() + 1, getY());
redraw();
ev->accept();
break;
case fc::Fmkey_up:
if ( isResizeable() )
{
setSize (getWidth(), getHeight() - 1);
ev->accept();
}
break;
case fc::Fmkey_down:
if ( isResizeable() && getHeight() + getY() <= getMaxHeight() )
{
setSize (getWidth(), getHeight() + 1);
ev->accept();
}
break;
case fc::Fmkey_left:
if ( isResizeable() )
{
setSize (getWidth() - 1, getHeight());
ev->accept();
}
break;
case fc::Fmkey_right:
if ( isResizeable() && getWidth() + getX() <= getMaxWidth() )
{
setSize (getWidth() + 1, getHeight());
ev->accept();
}
break;
case fc::Fkey_return:
case fc::Fkey_enter:
setMoveSizeMode(false);
redraw();
ev->accept();
break;
case fc::Fkey_escape:
case fc::Fkey_escape_mintty:
setMoveSizeMode(false);
move (save_geometry.getPos());
if ( isResizeable() )
setSize (save_geometry.getWidth(), save_geometry.getHeight());
redraw();
ev->accept();
return;
default:
break;
}
}
if ( this == getMainWidget() ) if ( this == getMainWidget() )
return; return;
@ -621,9 +738,9 @@ void FDialog::onMouseDown (FMouseEvent* ev)
{ {
int mouse_x = ev->getX(); int mouse_x = ev->getX();
int mouse_y = ev->getY(); int mouse_y = ev->getY();
int zoom_btn; int zoom_btn;;
if ( (flags & fc::resizeable) == 0 ) if ( ! isResizeable() )
zoom_btn = 0; zoom_btn = 0;
else if ( isNewFont() ) else if ( isNewFont() )
zoom_btn = 2; zoom_btn = 2;
@ -732,7 +849,7 @@ void FDialog::onMouseUp (FMouseEvent* ev)
{ {
int zoom_btn; int zoom_btn;
if ( (flags & fc::resizeable) == 0 ) if ( ! isResizeable() )
zoom_btn = 0; zoom_btn = 0;
else if ( isNewFont() ) else if ( isNewFont() )
zoom_btn = 2; zoom_btn = 2;
@ -831,7 +948,7 @@ void FDialog::onMouseMove (FMouseEvent* ev)
{ {
int zoom_btn; int zoom_btn;
if ( (flags & fc::resizeable) == 0 ) if ( ! isResizeable() )
zoom_btn = 0; zoom_btn = 0;
else if ( isNewFont() ) else if ( isNewFont() )
zoom_btn = 2; zoom_btn = 2;
@ -916,16 +1033,14 @@ void FDialog::onMouseMove (FMouseEvent* ev)
void FDialog::onMouseDoubleClick (FMouseEvent* ev) void FDialog::onMouseDoubleClick (FMouseEvent* ev)
{ {
int x, y, mouse_x, mouse_y, zoom_btn; int x, y, mouse_x, mouse_y, zoom_btn;
bool is_resizeable;
if ( ev->getButton() != fc::LeftButton ) if ( ev->getButton() != fc::LeftButton )
return; return;
mouse_x = ev->getX(); mouse_x = ev->getX();
mouse_y = ev->getY(); mouse_y = ev->getY();
is_resizeable = bool(flags & fc::resizeable);
if ( ! is_resizeable ) if ( ! isResizeable() )
zoom_btn = 0; zoom_btn = 0;
else if ( isNewFont() ) else if ( isNewFont() )
zoom_btn = 2; zoom_btn = 2;
@ -957,7 +1072,7 @@ void FDialog::onMouseDoubleClick (FMouseEvent* ev)
else else
close(); close();
} }
else if ( is_resizeable else if ( isResizeable()
&& mouse_x >= 4 && mouse_x >= 4
&& mouse_x <= getWidth() - zoom_btn && mouse_x <= getWidth() - zoom_btn
&& mouse_y == 1 ) && mouse_y == 1 )
@ -1122,6 +1237,7 @@ void FDialog::move (const FPoint& pos)
void FDialog::move (int x, int y) void FDialog::move (int x, int y)
{ {
int dx, dy, old_x, old_y, rsw, bsh, width, height; int dx, dy, old_x, old_y, rsw, bsh, width, height;
FRect old_geometry;
if ( getX() == x && getY() == y ) if ( getX() == x && getY() == y )
return; return;
@ -1130,7 +1246,7 @@ void FDialog::move (int x, int y)
height = getHeight(); height = getHeight();
// Avoid to move widget completely outside the terminal // Avoid to move widget completely outside the terminal
if ( x+width < 1 || x > getColumnNumber() || y < 1 || y > getLineNumber() ) if ( x+width-1 < 1 || x > getMaxWidth() || y < 1 || y > getMaxHeight() )
return; return;
if ( isZoomed() ) if ( isZoomed() )

View File

@ -56,15 +56,19 @@ class FDialog : public FWindow
bool zoom_button_active; bool zoom_button_active;
FPoint titlebar_click_pos; FPoint titlebar_click_pos;
FPoint resize_click_pos; FPoint resize_click_pos;
FRect old_geometry; // required by move() FRect save_geometry; // required by move/size by keyboard
FMenu* dialog_menu; FMenu* dialog_menu;
FMenuItem* dgl_menuitem; FMenuItem* dgl_menuitem;
FMenuItem* move_size_item;
FMenuItem* zoom_item; FMenuItem* zoom_item;
FMenuItem* close_item; FMenuItem* close_item;
private: private:
// Disable copy constructor
FDialog (const FDialog&); FDialog (const FDialog&);
// Disable assignment operator (=)
FDialog& operator = (const FDialog&); FDialog& operator = (const FDialog&);
void init(); void init();
// make every drawBorder from FWidget available // make every drawBorder from FWidget available
using FWidget::drawBorder; using FWidget::drawBorder;
@ -74,8 +78,12 @@ class FDialog : public FWindow
void openMenu(); void openMenu();
void selectFirstMenuItem(); void selectFirstMenuItem();
void setZoomItem(); void setZoomItem();
// Callback methods
void cb_move (FWidget*, void*);
void cb_zoom (FWidget*, void*); void cb_zoom (FWidget*, void*);
void cb_close (FWidget*, void*); void cb_close (FWidget*, void*);
static void addDialog (FWidget*); static void addDialog (FWidget*);
static void delDialog (FWidget*); static void delDialog (FWidget*);
@ -87,11 +95,15 @@ class FDialog : public FWindow
virtual void onClose (FCloseEvent*); virtual void onClose (FCloseEvent*);
public: public:
explicit FDialog (FWidget* = 0); // constructor // Constructors
FDialog (const FString&, FWidget* = 0); // constructor explicit FDialog (FWidget* = 0);
virtual ~FDialog(); // destructor FDialog (const FString&, FWidget* = 0);
// Destructor
virtual ~FDialog();
virtual const char* getClassName() const; virtual const char* getClassName() const;
// Event handlers
void onKeyPress (FKeyEvent*); void onKeyPress (FKeyEvent*);
void onMouseDown (FMouseEvent*); void onMouseDown (FMouseEvent*);
void onMouseUp (FMouseEvent*); void onMouseUp (FMouseEvent*);
@ -102,6 +114,7 @@ class FDialog : public FWindow
void onWindowInactive (FEvent*); void onWindowInactive (FEvent*);
void onWindowRaised (FEvent*); void onWindowRaised (FEvent*);
void onWindowLowered (FEvent*); void onWindowLowered (FEvent*);
void activateDialog(); void activateDialog();
void drawDialogShadow(); void drawDialogShadow();
void show(); void show();

View File

@ -48,16 +48,22 @@
class FDialogListMenu : public FMenu class FDialogListMenu : public FMenu
{ {
private: private:
// Disable copy constructor
FDialogListMenu (const FDialogListMenu&); FDialogListMenu (const FDialogListMenu&);
// Disable assignment operator (=)
FDialogListMenu& operator = (const FDialogListMenu&); FDialogListMenu& operator = (const FDialogListMenu&);
void init(); void init();
public: public:
explicit FDialogListMenu (FWidget* = 0); // constructor // Constructors
explicit FDialogListMenu (FWidget* = 0);
FDialogListMenu (FString&, FWidget* = 0); FDialogListMenu (FString&, FWidget* = 0);
FDialogListMenu (const std::string&, FWidget* = 0); FDialogListMenu (const std::string&, FWidget* = 0);
FDialogListMenu (const char*, FWidget* = 0); FDialogListMenu (const char*, FWidget* = 0);
virtual ~FDialogListMenu(); // destructor // Destructor
virtual ~FDialogListMenu();
virtual const char* getClassName() const; virtual const char* getClassName() const;
}; };
#pragma pack(pop) #pragma pack(pop)

View File

@ -204,8 +204,10 @@ class FFocusEvent : public FEvent // focus event
class FAccelEvent : public FEvent // focus event class FAccelEvent : public FEvent // focus event
{ {
private: private:
FAccelEvent (const FAccelEvent&); // Disabled copy constructor // Disable copy constructor
FAccelEvent& operator = (const FAccelEvent&); // and operator '=' FAccelEvent (const FAccelEvent&);
// Disable assignment operator (=)
FAccelEvent& operator = (const FAccelEvent&);
public: public:
FAccelEvent (int, void*); FAccelEvent (int, void*);

View File

@ -78,19 +78,20 @@ class FFileDialog : public FDialog
Open = 0, Open = 0,
Save = 1 Save = 1
}; };
private: private:
DIR* directory_stream; DIR* directory_stream;
std::vector<dir_entry> dir_entries; std::vector<dir_entry> dir_entries;
FString directory; FString directory;
FString filter_pattern; FString filter_pattern;
FListBox* filebrowser; FListBox* filebrowser;
FLineEdit* filename; FLineEdit* filename;
FCheckBox* hidden; FCheckBox* hidden;
FButton* cancel; FButton* cancel;
FButton* open; FButton* open;
DialogType dlg_type; DialogType dlg_type;
bool show_hidden; bool show_hidden;
private: private:
void init(); void init();
@ -100,6 +101,8 @@ class FFileDialog : public FDialog
int numOfDirs(); int numOfDirs();
int changeDir (const FString&); int changeDir (const FString&);
void printPath (const FString&); void printPath (const FString&);
// Callback methods
void cb_processActivate (FWidget*, void*); void cb_processActivate (FWidget*, void*);
void cb_processRowChanged (FWidget*, void*); void cb_processRowChanged (FWidget*, void*);
void cb_processClicked (FWidget*, void*); void cb_processClicked (FWidget*, void*);
@ -111,16 +114,22 @@ class FFileDialog : public FDialog
void adjustSize(); void adjustSize();
public: public:
// Constructors
explicit FFileDialog (FWidget* = 0); explicit FFileDialog (FWidget* = 0);
FFileDialog (const FFileDialog&); // copy constructor FFileDialog (const FFileDialog&); // copy constructor
FFileDialog ( const FString& FFileDialog ( const FString&
, const FString& , const FString&
, DialogType = FFileDialog::Open , DialogType = FFileDialog::Open
, FWidget* = 0 ); , FWidget* = 0 );
// Destructor
~FFileDialog(); ~FFileDialog();
FFileDialog& operator = (const FFileDialog&); // assignment
// Assignment operator (=)
FFileDialog& operator = (const FFileDialog&);
const char* getClassName() const; const char* getClassName() const;
// Event handler
void onKeyPress (FKeyEvent*); void onKeyPress (FKeyEvent*);
const FString getPath() const; const FString getPath() const;

View File

@ -47,7 +47,9 @@ class FLabel : public FWidget
FWidget* accel_widget; FWidget* accel_widget;
private: private:
// Disable copy constructor
FLabel (const FLabel&); FLabel (const FLabel&);
// Disable assignment operator (=)
FLabel& operator = (const FLabel&); FLabel& operator = (const FLabel&);
void init(); void init();
@ -59,15 +61,22 @@ class FLabel : public FWidget
void draw(); void draw();
public: public:
explicit FLabel (FWidget* = 0); // constructor // Constructor
FLabel (const FString&, FWidget* = 0); // constructor explicit FLabel (FWidget* = 0);
virtual ~FLabel(); // destructor FLabel (const FString&, FWidget* = 0);
const char* getClassName() const; // Destructor
virtual ~FLabel();
const char* getClassName() const;
void hide(); void hide();
// Event handlers
void onMouseDown (FMouseEvent*); void onMouseDown (FMouseEvent*);
void onAccel (FAccelEvent*); void onAccel (FAccelEvent*);
// Callback method
void cb_accel_widget_destroyed (FWidget*, void*); void cb_accel_widget_destroyed (FWidget*, void*);
void setAccelWidget (FWidget* = 0); void setAccelWidget (FWidget* = 0);
FTerm* getAccelWidget(); FTerm* getAccelWidget();
void setAlignment(uInt); void setAlignment(uInt);

View File

@ -64,8 +64,11 @@ class FLineEdit : public FWidget
label_o label_orientation; label_o label_orientation;
private: private:
// Disable copy constructor
FLineEdit (const FLineEdit&); FLineEdit (const FLineEdit&);
// Disable assignment operator (=)
FLineEdit& operator = (const FLineEdit&); FLineEdit& operator = (const FLineEdit&);
void init(); void init();
bool hasHotkey(); bool hasHotkey();
void draw(); void draw();
@ -78,11 +81,13 @@ class FLineEdit : public FWidget
void adjustSize(); void adjustSize();
public: public:
explicit FLineEdit (FWidget* = 0); // constructor // Constructor
FLineEdit (const FString&, FWidget* = 0); // constructor explicit FLineEdit (FWidget* = 0);
virtual ~FLineEdit(); // destructor FLineEdit (const FString&, FWidget* = 0);
const char* getClassName() const; // Destructor
virtual ~FLineEdit();
const char* getClassName() const;
void hide(); void hide();
bool setEnable(bool); bool setEnable(bool);
@ -97,6 +102,7 @@ class FLineEdit : public FWidget
bool unsetShadow(); bool unsetShadow();
bool hasShadow(); bool hasShadow();
// Event handlers
void onKeyPress (FKeyEvent*); void onKeyPress (FKeyEvent*);
void onMouseDown (FMouseEvent*); void onMouseDown (FMouseEvent*);
void onMouseUp (FMouseEvent*); void onMouseUp (FMouseEvent*);

View File

@ -45,11 +45,14 @@ class FListBoxItem
bool selected; bool selected;
public: public:
// Constructors
FListBoxItem (); FListBoxItem ();
explicit FListBoxItem (FString&); explicit FListBoxItem (FString&);
explicit FListBoxItem (const std::string&); explicit FListBoxItem (const std::string&);
explicit FListBoxItem (const char*); explicit FListBoxItem (const char*);
// Destructor
virtual ~FListBoxItem(); virtual ~FListBoxItem();
virtual FString getText() const; virtual FString getText() const;
protected: protected:
@ -120,8 +123,11 @@ class FListBox : public FWidget
int max_line_width; int max_line_width;
private: private:
// Disable copy constructor
FListBox (const FListBox&); FListBox (const FListBox&);
// Disable assignment operator (=)
FListBox& operator = (const FListBox&); FListBox& operator = (const FListBox&);
void init(); void init();
void draw(); void draw();
void drawLabel(); void drawLabel();
@ -135,12 +141,15 @@ class FListBox : public FWidget
void adjustSize(); void adjustSize();
public: public:
explicit FListBox (FWidget* = 0); // constructor // Constructor
~FListBox(); // destructor explicit FListBox (FWidget* = 0);
const char* getClassName() const; // Destructor
~FListBox();
const char* getClassName() const;
void hide(); void hide();
// Event handlers
void onKeyPress (FKeyEvent*); void onKeyPress (FKeyEvent*);
void onMouseDown (FMouseEvent*); void onMouseDown (FMouseEvent*);
void onMouseUp (FMouseEvent*); void onMouseUp (FMouseEvent*);
@ -151,18 +160,20 @@ class FListBox : public FWidget
void onFocusIn (FFocusEvent*); void onFocusIn (FFocusEvent*);
void onFocusOut (FFocusEvent*); void onFocusOut (FFocusEvent*);
// Callback methods
void cb_VBarChange (FWidget*, void*); void cb_VBarChange (FWidget*, void*);
void cb_HBarChange (FWidget*, void*); void cb_HBarChange (FWidget*, void*);
uInt count() const; uInt count() const;
FListBoxItem Item(int) const; FListBoxItem Item (int) const;
int currentItem() const; int currentItem() const;
void setCurrentItem(int); void setCurrentItem (int);
void selectItem(int); void selectItem (int);
void unselectItem(int); void unselectItem (int);
bool isSelected(int) const; bool isSelected (int) const;
void showInsideBrackets(int, fc::brackets_type); void showInsideBrackets (int, fc::brackets_type);
void showNoBrackets(int); void showNoBrackets (int);
bool hasBrackets(int) const; bool hasBrackets (int) const;
// make every setGeometry from FWidget available // make every setGeometry from FWidget available
using FWidget::setGeometry; using FWidget::setGeometry;
void setGeometry (int, int, int, int, bool = true); void setGeometry (int, int, int, int, bool = true);
@ -171,11 +182,11 @@ class FListBox : public FWidget
void setMultiSelection (); void setMultiSelection ();
void unsetMultiSelection (); void unsetMultiSelection ();
bool isMultiSelection() const; bool isMultiSelection() const;
bool setEnable(bool); bool setEnable (bool);
bool setEnable(); bool setEnable();
bool unsetEnable(); bool unsetEnable();
bool setDisable(); bool setDisable();
bool setFocus(bool); bool setFocus (bool);
bool setFocus(); bool setFocus();
bool unsetFocus(); bool unsetFocus();

View File

@ -54,8 +54,11 @@ class FMenu : public FWindow, public FMenuList
bool has_checkable_items; bool has_checkable_items;
private: private:
// Disable copy constructor
FMenu (const FMenu&); FMenu (const FMenu&);
// Disable assignment operator (=)
FMenu& operator = (const FMenu&); FMenu& operator = (const FMenu&);
void init(FWidget*); void init(FWidget*);
void calculateDimensions(); void calculateDimensions();
void adjustItems(); void adjustItems();
@ -89,18 +92,23 @@ class FMenu : public FWindow, public FMenuList
void processActivate(); void processActivate();
public: public:
explicit FMenu (FWidget* = 0); // constructor // Constructor
explicit FMenu (FWidget* = 0);
FMenu (FString&, FWidget* = 0); FMenu (FString&, FWidget* = 0);
FMenu (const std::string&, FWidget* = 0); FMenu (const std::string&, FWidget* = 0);
FMenu (const char*, FWidget* = 0); FMenu (const char*, FWidget* = 0);
virtual ~FMenu(); // destructor // Destructor
virtual ~FMenu();
virtual const char* getClassName() const; virtual const char* getClassName() const;
// Event handlers
void onKeyPress (FKeyEvent*); void onKeyPress (FKeyEvent*);
void onMouseDown (FMouseEvent*); void onMouseDown (FMouseEvent*);
void onMouseUp (FMouseEvent*); void onMouseUp (FMouseEvent*);
void onMouseMove (FMouseEvent*); void onMouseMove (FMouseEvent*);
void onAccel (FAccelEvent*); void onAccel (FAccelEvent*);
void show(); void show();
void hide(); void hide();
// make every setGeometry from FWidget available // make every setGeometry from FWidget available
@ -130,6 +138,8 @@ class FMenu : public FWindow, public FMenuList
void setText (FString&); void setText (FString&);
void setText (const std::string&); void setText (const std::string&);
void setText (const char*); void setText (const char*);
// Callback method
void cb_menuitem_toggled (FWidget*, void*); void cb_menuitem_toggled (FWidget*, void*);
private: private:

View File

@ -49,8 +49,11 @@ class FMenuBar : public FWindow, public FMenuList
bool drop_down; bool drop_down;
private: private:
// Disable copy constructor
FMenuBar (const FMenuBar&); FMenuBar (const FMenuBar&);
// Disable assignment operator (=)
FMenuBar& operator = (const FMenuBar&); FMenuBar& operator = (const FMenuBar&);
void init(); void init();
void calculateDimensions(); void calculateDimensions();
bool isMenu (FMenuItem*) const; bool isMenu (FMenuItem*) const;
@ -64,18 +67,25 @@ class FMenuBar : public FWindow, public FMenuList
void leaveMenuBar(); void leaveMenuBar();
public: public:
explicit FMenuBar (FWidget* = 0); // constructor // Constructor
virtual ~FMenuBar(); // destructor explicit FMenuBar (FWidget* = 0);
// Destructor
virtual ~FMenuBar();
virtual const char* getClassName() const; virtual const char* getClassName() const;
// Event handlers
void onKeyPress (FKeyEvent*); void onKeyPress (FKeyEvent*);
void onMouseDown (FMouseEvent*); void onMouseDown (FMouseEvent*);
void onMouseUp (FMouseEvent*); void onMouseUp (FMouseEvent*);
void onMouseMove (FMouseEvent*); void onMouseMove (FMouseEvent*);
void onAccel (FAccelEvent*); void onAccel (FAccelEvent*);
void hide(); void hide();
void resetMenu(); void resetMenu();
void adjustSize(); void adjustSize();
// Callback methods
void cb_item_deactivated (FWidget*, void*); void cb_item_deactivated (FWidget*, void*);
private: private:

View File

@ -58,15 +58,21 @@ class FMenuItem : public FWidget
FDialog* associated_window; FDialog* associated_window;
private: private:
// Disable copy constructor
FMenuItem (const FMenuItem&); FMenuItem (const FMenuItem&);
// Disable assignment operator (=)
FMenuItem& operator = (const FMenuItem&); FMenuItem& operator = (const FMenuItem&);
void init (FWidget*); void init (FWidget*);
uChar hotKey(); uChar hotKey();
void processActivate(); void processActivate();
void processDeactivate(); void processDeactivate();
void createDialogList (FMenu*); void createDialogList (FMenu*);
// Callback methods
void cb_switchToDialog (FWidget*, void*); void cb_switchToDialog (FWidget*, void*);
void cb_destroyDialog (FWidget*, void*); void cb_destroyDialog (FWidget*, void*);
virtual void processClicked(); virtual void processClicked();
protected: protected:
@ -77,6 +83,7 @@ class FMenuItem : public FWidget
void setSuperMenu (FWidget*); void setSuperMenu (FWidget*);
public: public:
// Constructor
explicit FMenuItem (FWidget* = 0); explicit FMenuItem (FWidget* = 0);
FMenuItem (FString&, FWidget* = 0); FMenuItem (FString&, FWidget* = 0);
FMenuItem (const std::string&, FWidget* = 0); FMenuItem (const std::string&, FWidget* = 0);
@ -84,7 +91,9 @@ class FMenuItem : public FWidget
FMenuItem (int, FString&, FWidget* = 0); FMenuItem (int, FString&, FWidget* = 0);
FMenuItem (int, const std::string&, FWidget* = 0); FMenuItem (int, const std::string&, FWidget* = 0);
FMenuItem (int, const char*, FWidget* = 0); FMenuItem (int, const char*, FWidget* = 0);
// Destructor
virtual ~FMenuItem(); virtual ~FMenuItem();
const char* getClassName() const; const char* getClassName() const;
// make every addAccelerator from FWidget available // make every addAccelerator from FWidget available
@ -93,6 +102,8 @@ class FMenuItem : public FWidget
// make every delAccelerator from FWidget available // make every delAccelerator from FWidget available
using FWidget::delAccelerator; using FWidget::delAccelerator;
void delAccelerator (FWidget*); void delAccelerator (FWidget*);
// Event handlers
void onKeyPress (FKeyEvent*); void onKeyPress (FKeyEvent*);
void onMouseDoubleClick (FMouseEvent*); void onMouseDoubleClick (FMouseEvent*);
void onMouseDown (FMouseEvent*); void onMouseDown (FMouseEvent*);

View File

@ -37,29 +37,32 @@ class FMenuList
std::vector<FMenuItem*> item_list; std::vector<FMenuItem*> item_list;
private: private:
// Disable copy constructor
FMenuList (const FMenuList&); FMenuList (const FMenuList&);
// Disable assignment operator (=)
FMenuList& operator = (const FMenuList&); FMenuList& operator = (const FMenuList&);
public: public:
// Constructor
explicit FMenuList(); explicit FMenuList();
// Destructor
virtual ~FMenuList(); virtual ~FMenuList();
virtual const char* getClassName() const; virtual const char* getClassName() const;
uInt count() const;
uInt count() const; FMenuItem* item (int) const;
FMenuItem* item (int) const; void enableItem (int);
void enableItem (int); void disableItem (int);
void disableItem (int); bool isSelected (int) const;
bool isSelected (int) const; void selectFirstItem();
void selectFirstItem(); void unselectItem();
void unselectItem(); FMenuItem* getSelectedItem() const;
FMenuItem* getSelectedItem() const; void setSelectedItem (FMenuItem*);
void setSelectedItem (FMenuItem*); bool hasSelectedItem() const;
bool hasSelectedItem() const; virtual void insert (FMenuItem*);
virtual void remove (FMenuItem*);
virtual void insert (FMenuItem*); void remove (int);
virtual void remove (FMenuItem*); void clear();
void remove (int);
void clear();
}; };
#pragma pack(pop) #pragma pack(pop)

View File

@ -84,18 +84,24 @@ class FMessageBox : public FDialog
virtual void draw(); virtual void draw();
void resizeButtons(); void resizeButtons();
void adjustButtons(); void adjustButtons();
// Callback method
void cb_processClick (FWidget*, void*); void cb_processClick (FWidget*, void*);
public: public:
// Constructors
explicit FMessageBox (FWidget* = 0); explicit FMessageBox (FWidget* = 0);
FMessageBox (const FMessageBox&); // copy constructor FMessageBox (const FMessageBox&); // copy constructor
FMessageBox ( const FString&, const FString& FMessageBox ( const FString&, const FString&
, int, int, int , int, int, int
, FWidget* = 0 ); , FWidget* = 0 );
// Destructor
~FMessageBox(); ~FMessageBox();
FMessageBox& operator = (const FMessageBox&); // assignment
const char* getClassName() const;
// Assignment operator (=)
FMessageBox& operator = (const FMessageBox&);
const char* getClassName() const;
const FString getTitlebarText() const; const FString getTitlebarText() const;
void setTitlebarText (const FString&); void setTitlebarText (const FString&);

View File

@ -69,8 +69,11 @@ class FObject
friend class FApplication; friend class FApplication;
public: public:
// Constructor
explicit FObject (FObject* = 0); explicit FObject (FObject* = 0);
// Destructor
virtual ~FObject(); virtual ~FObject();
virtual const char* getClassName() const; virtual const char* getClassName() const;
FObject* getParent() const; FObject* getParent() const;
@ -81,18 +84,23 @@ class FObject
void addChild (FObject*); void addChild (FObject*);
void delChild (FObject*); void delChild (FObject*);
int numOfChildren() const; int numOfChildren() const;
// Timer methods
static void getCurrentTime (timeval&); static void getCurrentTime (timeval&);
int addTimer (int); int addTimer (int);
bool delTimer (int); bool delTimer (int);
bool delOwnTimer(); bool delOwnTimer();
bool delAllTimer(); bool delAllTimer();
// Event handler
virtual bool event (FEvent*); virtual bool event (FEvent*);
protected: protected:
// Event handler
virtual void onTimer (FTimerEvent*); virtual void onTimer (FTimerEvent*);
private: private:
// Disable copy constructor
FObject (const FObject&); FObject (const FObject&);
// Disable assignment operator (=)
FObject& operator = (const FObject&); FObject& operator = (const FObject&);
}; };

View File

@ -131,8 +131,11 @@ class FOptiAttr
char_data off; char_data off;
private: private:
FOptiAttr (const FOptiAttr&); // Disabled copy constructor // Disable copy constructor
FOptiAttr& operator = (const FOptiAttr&); // and operator '=' FOptiAttr (const FOptiAttr&);
// Disable assignment operator (=)
FOptiAttr& operator = (const FOptiAttr&);
bool hasColor (char_data*&); bool hasColor (char_data*&);
bool colorChange (char_data*&, char_data*&); bool colorChange (char_data*&, char_data*&);
void resetColor (char_data*&); void resetColor (char_data*&);
@ -183,8 +186,10 @@ class FOptiAttr
bool setTermDefaultColor (char_data*&); bool setTermDefaultColor (char_data*&);
public: public:
explicit FOptiAttr(); // constructor // Constructor
~FOptiAttr(); // destructor explicit FOptiAttr();
// Destructor
~FOptiAttr();
static short vga2ansi (register short); static short vga2ansi (register short);

View File

@ -85,8 +85,10 @@ class FOptiMove
bool isWideMove (int, int, int, int); bool isWideMove (int, int, int, int);
public: public:
explicit FOptiMove (int = 0); // constructor // Constructor
~FOptiMove(); // destructor explicit FOptiMove (int = 0);
// Destructor
~FOptiMove();
void setBaudRate (int); void setBaudRate (int);
void setTabStop (int); void setTabStop (int);

View File

@ -25,9 +25,12 @@ class FPoint
short ypos; short ypos;
public: public:
FPoint (); // constructor // Constructors
FPoint (int, int); // constructor FPoint ();
virtual ~FPoint(); // destructor FPoint (int, int);
// Destructor
virtual ~FPoint();
virtual const char* getClassName(); virtual const char* getClassName();
bool isNull() const; bool isNull() const;

View File

@ -47,10 +47,12 @@ class FProgressbar : public FWidget
virtual void draw(); virtual void draw();
public: public:
explicit FProgressbar(FWidget* = 0); // constructor // Constructor
explicit FProgressbar(FWidget* = 0);
// Destructor
virtual ~FProgressbar(); virtual ~FProgressbar();
const char* getClassName() const;
const char* getClassName() const;
void hide(); void hide();
int getPercentage(); int getPercentage();

View File

@ -41,16 +41,22 @@
class FRadioButton : public FToggleButton class FRadioButton : public FToggleButton
{ {
private: private:
// Disable copy constructor
FRadioButton (const FRadioButton&); FRadioButton (const FRadioButton&);
// Disable assignment operator (=)
FRadioButton& operator = (const FRadioButton&); FRadioButton& operator = (const FRadioButton&);
void init(); void init();
void draw(); void draw();
void drawRadioButton(); void drawRadioButton();
public: public:
explicit FRadioButton (FWidget* = 0); // constructor // Constructors
FRadioButton (const FString&, FWidget* = 0); // constructor explicit FRadioButton (FWidget* = 0);
virtual ~FRadioButton(); // destructor FRadioButton (const FString&, FWidget* = 0);
// Destructor
virtual ~FRadioButton();
const char* getClassName() const; const char* getClassName() const;
}; };
#pragma pack(pop) #pragma pack(pop)

View File

@ -41,18 +41,24 @@
class FRadioMenuItem : public FMenuItem class FRadioMenuItem : public FMenuItem
{ {
private: private:
// Disable copy constructor
FRadioMenuItem (const FRadioMenuItem&); FRadioMenuItem (const FRadioMenuItem&);
// Disable assignment operator (=)
FRadioMenuItem& operator = (const FRadioMenuItem&); FRadioMenuItem& operator = (const FRadioMenuItem&);
void init (FWidget*); void init (FWidget*);
void processToggle(); void processToggle();
void processClicked(); void processClicked();
public: public:
// Constructor
explicit FRadioMenuItem (FWidget* = 0); explicit FRadioMenuItem (FWidget* = 0);
FRadioMenuItem (FString&, FWidget* = 0); FRadioMenuItem (FString&, FWidget* = 0);
FRadioMenuItem (const std::string&, FWidget* = 0); FRadioMenuItem (const std::string&, FWidget* = 0);
FRadioMenuItem (const char*, FWidget* = 0); FRadioMenuItem (const char*, FWidget* = 0);
// Destructor
virtual ~FRadioMenuItem(); virtual ~FRadioMenuItem();
const char* getClassName() const; const char* getClassName() const;
}; };
#pragma pack(pop) #pragma pack(pop)

View File

@ -31,10 +31,13 @@ class FRect
short Y2; short Y2;
public: public:
FRect (); // constructor // Constructors
FRect (int, int, int, int); // constructor FRect ();
FRect (const FPoint&, const FPoint&); // constructor FRect (int, int, int, int);
virtual ~FRect(); // destructor FRect (const FPoint&, const FPoint&);
// Destructor
virtual ~FRect();
virtual const char* getClassName(); virtual const char* getClassName();
bool isNull() const; bool isNull() const;

View File

@ -69,7 +69,9 @@ class FScrollbar : public FWidget
int max_color; int max_color;
private: private:
// Disable copy constructor
FScrollbar (const FScrollbar&); FScrollbar (const FScrollbar&);
// Disable assignment operator (=)
FScrollbar& operator = (const FScrollbar&); FScrollbar& operator = (const FScrollbar&);
void init(); void init();
@ -79,11 +81,15 @@ class FScrollbar : public FWidget
void processScroll(); void processScroll();
public: public:
explicit FScrollbar(FWidget* = 0); // constructor // Constructors
FScrollbar (int = fc::vertical, FWidget* = 0); // constructor explicit FScrollbar(FWidget* = 0);
FScrollbar (int = fc::vertical, FWidget* = 0);
// Destructor
virtual ~FScrollbar(); virtual ~FScrollbar();
const char* getClassName() const; const char* getClassName() const;
// Event handlers
void onMouseDown (FMouseEvent*); void onMouseDown (FMouseEvent*);
void onMouseUp (FMouseEvent*); void onMouseUp (FMouseEvent*);
void onMouseMove (FMouseEvent*); void onMouseMove (FMouseEvent*);

View File

@ -358,6 +358,30 @@ void FStatusBar::drawKeys()
// public methods of FStatusBar // public methods of FStatusBar
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FStatusBar::hide()
{
int screenWidth;
short fg, bg;
char* blank;
FWindow::hide();
fg = wc.term_fg;
bg = wc.term_bg;
setColor (fg, bg);
screenWidth = getColumnNumber();
if ( screenWidth < 0 )
return;
blank = new char[screenWidth+1];
memset(blank, ' ', uLong(screenWidth));
blank[screenWidth] = '\0';
printPos (1, 1);
print (vstatusbar, blank);
delete[] blank;
}
//----------------------------------------------------------------------
void FStatusBar::onMouseDown (FMouseEvent* ev) void FStatusBar::onMouseDown (FMouseEvent* ev)
{ {
if ( hasActivatedKey() ) if ( hasActivatedKey() )
@ -527,30 +551,6 @@ void FStatusBar::onMouseMove (FMouseEvent* ev)
} }
} }
//----------------------------------------------------------------------
void FStatusBar::hide()
{
int screenWidth;
short fg, bg;
char* blank;
FWindow::hide();
fg = wc.term_fg;
bg = wc.term_bg;
setColor (fg, bg);
screenWidth = getColumnNumber();
if ( screenWidth < 0 )
return;
blank = new char[screenWidth+1];
memset(blank, ' ', uLong(screenWidth));
blank[screenWidth] = '\0';
printPos (1, 1);
print (vstatusbar, blank);
delete[] blank;
}
//---------------------------------------------------------------------- //----------------------------------------------------------------------
bool FStatusBar::hasActivatedKey() bool FStatusBar::hasActivatedKey()
{ {

View File

@ -53,21 +53,28 @@ class FStatusKey : public FWidget
FStatusBar* bar; FStatusBar* bar;
private: private:
// Disable copy constructor
FStatusKey (const FStatusKey&); FStatusKey (const FStatusKey&);
// Disable assignment operator (=)
FStatusKey& operator = (const FStatusKey&); FStatusKey& operator = (const FStatusKey&);
void init (FWidget*); void init (FWidget*);
void processActivate(); void processActivate();
FStatusBar* statusbar() const; FStatusBar* statusbar() const;
void setStatusbar (FStatusBar*); void setStatusbar (FStatusBar*);
public: public:
// Constructors
explicit FStatusKey (FWidget* = 0); explicit FStatusKey (FWidget* = 0);
FStatusKey (int, FString&, FWidget* = 0); FStatusKey (int, FString&, FWidget* = 0);
FStatusKey (int, const std::string&, FWidget* = 0); FStatusKey (int, const std::string&, FWidget* = 0);
FStatusKey (int, const char*, FWidget* = 0); FStatusKey (int, const char*, FWidget* = 0);
// Destructor
virtual ~FStatusKey(); virtual ~FStatusKey();
// Event handler
void onAccel (FAccelEvent*); void onAccel (FAccelEvent*);
void setActive(); void setActive();
void unsetActive(); void unsetActive();
bool isActivated() const; bool isActivated() const;
@ -153,21 +160,28 @@ class FStatusBar : public FWindow
int x_msg; int x_msg;
private: private:
// Disable copy constructor
FStatusBar (const FStatusBar&); FStatusBar (const FStatusBar&);
// Disable assignment operator (=)
FStatusBar& operator = (const FStatusBar&); FStatusBar& operator = (const FStatusBar&);
void init(); void init();
void draw(); void draw();
void drawKeys(); void drawKeys();
public: public:
explicit FStatusBar (FWidget* = 0); // constructor // Constructor
virtual ~FStatusBar(); // destructor explicit FStatusBar (FWidget* = 0);
virtual const char* getClassName() const; // Destructor
virtual ~FStatusBar();
virtual const char* getClassName() const;
void hide();
// Event handlers
void onMouseDown (FMouseEvent*); void onMouseDown (FMouseEvent*);
void onMouseUp (FMouseEvent*); void onMouseUp (FMouseEvent*);
void onMouseMove (FMouseEvent*); void onMouseMove (FMouseEvent*);
void hide();
uInt count() const; uInt count() const;
FStatusKey* key (int) const; FStatusKey* key (int) const;
@ -189,6 +203,8 @@ class FStatusBar : public FWindow
void clear(); void clear();
void adjustSize(); void adjustSize();
// Callback method
void cb_statuskey_activated (FWidget*, void*); void cb_statuskey_activated (FWidget*, void*);
}; };
#pragma pack(pop) #pragma pack(pop)

View File

@ -82,13 +82,14 @@ class FString
wchar_t* extractToken (wchar_t**, const wchar_t*, const wchar_t*); wchar_t* extractToken (wchar_t**, const wchar_t*, const wchar_t*);
public: public:
FString (); // constructor // Constructors
explicit FString (int); // constructor FString ();
explicit FString (uInt); // constructor explicit FString (int);
FString (int, wchar_t); // constructor explicit FString (uInt);
FString (uInt, wchar_t); // constructor FString (int, wchar_t);
FString (int, char); // constructor FString (uInt, wchar_t);
FString (uInt, char); // constructor FString (int, char);
FString (uInt, char);
FString (const FString&); // implicit conversion constructor FString (const FString&); // implicit conversion constructor
FString (const std::wstring&); // implicit conversion constructor FString (const std::wstring&); // implicit conversion constructor
FString (const wchar_t*); // implicit conversion constructor FString (const wchar_t*); // implicit conversion constructor
@ -96,7 +97,8 @@ class FString
FString (const char*); // implicit conversion constructor FString (const char*); // implicit conversion constructor
FString (const wchar_t); // implicit conversion constructor FString (const wchar_t); // implicit conversion constructor
FString (const char); // implicit conversion constructor FString (const char); // implicit conversion constructor
virtual ~FString (); // destructor // Destructor
virtual ~FString ();
bool isNull() const; bool isNull() const;
bool isEmpty() const; bool isEmpty() const;

View File

@ -45,20 +45,28 @@ class FSwitch : public FToggleButton
bool button_pressed; bool button_pressed;
private: private:
// Disable copy constructor
FSwitch (const FSwitch&); FSwitch (const FSwitch&);
// Disable assignment operator (=)
FSwitch& operator = (const FSwitch&); FSwitch& operator = (const FSwitch&);
void draw(); void draw();
void drawCheckButton(); void drawCheckButton();
public: public:
explicit FSwitch (FWidget* = 0); // constructor // Constructors
FSwitch (const FString&, FWidget* = 0); // constructor explicit FSwitch (FWidget* = 0);
virtual ~FSwitch(); // destructor FSwitch (const FString&, FWidget* = 0);
// Destructor
virtual ~FSwitch();
const char* getClassName() const; const char* getClassName() const;
void setText (FString);
// Event handlers
void onKeyPress (FKeyEvent*); void onKeyPress (FKeyEvent*);
void onMouseDown (FMouseEvent*); void onMouseDown (FMouseEvent*);
void onMouseUp (FMouseEvent*); void onMouseUp (FMouseEvent*);
void setText (FString);
}; };
#pragma pack(pop) #pragma pack(pop)

View File

@ -164,7 +164,7 @@ class FTerm
static bool resize_term; static bool resize_term;
static char exit_message[8192]; static char exit_message[8192];
static struct termios term_init; static struct termios term_init;
static FOptiAttr::char_data term_attribute; static FOptiAttr::char_data term_attribute;
static FOptiAttr::char_data next_attribute; static FOptiAttr::char_data next_attribute;
@ -248,7 +248,9 @@ class FTerm
term_area* vwin; // virtual window term_area* vwin; // virtual window
private: private:
// Disable copy constructor
FTerm (const FTerm&); FTerm (const FTerm&);
// Disable assignment operator (=)
FTerm& operator = (const FTerm&); FTerm& operator = (const FTerm&);
static void outb_Attribute_Controller (int, int); static void outb_Attribute_Controller (int, int);
@ -309,8 +311,10 @@ class FTerm
FOptiAttr::char_data getOverlappedCharacter (int, int, FTerm*); FOptiAttr::char_data getOverlappedCharacter (int, int, FTerm*);
public: public:
FTerm (); // constructor // Constructor
virtual ~FTerm(); // destructor FTerm ();
// Destructor
virtual ~FTerm();
virtual const char* getClassName() const; virtual const char* getClassName() const;
FTerm::term_area* getVWin() const; FTerm::term_area* getVWin() const;

View File

@ -50,13 +50,17 @@ class FTextView : public FWidget
uInt maxLineWidth; uInt maxLineWidth;
private: private:
// Disable copy constructor
FTextView (const FTextView&); FTextView (const FTextView&);
// Disable assignment operator (=)
FTextView& operator = (const FTextView&); FTextView& operator = (const FTextView&);
void init(); void init();
void draw(); void draw();
void drawText(); void drawText();
void processChanged(); void processChanged();
// Callback methods
void cb_VBarChange (FWidget*, void*); void cb_VBarChange (FWidget*, void*);
void cb_HBarChange (FWidget*, void*); void cb_HBarChange (FWidget*, void*);
@ -64,12 +68,15 @@ class FTextView : public FWidget
void adjustSize(); void adjustSize();
public: public:
explicit FTextView (FWidget* = 0); // constructor // Constructor
~FTextView(); // destructor explicit FTextView (FWidget* = 0);
const char* getClassName() const; // Destructor
~FTextView();
const char* getClassName() const;
void hide(); void hide();
// Event handlers
void onKeyPress (FKeyEvent*); void onKeyPress (FKeyEvent*);
void onMouseDown (FMouseEvent*); void onMouseDown (FMouseEvent*);
void onMouseUp (FMouseEvent*); void onMouseUp (FMouseEvent*);
@ -77,6 +84,7 @@ class FTextView : public FWidget
void onWheel (FWheelEvent*); void onWheel (FWheelEvent*);
void onFocusIn (FFocusEvent*); void onFocusIn (FFocusEvent*);
void onFocusOut (FFocusEvent*); void onFocusOut (FFocusEvent*);
// make every setGeometry from FWidget available // make every setGeometry from FWidget available
using FWidget::setGeometry; using FWidget::setGeometry;
void setGeometry (int, int, int, int, bool = true); void setGeometry (int, int, int, int, bool = true);

View File

@ -48,8 +48,11 @@ class FToggleButton : public FWidget
FButtonGroup* button_group; FButtonGroup* button_group;
private: private:
// Disable copy constructor
FToggleButton (const FToggleButton&); FToggleButton (const FToggleButton&);
// Disable assignment operator (=)
FToggleButton& operator = (const FToggleButton&); FToggleButton& operator = (const FToggleButton&);
void init(); void init();
friend class FButtonGroup; friend class FButtonGroup;
void setGroup (FButtonGroup*); void setGroup (FButtonGroup*);
@ -67,16 +70,19 @@ class FToggleButton : public FWidget
virtual void onKeyPress (FKeyEvent*); virtual void onKeyPress (FKeyEvent*);
public: public:
explicit FToggleButton (FWidget* = 0); // constructor // Constructors
FToggleButton (const FString&, FWidget* = 0); // constructor explicit FToggleButton (FWidget* = 0);
virtual ~FToggleButton(); // destructor FToggleButton (const FString&, FWidget* = 0);
virtual const char* getClassName() const; // Destructor
virtual ~FToggleButton();
virtual const char* getClassName() const;
void hide(); void hide();
// make every setGeometry from FWidget available // make every setGeometry from FWidget available
using FWidget::setGeometry; using FWidget::setGeometry;
void setGeometry (int, int, int, int, bool = true); void setGeometry (int, int, int, int, bool = true);
// Event handlers
void onMouseDown (FMouseEvent*); void onMouseDown (FMouseEvent*);
void onMouseUp (FMouseEvent*); void onMouseUp (FMouseEvent*);
void onAccel (FAccelEvent*); void onAccel (FAccelEvent*);
@ -87,7 +93,6 @@ class FToggleButton : public FWidget
bool setNoUnderline (bool); bool setNoUnderline (bool);
bool setNoUnderline(); bool setNoUnderline();
bool unsetNoUnderline(); bool unsetNoUnderline();
bool setEnable (bool); bool setEnable (bool);
bool setEnable(); bool setEnable();
bool unsetEnable(); bool unsetEnable();

View File

@ -967,6 +967,18 @@ 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()
{ {
@ -1918,7 +1930,7 @@ void FWidget::move (int x, int y)
return; return;
// Avoid to move widget completely outside the terminal // Avoid to move widget completely outside the terminal
if ( x+getWidth() < 1 || x > term->getWidth() || y < 1 || y > term->getHeight() ) if ( x+getWidth()-1 < 1 || x > getMaxWidth() || y < 1 || y > getMaxHeight() )
return; return;
wsize.setPos(x,y); wsize.setPos(x,y);

View File

@ -311,8 +311,11 @@ class FWidget : public FObject, public FTerm
friend class FToggleButton; friend class FToggleButton;
private: private:
// Disable copy constructor
FWidget (const FWidget&); FWidget (const FWidget&);
// Disable assignment operator (=)
FWidget& operator = (const FWidget&); FWidget& operator = (const FWidget&);
void init(); void init();
void finish(); void finish();
void processDestroy(); void processDestroy();
@ -326,7 +329,7 @@ class FWidget : public FObject, public FTerm
void adjustSizeGlobal(); void adjustSizeGlobal();
virtual void setStatusBar (FStatusBar*); virtual void setStatusBar (FStatusBar*);
virtual void setMenuBar (FMenuBar*); virtual void setMenuBar (FMenuBar*);
// Event handlers // Event handlers
bool event (FEvent*); bool event (FEvent*);
virtual void onKeyPress (FKeyEvent*); virtual void onKeyPress (FKeyEvent*);
virtual void onKeyUp (FKeyEvent*); virtual void onKeyUp (FKeyEvent*);
@ -343,13 +346,15 @@ class FWidget : public FObject, public FTerm
virtual void onShow (FShowEvent*); virtual void onShow (FShowEvent*);
virtual void onHide (FHideEvent*); virtual void onHide (FHideEvent*);
virtual void onClose (FCloseEvent*); virtual void onClose (FCloseEvent*);
// Change child focus // Change child focus
virtual bool focusNextChild(); virtual bool focusNextChild();
virtual bool focusPrevChild(); virtual bool focusPrevChild();
public: public:
explicit FWidget (FWidget* = 0); // constructor // Constructor
~FWidget(); // destructor explicit FWidget (FWidget* = 0);
// Destructor
~FWidget();
const char* getClassName() const; const char* getClassName() const;
FWidget* getRootWidget() const; FWidget* getRootWidget() const;
@ -363,6 +368,8 @@ class FWidget : public FObject, public FTerm
static void setClickedWidget(FWidget*); static void setClickedWidget(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;

View File

@ -53,21 +53,26 @@ class FWindow : public FWidget
static FWindow* previous_widget; static FWindow* previous_widget;
private: private:
// Disable copy constructor
FWindow (const FWindow&); FWindow (const FWindow&);
// Disable assignment operator (=)
FWindow& operator = (const FWindow&); FWindow& operator = (const FWindow&);
protected: protected:
// Event handlers // Event handlers
bool event (FEvent*); bool event (FEvent*);
virtual void onWindowActive (FEvent*); virtual void onWindowActive (FEvent*);
virtual void onWindowInactive (FEvent*); virtual void onWindowInactive (FEvent*);
virtual void onWindowRaised (FEvent*); virtual void onWindowRaised (FEvent*);
virtual void onWindowLowered (FEvent*); virtual void onWindowLowered (FEvent*);
virtual void adjustSize(); virtual void adjustSize();
public: public:
explicit FWindow (FWidget* = 0); // constructor // Constructor
~FWindow (); // destructor explicit FWindow (FWidget* = 0);
// Destructor
~FWindow ();
const char* getClassName() const; const char* getClassName() const;
virtual void show(); virtual void show();

View File

@ -25,11 +25,16 @@ const lDouble PI = 3.141592653589793238L;
class Button : public FButton class Button : public FButton
{ {
private: private:
bool checked; bool checked;
public: public:
explicit Button (FWidget* = 0); // constructor // Constructor
explicit Button (FWidget* = 0);
void setChecked(bool); void setChecked(bool);
// Event handler
void onKeyPress (FKeyEvent*); void onKeyPress (FKeyEvent*);
}; };
#pragma pack(pop) #pragma pack(pop)
@ -159,11 +164,17 @@ class Calc : public FDialog
void adjustSize(); void adjustSize();
public: public:
explicit Calc (FWidget* parent=0); // constructor // Constructor
~Calc(); // destructor explicit Calc (FWidget* parent=0);
// Destructor
~Calc();
// Event handlers
void onKeyPress (FKeyEvent*); void onKeyPress (FKeyEvent*);
void onAccel (FAccelEvent*); void onAccel (FAccelEvent*);
void onClose (FCloseEvent*); void onClose (FCloseEvent*);
// Callback method
void cb_buttonClicked (FWidget*, void*); void cb_buttonClicked (FWidget*, void*);
}; };
#pragma pack(pop) #pragma pack(pop)

View File

@ -9,10 +9,14 @@
class keyboard : public FWidget class keyboard : public FWidget
{ {
public: public:
// Constructor
explicit keyboard (FWidget* = 0); explicit keyboard (FWidget* = 0);
protected: protected:
// Event handlers
void onKeyPress (FKeyEvent*); void onKeyPress (FKeyEvent*);
void onAccel (FAccelEvent*); void onAccel (FAccelEvent*);
void draw(); void draw();
}; };

View File

@ -18,8 +18,12 @@ class Mandelbrot : public FDialog
void adjustSize(); void adjustSize();
public: public:
explicit Mandelbrot (FWidget* = 0); // constructor // Constructor
~Mandelbrot(); // destructor explicit Mandelbrot (FWidget* = 0);
// Destructor
~Mandelbrot();
// Callback methods
void onAccel (FAccelEvent*); void onAccel (FAccelEvent*);
void onClose (FCloseEvent*); void onClose (FCloseEvent*);
}; };

View File

@ -21,17 +21,27 @@
class Menu : public FDialog class Menu : public FDialog
{ {
private: private:
Menu (const Menu&); // Disabled copy constructor // Disable copy constructor
Menu& operator = (const Menu&); // and operator '=' Menu (const Menu&);
// Disable assignment operator (=)
Menu& operator = (const Menu&);
void defaultCallback (FMenuList*); void defaultCallback (FMenuList*);
// Event handler
void onClose (FCloseEvent*); void onClose (FCloseEvent*);
// Callback methods
void cb_message (FWidget*, void*); void cb_message (FWidget*, void*);
void cb_exitApp (FWidget*, void*); void cb_exitApp (FWidget*, void*);
void adjustSize(); void adjustSize();
public: public:
explicit Menu (FWidget* = 0); // constructor // Constructor
~Menu(); // destructor explicit Menu (FWidget* = 0);
// Destructor
~Menu();
}; };
#pragma pack(pop) #pragma pack(pop)

View File

@ -22,16 +22,25 @@ class AttribDlg : public FDialog
short bgcolor; short bgcolor;
private: private:
AttribDlg (const AttribDlg&); // Disabled copy constructor // Disable copy constructor
AttribDlg& operator = (const AttribDlg&); // and operator '=' AttribDlg (const AttribDlg&);
// Disable assignment operator (=)
AttribDlg& operator = (const AttribDlg&);
void adjustSize(); void adjustSize();
public: public:
explicit AttribDlg (FWidget* = 0); // constructor // Constructor
~AttribDlg(); // destructor explicit AttribDlg (FWidget* = 0);
// Destructor
~AttribDlg();
// Event handlers
void onAccel (FAccelEvent*); void onAccel (FAccelEvent*);
void onWheel (FWheelEvent*); void onWheel (FWheelEvent*);
void onClose (FCloseEvent*); void onClose (FCloseEvent*);
// Callback methods
void cb_next (FWidget* = 0, void* = 0); void cb_next (FWidget* = 0, void* = 0);
void cb_back (FWidget* = 0, void* = 0); void cb_back (FWidget* = 0, void* = 0);
}; };
@ -173,9 +182,13 @@ class AttribDemo : public FWidget
void draw(); void draw();
public: public:
explicit AttribDemo (FWidget* = 0); // constructor // Constructor
~AttribDemo() // destructor explicit AttribDemo (FWidget* = 0);
// Destructor
~AttribDemo()
{ } { }
// Event handler
void onWheel (FWheelEvent* ev) void onWheel (FWheelEvent* ev)
{ {
AttribDlg* p = dynamic_cast<AttribDlg*>(getParentWidget()); AttribDlg* p = dynamic_cast<AttribDlg*>(getParentWidget());

View File

@ -9,10 +9,14 @@
class timer : public FWidget class timer : public FWidget
{ {
public: public:
// Constructor
explicit timer (FWidget* = 0); explicit timer (FWidget* = 0);
protected: protected:
// Event handlers
void onTimer (FTimerEvent*); void onTimer (FTimerEvent*);
void onAccel (FAccelEvent*); void onAccel (FAccelEvent*);
void draw(); void draw();
}; };

View File

@ -29,14 +29,21 @@ class Transparent : public FDialog
trans_type type; trans_type type;
private: private:
Transparent (const Transparent&); // Disabled copy constructor // Disable copy constructor
Transparent& operator = (const Transparent&); // and operator '=' Transparent (const Transparent&);
// Disable assignment operator (=)
Transparent& operator = (const Transparent&);
void draw(); void draw();
// Event handlers
void onKeyPress (FKeyEvent* ev); void onKeyPress (FKeyEvent* ev);
public: public:
explicit Transparent (FWidget* = 0, trans_type = transparent); // constructor // Constructor
~Transparent(); // destructor explicit Transparent (FWidget* = 0, trans_type = transparent);
// Destructor
~Transparent();
}; };
#pragma pack(pop) #pragma pack(pop)
@ -122,9 +129,14 @@ class MainWindow : public FDialog
FString line2; FString line2;
private: private:
MainWindow (const MainWindow&); // Disabled copy constructor // Disable copy constructor
MainWindow& operator = (const MainWindow&); // and operator '=' MainWindow (const MainWindow&);
// Disable assignment operator (=)
MainWindow& operator = (const MainWindow&);
void draw(); void draw();
// Event handlers
void onClose (FCloseEvent*); void onClose (FCloseEvent*);
void onShow (FShowEvent*); void onShow (FShowEvent*);
void onTimer (FTimerEvent*); void onTimer (FTimerEvent*);
@ -138,8 +150,10 @@ class MainWindow : public FDialog
} }
public: public:
explicit MainWindow (FWidget* = 0); // constructor // Constructor
~MainWindow(); // destructor explicit MainWindow (FWidget* = 0);
// Destructor
~MainWindow();
}; };
#pragma pack(pop) #pragma pack(pop)

View File

@ -22,18 +22,25 @@ class ProgressDialog : public FDialog
FButton* quit; FButton* quit;
private: private:
ProgressDialog (const ProgressDialog&); // Disabled copy constructor // Disable copy constructor
ProgressDialog& operator = (const ProgressDialog&); // and operator '=' ProgressDialog (const ProgressDialog&);
// Disable assignment operator (=)
ProgressDialog& operator = (const ProgressDialog&);
// Event handlers
void onShow (FShowEvent*); void onShow (FShowEvent*);
void onTimer (FTimerEvent*); void onTimer (FTimerEvent*);
// Callback methods
void cb_reset_bar (FWidget*, void*); void cb_reset_bar (FWidget*, void*);
void cb_more_bar (FWidget*, void*); void cb_more_bar (FWidget*, void*);
void cb_exit_bar (FWidget*, void*); void cb_exit_bar (FWidget*, void*);
public: public:
explicit ProgressDialog (FWidget* = 0); // constructor // Constructor
~ProgressDialog(); // destructor explicit ProgressDialog (FWidget* = 0);
// Destructor
~ProgressDialog();
}; };
#pragma pack(pop) #pragma pack(pop)
@ -167,13 +174,18 @@ class TextWindow : public FDialog
FTextView* scrollText; FTextView* scrollText;
private: private:
TextWindow (const TextWindow&); // Disabled copy constructor // Disable copy constructor
TextWindow& operator = (const TextWindow&); // and operator '=' TextWindow (const TextWindow&);
// Disable assignment operator (=)
TextWindow& operator = (const TextWindow&);
void adjustSize(); void adjustSize();
public: public:
explicit TextWindow (FWidget* = 0); // constructor // Constructor
~TextWindow(); // destructor explicit TextWindow (FWidget* = 0);
// Destructor
~TextWindow();
void append (const FString&); void append (const FString&);
}; };
@ -232,10 +244,15 @@ class MyDialog : public FDialog
FString clipboard; FString clipboard;
private: private:
MyDialog (const MyDialog&); // Disabled copy constructor // Disable copy constructor
MyDialog& operator = (const MyDialog&); // and operator '=' MyDialog (const MyDialog&);
// Disable assignment operator (=)
MyDialog& operator = (const MyDialog&);
// Event handlers
void onClose (FCloseEvent*); void onClose (FCloseEvent*);
// Callback methods
void cb_noFunctionMsg (FWidget*, void*); void cb_noFunctionMsg (FWidget*, void*);
void cb_about (FWidget*, void*); void cb_about (FWidget*, void*);
void cb_terminfo (FWidget*, void*); void cb_terminfo (FWidget*, void*);
@ -252,11 +269,14 @@ class MyDialog : public FDialog
void cb_view (FWidget*, void*); void cb_view (FWidget*, void*);
void cb_setInput (FWidget*, void*); void cb_setInput (FWidget*, void*);
void cb_exitApp (FWidget*, void*); void cb_exitApp (FWidget*, void*);
void adjustSize(); void adjustSize();
public: public:
explicit MyDialog (FWidget* = 0); // constructor // Constructor
~MyDialog(); // destructor explicit MyDialog (FWidget* = 0);
// Destructor
~MyDialog();
}; };
#pragma pack(pop) #pragma pack(pop)

View File

@ -27,15 +27,24 @@ class watch : public FDialog
FSwitch* seconds_sw; FSwitch* seconds_sw;
private: private:
watch (const watch&); // Disabled copy constructor // Disable copy constructor
watch& operator = (const watch&); // and operator '=' watch (const watch&);
// Disable assignment operator (=)
watch& operator = (const watch&);
public: public:
explicit watch (FWidget* = 0); // constructor // Constructor
~watch(); // destructor explicit watch (FWidget* = 0);
// Destructor
~watch();
void printTime(); void printTime();
// Event handlers
void onTimer (FTimerEvent*); void onTimer (FTimerEvent*);
void onClose (FCloseEvent*); void onClose (FCloseEvent*);
// Callback methods
void cb_clock (FWidget*, void*); void cb_clock (FWidget*, void*);
void cb_seconds (FWidget*, void*); void cb_seconds (FWidget*, void*);
void cb_exitApp (FWidget*, void*); void cb_exitApp (FWidget*, void*);

View File

@ -27,15 +27,22 @@ class smallWindow : public FDialog
FLabel* bottom_label; FLabel* bottom_label;
private: private:
smallWindow (const smallWindow&); // Disabled copy constructor // Disable copy constructor
smallWindow& operator = (const smallWindow&); // and operator '=' smallWindow (const smallWindow&);
// Disable assignment operator (=)
smallWindow& operator = (const smallWindow&);
void adjustSize(); void adjustSize();
// Event handlers
void onShow (FShowEvent*); void onShow (FShowEvent*);
void onTimer (FTimerEvent*); void onTimer (FTimerEvent*);
public: public:
explicit smallWindow (FWidget* = 0); // constructor // Constructor
~smallWindow(); // destructor explicit smallWindow (FWidget* = 0);
// Destructor
~smallWindow();
void append (const FString&); void append (const FString&);
}; };
@ -50,13 +57,26 @@ smallWindow::smallWindow (FWidget* parent)
, top_right_label() , top_right_label()
, bottom_label() , bottom_label()
{ {
left_arrow = new FLabel ("\u25b2", this); wchar_t arrow_up, arrow_down;
if ( isCygwinTerminal() )
{
arrow_up = L'^';
arrow_down = L'v';
}
else
{
arrow_up = fc::BlackUpPointingTriangle;
arrow_down = fc::BlackDownPointingTriangle;
}
left_arrow = new FLabel (arrow_up, this);
left_arrow->setForegroundColor (wc.label_inactive_fg); left_arrow->setForegroundColor (wc.label_inactive_fg);
left_arrow->setEmphasis(); left_arrow->setEmphasis();
left_arrow->ignorePadding(); left_arrow->ignorePadding();
left_arrow->setGeometry (2, 2, 1, 1); left_arrow->setGeometry (2, 2, 1, 1);
right_arrow = new FLabel ("\u25b2", this); right_arrow = new FLabel (arrow_up, this);
right_arrow->setForegroundColor (wc.label_inactive_fg); right_arrow->setForegroundColor (wc.label_inactive_fg);
right_arrow->setEmphasis(); right_arrow->setEmphasis();
right_arrow->ignorePadding(); right_arrow->ignorePadding();
@ -76,8 +96,8 @@ smallWindow::smallWindow (FWidget* parent)
top_right_label->setGeometry (getClientWidth() - 5, 1, 6, 1); top_right_label->setGeometry (getClientWidth() - 5, 1, 6, 1);
FString bottom_label_text = "resize\n" FString bottom_label_text = "resize\n"
"corner\n" "corner\n";
"\u25bc"; bottom_label_text += arrow_down;
bottom_label = new FLabel (bottom_label_text, this); bottom_label = new FLabel (bottom_label_text, this);
bottom_label->setAlignment (fc::alignRight); bottom_label->setAlignment (fc::alignRight);
bottom_label->setForegroundColor (wc.label_inactive_fg); bottom_label->setForegroundColor (wc.label_inactive_fg);
@ -155,21 +175,31 @@ class Window : public FDialog
std::vector<win_data*> windows; std::vector<win_data*> windows;
private: private:
Window (const Window&); // Disabled copy constructor // Disable copy constructor
Window& operator = (const Window&); // and operator '=' Window (const Window&);
// Disable assignment operator (=)
Window& operator = (const Window&);
void activateWindow (FDialog*); void activateWindow (FDialog*);
// Event handlers
void onClose (FCloseEvent*); void onClose (FCloseEvent*);
// Callback methods
void cb_createWindows (FWidget*, void*); void cb_createWindows (FWidget*, void*);
void cb_closeWindows (FWidget*, void*); void cb_closeWindows (FWidget*, void*);
void cb_next (FWidget*, void*); void cb_next (FWidget*, void*);
void cb_previous (FWidget*, void*); void cb_previous (FWidget*, void*);
void cb_exitApp (FWidget*, void*); void cb_exitApp (FWidget*, void*);
void cb_destroyWindow (FWidget*, void*); void cb_destroyWindow (FWidget*, void*);
void adjustSize(); void adjustSize();
public: public:
explicit Window (FWidget* = 0); // constructor // Constructor
~Window(); // destructor explicit Window (FWidget* = 0);
// Destructor
~Window();
}; };
#pragma pack(pop) #pragma pack(pop)
@ -489,6 +519,7 @@ void Window::cb_exitApp (FWidget*, void*)
void Window::cb_destroyWindow (FWidget*, void* data_ptr) void Window::cb_destroyWindow (FWidget*, void* data_ptr)
{ {
win_data* win_dat = static_cast<win_data*>(data_ptr); win_data* win_dat = static_cast<win_data*>(data_ptr);
if ( win_dat ) if ( win_dat )
win_dat->is_open = false; win_dat->is_open = false;
} }