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>
* The size is now dynamically changeable with the mouse
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)
int FApplication::quit_code = 0;
bool FApplication::quit_now = false;
bool FApplication::move_size_mode = false; // move/size by keyboard
std::deque<FApplication::eventPair>* FApplication::event_queue = 0;
//----------------------------------------------------------------------
@ -248,10 +249,15 @@ void FApplication::processKeyboardEvent()
FWidget* widget = 0;
if ( focus_widget )
widget = static_cast<FWidget*>(focus_widget);
{
if ( move_size_mode )
widget = FWindow::getWindowWidget(focus_widget);
else
widget = focus_widget;
}
else
{
widget = static_cast<FWidget*>(main_widget);
widget = main_widget;
if ( widget->numOfChildren() >= 1 )
widget->focusFirstChild();
@ -436,7 +442,7 @@ void FApplication::processKeyboardEvent()
// windows keyboard accelerator
if ( ! accpt )
{
FWidget* window = static_cast<FWidget*>(active_window);
FWidget* window = active_window;
if ( window )
accpt = processAccelerator (window);
@ -773,6 +779,8 @@ bool FApplication::processDialogSwitchAccelerator()
if ( s > 0 && s >= n )
{
// unset the move/size mode
setMoveSizeMode(false);
FAccelEvent a_ev (fc::Accelerator_Event, focus_widget);
sendEvent (dialog_list->at(n-1), &a_ev);
return true;
@ -802,6 +810,8 @@ bool FApplication::processAccelerator (FWidget*& widget)
if ( iter->key == key )
{
// unset the move/size mode
setMoveSizeMode(false);
FAccelEvent a_ev (fc::Accelerator_Event, focus_widget);
sendEvent (iter->object, &a_ev);
accpt = a_ev.isAccepted();
@ -1407,6 +1417,9 @@ void FApplication::processMouseEvent()
FWidget* child = childWidgetAt (window, *mouse);
clicked_widget = (child != 0) ? child : window;
}
// unset the move/size mode
setMoveSizeMode(false);
}
// close the open menu

View File

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

View File

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

View File

@ -44,8 +44,11 @@ class FButtonGroup : public FWidget
FButtonGroup::FButtonList buttonlist;
private:
// Disable copy constructor
FButtonGroup (const FButtonGroup&);
// Disable assignment operator (=)
FButtonGroup& operator = (const FButtonGroup&);
void init();
bool isRadioButton(FToggleButton*) const;
void directFocus();
@ -57,17 +60,21 @@ class FButtonGroup : public FWidget
void drawLabel();
public:
explicit FButtonGroup (FWidget* = 0); // constructor
FButtonGroup (const FString&, FWidget* = 0); // constructor
virtual ~FButtonGroup(); // destructor
const char* getClassName() const;
// Constructors
explicit FButtonGroup (FWidget* = 0);
FButtonGroup (const FString&, FWidget* = 0);
// Destructor
virtual ~FButtonGroup();
const char* getClassName() const;
void hide();
FToggleButton* getFirstButton();
FToggleButton* getLastButton();
bool hasFocusedButton();
bool hasCheckedButton();
// Event handlers
void onMouseDown (FMouseEvent*);
void onAccel (FAccelEvent*);
void onFocusIn (FFocusEvent*);
@ -76,6 +83,7 @@ class FButtonGroup : public FWidget
void insert (FToggleButton*);
void remove (FToggleButton*);
// Callback method
void cb_buttonToggled (FWidget*, void*);
bool setEnable(bool);

View File

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

View File

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

View File

@ -20,9 +20,10 @@ FDialog::FDialog(FWidget* parent)
, zoom_button_active(false)
, titlebar_click_pos()
, resize_click_pos()
, old_geometry()
, save_geometry()
, dialog_menu()
, dgl_menuitem()
, move_size_item()
, zoom_item()
, close_item()
{
@ -38,9 +39,10 @@ FDialog::FDialog (const FString& txt, FWidget* parent)
, zoom_button_active(false)
, titlebar_click_pos()
, resize_click_pos()
, old_geometry()
, save_geometry()
, dialog_menu()
, dgl_menuitem()
, move_size_item()
, zoom_item()
, close_item()
{
@ -133,6 +135,16 @@ void FDialog::init()
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);
setZoomItem();
zoom_item->setDisable();
@ -161,10 +173,10 @@ void FDialog::drawBorder()
int y1 = 2;
int y2 = 1 + getHeight() - 1;
if ( resize_click_pos.isNull() || isZoomed() )
setColor();
else
if ( (getMoveSizeMode() || ! resize_click_pos.isNull()) && ! isZoomed() )
setColor (wc.dialog_resize_fg, getBackgroundColor());
else
setColor();
if ( isNewFont() )
{
@ -278,7 +290,7 @@ void FDialog::drawTitleBar()
else
setColor (wc.titlebar_inactive_fg, wc.titlebar_inactive_bg);
if ( (flags & fc::resizeable) == 0 )
if ( ! isResizeable() )
zoom_btn = 0;
else if ( isNewFont() )
zoom_btn = 2;
@ -312,7 +324,7 @@ void FDialog::drawTitleBar()
unsetBold();
// draw the zoom/unzoom button
if ( (flags & fc::resizeable) != 0 )
if ( isResizeable() )
{
if ( zoom_button_pressed )
setColor (wc.titlebar_button_focus_fg, wc.titlebar_button_focus_bg);
@ -457,14 +469,35 @@ void FDialog::setZoomItem()
{
zoom_item->setText ("&Unzoom");
zoom_item->setStatusbarMessage ("Restore the window size");
move_size_item->setDisable();
}
else
{
zoom_item->setText ("&Zoom");
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*)
@ -584,7 +617,7 @@ void FDialog::onKeyPress (FKeyEvent* ev)
if ( ! isEnabled() )
return;
// cancel resize
// cancel resize by mouse
if ( ! resize_click_pos.isNull() )
{
resize_click_pos.setPoint (0,0);
@ -601,6 +634,90 @@ void FDialog::onKeyPress (FKeyEvent* ev)
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() )
return;
@ -621,9 +738,9 @@ void FDialog::onMouseDown (FMouseEvent* ev)
{
int mouse_x = ev->getX();
int mouse_y = ev->getY();
int zoom_btn;
int zoom_btn;;
if ( (flags & fc::resizeable) == 0 )
if ( ! isResizeable() )
zoom_btn = 0;
else if ( isNewFont() )
zoom_btn = 2;
@ -732,7 +849,7 @@ void FDialog::onMouseUp (FMouseEvent* ev)
{
int zoom_btn;
if ( (flags & fc::resizeable) == 0 )
if ( ! isResizeable() )
zoom_btn = 0;
else if ( isNewFont() )
zoom_btn = 2;
@ -831,7 +948,7 @@ void FDialog::onMouseMove (FMouseEvent* ev)
{
int zoom_btn;
if ( (flags & fc::resizeable) == 0 )
if ( ! isResizeable() )
zoom_btn = 0;
else if ( isNewFont() )
zoom_btn = 2;
@ -916,16 +1033,14 @@ void FDialog::onMouseMove (FMouseEvent* ev)
void FDialog::onMouseDoubleClick (FMouseEvent* ev)
{
int x, y, mouse_x, mouse_y, zoom_btn;
bool is_resizeable;
if ( ev->getButton() != fc::LeftButton )
return;
mouse_x = ev->getX();
mouse_y = ev->getY();
is_resizeable = bool(flags & fc::resizeable);
if ( ! is_resizeable )
if ( ! isResizeable() )
zoom_btn = 0;
else if ( isNewFont() )
zoom_btn = 2;
@ -957,7 +1072,7 @@ void FDialog::onMouseDoubleClick (FMouseEvent* ev)
else
close();
}
else if ( is_resizeable
else if ( isResizeable()
&& mouse_x >= 4
&& mouse_x <= getWidth() - zoom_btn
&& mouse_y == 1 )
@ -1122,6 +1237,7 @@ void FDialog::move (const FPoint& pos)
void FDialog::move (int x, int y)
{
int dx, dy, old_x, old_y, rsw, bsh, width, height;
FRect old_geometry;
if ( getX() == x && getY() == y )
return;
@ -1130,7 +1246,7 @@ void FDialog::move (int x, int y)
height = getHeight();
// 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;
if ( isZoomed() )

View File

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

View File

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

View File

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

View File

@ -78,6 +78,7 @@ class FFileDialog : public FDialog
Open = 0,
Save = 1
};
private:
DIR* directory_stream;
std::vector<dir_entry> dir_entries;
@ -100,6 +101,8 @@ class FFileDialog : public FDialog
int numOfDirs();
int changeDir (const FString&);
void printPath (const FString&);
// Callback methods
void cb_processActivate (FWidget*, void*);
void cb_processRowChanged (FWidget*, void*);
void cb_processClicked (FWidget*, void*);
@ -111,16 +114,22 @@ class FFileDialog : public FDialog
void adjustSize();
public:
// Constructors
explicit FFileDialog (FWidget* = 0);
FFileDialog (const FFileDialog&); // copy constructor
FFileDialog ( const FString&
, const FString&
, DialogType = FFileDialog::Open
, FWidget* = 0 );
// Destructor
~FFileDialog();
FFileDialog& operator = (const FFileDialog&); // assignment
// Assignment operator (=)
FFileDialog& operator = (const FFileDialog&);
const char* getClassName() const;
// Event handler
void onKeyPress (FKeyEvent*);
const FString getPath() const;

View File

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

View File

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

View File

@ -45,11 +45,14 @@ class FListBoxItem
bool selected;
public:
// Constructors
FListBoxItem ();
explicit FListBoxItem (FString&);
explicit FListBoxItem (const std::string&);
explicit FListBoxItem (const char*);
// Destructor
virtual ~FListBoxItem();
virtual FString getText() const;
protected:
@ -120,8 +123,11 @@ class FListBox : public FWidget
int max_line_width;
private:
// Disable copy constructor
FListBox (const FListBox&);
// Disable assignment operator (=)
FListBox& operator = (const FListBox&);
void init();
void draw();
void drawLabel();
@ -135,12 +141,15 @@ class FListBox : public FWidget
void adjustSize();
public:
explicit FListBox (FWidget* = 0); // constructor
~FListBox(); // destructor
const char* getClassName() const;
// Constructor
explicit FListBox (FWidget* = 0);
// Destructor
~FListBox();
const char* getClassName() const;
void hide();
// Event handlers
void onKeyPress (FKeyEvent*);
void onMouseDown (FMouseEvent*);
void onMouseUp (FMouseEvent*);
@ -151,8 +160,10 @@ class FListBox : public FWidget
void onFocusIn (FFocusEvent*);
void onFocusOut (FFocusEvent*);
// Callback methods
void cb_VBarChange (FWidget*, void*);
void cb_HBarChange (FWidget*, void*);
uInt count() const;
FListBoxItem Item (int) const;
int currentItem() const;

View File

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

View File

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

View File

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

View File

@ -37,14 +37,18 @@ class FMenuList
std::vector<FMenuItem*> item_list;
private:
// Disable copy constructor
FMenuList (const FMenuList&);
// Disable assignment operator (=)
FMenuList& operator = (const FMenuList&);
public:
// Constructor
explicit FMenuList();
// Destructor
virtual ~FMenuList();
virtual const char* getClassName() const;
virtual const char* getClassName() const;
uInt count() const;
FMenuItem* item (int) const;
void enableItem (int);
@ -55,7 +59,6 @@ class FMenuList
FMenuItem* getSelectedItem() const;
void setSelectedItem (FMenuItem*);
bool hasSelectedItem() const;
virtual void insert (FMenuItem*);
virtual void remove (FMenuItem*);
void remove (int);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -358,6 +358,30 @@ void FStatusBar::drawKeys()
// 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)
{
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()
{

View File

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

View File

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

View File

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

View File

@ -248,7 +248,9 @@ class FTerm
term_area* vwin; // virtual window
private:
// Disable copy constructor
FTerm (const FTerm&);
// Disable assignment operator (=)
FTerm& operator = (const FTerm&);
static void outb_Attribute_Controller (int, int);
@ -309,8 +311,10 @@ class FTerm
FOptiAttr::char_data getOverlappedCharacter (int, int, FTerm*);
public:
FTerm (); // constructor
virtual ~FTerm(); // destructor
// Constructor
FTerm ();
// Destructor
virtual ~FTerm();
virtual const char* getClassName() const;
FTerm::term_area* getVWin() const;

View File

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

View File

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

View File

@ -967,6 +967,18 @@ void FWidget::setOpenMenu(FWidget* 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()
{
@ -1918,7 +1930,7 @@ void FWidget::move (int x, int y)
return;
// 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;
wsize.setPos(x,y);

View File

@ -311,8 +311,11 @@ class FWidget : public FObject, public FTerm
friend class FToggleButton;
private:
// Disable copy constructor
FWidget (const FWidget&);
// Disable assignment operator (=)
FWidget& operator = (const FWidget&);
void init();
void finish();
void processDestroy();
@ -348,8 +351,10 @@ class FWidget : public FObject, public FTerm
virtual bool focusPrevChild();
public:
explicit FWidget (FWidget* = 0); // constructor
~FWidget(); // destructor
// Constructor
explicit FWidget (FWidget* = 0);
// Destructor
~FWidget();
const char* getClassName() const;
FWidget* getRootWidget() const;
@ -363,6 +368,8 @@ class FWidget : public FObject, public FTerm
static void setClickedWidget(FWidget*);
static FWidget* getOpenMenu();
static void setOpenMenu(FWidget*);
static bool getMoveSizeMode();
static void setMoveSizeMode (bool);
int numOfFocusableChildren();
FWidget* getParentWidget() const;
bool isRootWidget() const;

View File

@ -53,7 +53,9 @@ class FWindow : public FWidget
static FWindow* previous_widget;
private:
// Disable copy constructor
FWindow (const FWindow&);
// Disable assignment operator (=)
FWindow& operator = (const FWindow&);
protected:
@ -63,11 +65,14 @@ class FWindow : public FWidget
virtual void onWindowInactive (FEvent*);
virtual void onWindowRaised (FEvent*);
virtual void onWindowLowered (FEvent*);
virtual void adjustSize();
public:
explicit FWindow (FWidget* = 0); // constructor
~FWindow (); // destructor
// Constructor
explicit FWindow (FWidget* = 0);
// Destructor
~FWindow ();
const char* getClassName() const;
virtual void show();

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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