FListBox saves data pointer in FListBoxItems

This commit is contained in:
Markus Gans 2017-02-24 00:30:07 +01:00
parent b35d225ff5
commit 7c11ba1707
36 changed files with 195 additions and 168 deletions

View File

@ -1,3 +1,7 @@
2017-02-24 Markus Gans <guru.mail@muenster.de>
* FListBox gets the option to save a data pointer for
every FListBoxItem element
2017-02-19 Markus Gans <guru.mail@muenster.de>
* New FWidget methods setMinimumWidth(), setMinimumHeight(),
setMaximumWidth() and setMaximumHeight()

View File

@ -326,7 +326,7 @@ void FButtonGroup::onFocusIn (FFocusEvent* in_ev)
}
//----------------------------------------------------------------------
void FButtonGroup::cb_buttonToggled (FWidget* widget, void*)
void FButtonGroup::cb_buttonToggled (FWidget* widget, data_ptr)
{
FToggleButton* button = static_cast<FToggleButton*>(widget);
FObjectList::const_iterator iter, end;

View File

@ -79,7 +79,7 @@ class FButtonGroup : public FScrollView
void onFocusIn (FFocusEvent*);
// Callback method
void cb_buttonToggled (FWidget*, void*);
void cb_buttonToggled (FWidget*, data_ptr);
protected:
// Accessor

View File

@ -1443,7 +1443,7 @@ void FDialog::delDialog (FWidget* obj)
}
//----------------------------------------------------------------------
void FDialog::cb_move (FWidget*, void*)
void FDialog::cb_move (FWidget*, data_ptr)
{
if ( isZoomed() )
return;
@ -1485,7 +1485,7 @@ void FDialog::cb_move (FWidget*, void*)
}
//----------------------------------------------------------------------
void FDialog::cb_zoom (FWidget*, void*)
void FDialog::cb_zoom (FWidget*, data_ptr)
{
dialog_menu->unselectItem();
dialog_menu->hide();
@ -1496,7 +1496,7 @@ void FDialog::cb_zoom (FWidget*, void*)
}
//----------------------------------------------------------------------
void FDialog::cb_close (FWidget*, void*)
void FDialog::cb_close (FWidget*, data_ptr)
{
dialog_menu->unselectItem();
dialog_menu->hide();

View File

@ -146,9 +146,9 @@ class FDialog : public FWindow
static void delDialog (FWidget*);
// Callback methods
void cb_move (FWidget*, void*);
void cb_zoom (FWidget*, void*);
void cb_close (FWidget*, void*);
void cb_move (FWidget*, data_ptr);
void cb_zoom (FWidget*, data_ptr);
void cb_close (FWidget*, data_ptr);
// Data Members
FString tb_text; // title bar text

View File

@ -719,7 +719,7 @@ void FFileDialog::printPath (const FString& txt)
}
//----------------------------------------------------------------------
void FFileDialog::cb_processActivate (FWidget*, void*)
void FFileDialog::cb_processActivate (FWidget*, data_ptr)
{
if ( filename->getText().includes('*')
|| filename->getText().includes('?') )
@ -770,7 +770,7 @@ void FFileDialog::cb_processActivate (FWidget*, void*)
}
//----------------------------------------------------------------------
void FFileDialog::cb_processRowChanged (FWidget*, void*)
void FFileDialog::cb_processRowChanged (FWidget*, data_ptr)
{
int n = filebrowser->currentItem();
@ -788,7 +788,7 @@ void FFileDialog::cb_processRowChanged (FWidget*, void*)
}
//----------------------------------------------------------------------
void FFileDialog::cb_processClicked (FWidget*, void*)
void FFileDialog::cb_processClicked (FWidget*, data_ptr)
{
uLong n = uLong(filebrowser->currentItem() - 1);
@ -799,19 +799,19 @@ void FFileDialog::cb_processClicked (FWidget*, void*)
}
//----------------------------------------------------------------------
void FFileDialog::cb_processCancel (FWidget*, void*)
void FFileDialog::cb_processCancel (FWidget*, data_ptr)
{
done (FDialog::Reject);
}
//----------------------------------------------------------------------
void FFileDialog::cb_processOpen (FWidget*, void*)
void FFileDialog::cb_processOpen (FWidget*, data_ptr)
{
done (FDialog::Accept);
}
//----------------------------------------------------------------------
void FFileDialog::cb_processShowHidden (FWidget*, void*)
void FFileDialog::cb_processShowHidden (FWidget*, data_ptr)
{
setShowHiddenFiles(not show_hidden);
}

View File

@ -137,12 +137,12 @@ class FFileDialog : public FDialog
void printPath (const FString&);
// Callback methods
void cb_processActivate (FWidget*, void*);
void cb_processRowChanged (FWidget*, void*);
void cb_processClicked (FWidget*, void*);
void cb_processCancel (FWidget*, void*);
void cb_processOpen (FWidget*, void*);
void cb_processShowHidden (FWidget*, void*);
void cb_processActivate (FWidget*, data_ptr);
void cb_processRowChanged (FWidget*, data_ptr);
void cb_processClicked (FWidget*, data_ptr);
void cb_processCancel (FWidget*, data_ptr);
void cb_processOpen (FWidget*, data_ptr);
void cb_processShowHidden (FWidget*, data_ptr);
// Data Members
DIR* directory_stream;

View File

@ -246,7 +246,7 @@ void FLabel::onAccel (FAccelEvent* ev)
}
//----------------------------------------------------------------------
void FLabel::cb_accel_widget_destroyed (FWidget*, void*)
void FLabel::cb_accel_widget_destroyed (FWidget*, data_ptr)
{
accel_widget = 0;
delAccelerator();

View File

@ -82,7 +82,7 @@ class FLabel : public FWidget
void onAccel (FAccelEvent*);
// Callback method
void cb_accel_widget_destroyed (FWidget*, void*);
void cb_accel_widget_destroyed (FWidget*, data_ptr);
private:
// Typedef

View File

@ -16,27 +16,31 @@
//----------------------------------------------------------------------
FListBoxItem::FListBoxItem()
: text()
, data_pointer(0)
, brackets(fc::NoBrackets)
, selected(false)
{ }
//----------------------------------------------------------------------
FListBoxItem::FListBoxItem (FString& txt)
FListBoxItem::FListBoxItem (FString& txt, FWidget::data_ptr data)
: text(txt)
, data_pointer(data)
, brackets(fc::NoBrackets)
, selected(false)
{ }
//----------------------------------------------------------------------
FListBoxItem::FListBoxItem (const std::string& txt)
FListBoxItem::FListBoxItem (const std::string& txt, FWidget::data_ptr data)
: text(txt)
, data_pointer(data)
, brackets(fc::NoBrackets)
, selected(false)
{ }
//----------------------------------------------------------------------
FListBoxItem::FListBoxItem (const char* txt)
FListBoxItem::FListBoxItem (const char* txt, FWidget::data_ptr data)
: text(txt)
, data_pointer(data)
, brackets(fc::NoBrackets)
, selected(false)
{ }
@ -249,7 +253,8 @@ void FListBox::hide()
//----------------------------------------------------------------------
void FListBox::insert ( FString item
, fc::brackets_type b
, bool s )
, bool s
, data_ptr d )
{
int len, element_count;
@ -273,6 +278,7 @@ void FListBox::insert ( FString item
}
}
FListBoxItem listItem (item);
listItem.data_pointer = d;
listItem.brackets = b;
listItem.selected = s;
data.push_back (listItem);
@ -289,9 +295,10 @@ void FListBox::insert ( FString item
//----------------------------------------------------------------------
void FListBox::insert ( long item
, fc::brackets_type b
, bool s )
, bool s
, data_ptr d )
{
insert (FString().setNumber(item), b, s);
insert (FString().setNumber(item), b, s, d);
}
//----------------------------------------------------------------------
@ -1155,7 +1162,7 @@ void FListBox::onFocusOut (FFocusEvent*)
}
//----------------------------------------------------------------------
void FListBox::cb_VBarChange (FWidget*, void*)
void FListBox::cb_VBarChange (FWidget*, data_ptr)
{
FScrollbar::sType scrollType;
int distance = 1;
@ -1262,7 +1269,7 @@ void FListBox::cb_VBarChange (FWidget*, void*)
}
//----------------------------------------------------------------------
void FListBox::cb_HBarChange (FWidget*, void*)
void FListBox::cb_HBarChange (FWidget*, data_ptr)
{
FScrollbar::sType scrollType;
int distance = 1;

View File

@ -47,9 +47,9 @@ class FListBoxItem
public:
// Constructors
FListBoxItem ();
explicit FListBoxItem (FString&);
explicit FListBoxItem (const std::string&);
explicit FListBoxItem (const char*);
explicit FListBoxItem (FString&, FWidget::data_ptr = 0);
explicit FListBoxItem (const std::string&, FWidget::data_ptr = 0);
explicit FListBoxItem (const char*, FWidget::data_ptr = 0);
// Destructor
virtual ~FListBoxItem();
@ -61,6 +61,7 @@ class FListBoxItem
void setText (FString&);
void setText (const std::string&);
void setText (const char*);
void setData (FWidget::data_ptr);
private:
// Friend classes
@ -68,6 +69,7 @@ class FListBoxItem
// Data Members
FString text;
FWidget::data_ptr data_pointer;
fc::brackets_type brackets;
bool selected;
};
@ -91,6 +93,10 @@ inline void FListBoxItem::setText (const std::string& txt)
inline void FListBoxItem::setText (const char* txt)
{ text = txt; }
//----------------------------------------------------------------------
inline void FListBoxItem::setData (FWidget::data_ptr data)
{ data_pointer = data; }
//----------------------------------------------------------------------
// class FListBox
@ -146,10 +152,12 @@ class FListBox : public FWidget
void hide();
void insert ( FString
, fc::brackets_type = fc::NoBrackets
, bool = false );
, bool = false
, data_ptr = 0);
void insert ( long
, fc::brackets_type = fc::NoBrackets
, bool = false );
, bool = false
, data_ptr = 0 );
void remove (int);
void clear();
@ -165,8 +173,8 @@ class FListBox : public FWidget
void onFocusOut (FFocusEvent*);
// Callback methods
void cb_VBarChange (FWidget*, void*);
void cb_HBarChange (FWidget*, void*);
void cb_VBarChange (FWidget*, data_ptr);
void cb_HBarChange (FWidget*, data_ptr);
protected:
// Methods

View File

@ -698,7 +698,7 @@ void FMenu::onMouseMove (FMouseEvent* ev)
}
//----------------------------------------------------------------------
void FMenu::cb_menuitem_toggled (FWidget* widget, void*)
void FMenu::cb_menuitem_toggled (FWidget* widget, data_ptr)
{
FMenuItem* menuitem = static_cast<FMenuItem*>(widget);
std::vector<FMenuItem*>::const_iterator iter, end;

View File

@ -99,7 +99,7 @@ class FMenu : public FWindow, public FMenuList
void onAccel (FAccelEvent*);
// Callback method
void cb_menuitem_toggled (FWidget*, void*);
void cb_menuitem_toggled (FWidget*, data_ptr);
private:
// Disable copy constructor

View File

@ -446,7 +446,7 @@ void FMenuBar::onAccel (FAccelEvent* ev)
}
//----------------------------------------------------------------------
void FMenuBar::cb_item_deactivated (FWidget* widget, void*)
void FMenuBar::cb_item_deactivated (FWidget* widget, data_ptr)
{
FMenuItem* menuitem = static_cast<FMenuItem*>(widget);

View File

@ -72,7 +72,7 @@ class FMenuBar : public FWindow, public FMenuList
void onAccel (FAccelEvent*);
// Callback methods
void cb_item_deactivated (FWidget*, void*);
void cb_item_deactivated (FWidget*, data_ptr);
private:
// Disable copy constructor

View File

@ -878,9 +878,9 @@ void FMenuItem::createDialogList (FMenu* winmenu)
}
//----------------------------------------------------------------------
void FMenuItem::cb_switchToDialog (FWidget*, void* data_ptr)
void FMenuItem::cb_switchToDialog (FWidget*, data_ptr data)
{
FDialog* win = static_cast<FDialog*>(data_ptr);
FDialog* win = static_cast<FDialog*>(data);
if ( win )
{
@ -891,7 +891,7 @@ void FMenuItem::cb_switchToDialog (FWidget*, void* data_ptr)
}
//----------------------------------------------------------------------
void FMenuItem::cb_destroyDialog (FWidget* widget, void*)
void FMenuItem::cb_destroyDialog (FWidget* widget, data_ptr)
{
FDialog* win = static_cast<FDialog*>(widget);
FApplication* fapp = static_cast<FApplication*>(getRootWidget());

View File

@ -153,8 +153,8 @@ class FMenuItem : public FWidget
void createDialogList (FMenu*);
// Callback methods
void cb_switchToDialog (FWidget*, void*);
void cb_destroyDialog (FWidget*, void*);
void cb_switchToDialog (FWidget*, data_ptr);
void cb_destroyDialog (FWidget*, data_ptr);
virtual void processClicked();

View File

@ -281,9 +281,9 @@ void FMessageBox::adjustSize()
}
//----------------------------------------------------------------------
void FMessageBox::cb_processClick (FWidget*, void* data_ptr)
void FMessageBox::cb_processClick (FWidget*, data_ptr data)
{
int* reply = static_cast<int*>(data_ptr);
int* reply = static_cast<int*>(data);
done (*reply);
}

View File

@ -123,7 +123,7 @@ class FMessageBox : public FDialog
void adjustSize();
// Callback method
void cb_processClick (FWidget*, void*);
void cb_processClick (FWidget*, data_ptr);
private:
// Typedef

View File

@ -240,6 +240,12 @@ void FScrollView::setGeometry (int x, int y, int w, int h, bool adjust)
}
}
//----------------------------------------------------------------------
void FScrollView::setCursorPos (register int x, register int y)
{
FWidget::setCursorPos (x + getLeftPadding(), y + getTopPadding());
}
//----------------------------------------------------------------------
void FScrollView::setPrintPos (register int x, register int y)
{
@ -844,7 +850,7 @@ void FScrollView::setVerticalScrollBarVisibility()
}
//----------------------------------------------------------------------
void FScrollView::cb_VBarChange (FWidget*, void*)
void FScrollView::cb_VBarChange (FWidget*, data_ptr)
{
FScrollbar::sType scrollType;
bool hasChanges = false;
@ -949,7 +955,7 @@ void FScrollView::cb_VBarChange (FWidget*, void*)
}
//----------------------------------------------------------------------
void FScrollView::cb_HBarChange (FWidget*, void*)
void FScrollView::cb_HBarChange (FWidget*, data_ptr)
{
FScrollbar::sType scrollType;
bool hasChanges = false;

View File

@ -75,6 +75,7 @@ class FScrollView : public FWidget
virtual void setHeight (int, bool = true);
virtual void setSize (int, int, bool = true);
void setGeometry (int, int, int, int, bool = true);
void setCursorPos (register int, register int);
void setPrintPos (register int, register int);
bool setViewportPrint (bool);
bool setViewportPrint();
@ -138,8 +139,8 @@ class FScrollView : public FWidget
void drawVBar();
// Callback methods
void cb_VBarChange (FWidget*, void*);
void cb_HBarChange (FWidget*, void*);
void cb_VBarChange (FWidget*, data_ptr);
void cb_HBarChange (FWidget*, data_ptr);
// Data Members
FRect scroll_geometry;

View File

@ -534,7 +534,7 @@ void FStatusBar::onMouseMove (FMouseEvent* ev)
}
//----------------------------------------------------------------------
void FStatusBar::cb_statuskey_activated (FWidget* widget, void*)
void FStatusBar::cb_statuskey_activated (FWidget* widget, data_ptr)
{
if ( ! key_list.empty() )
{

View File

@ -220,7 +220,7 @@ class FStatusBar : public FWindow
void onMouseMove (FMouseEvent*);
// Callback method
void cb_statuskey_activated (FWidget*, void*);
void cb_statuskey_activated (FWidget*, data_ptr);
private:
// Typedef

View File

@ -746,7 +746,7 @@ void FTextView::processChanged()
}
//----------------------------------------------------------------------
void FTextView::cb_VBarChange (FWidget*, void*)
void FTextView::cb_VBarChange (FWidget*, data_ptr)
{
FScrollbar::sType scrollType;
int distance = 1;
@ -837,7 +837,7 @@ void FTextView::cb_VBarChange (FWidget*, void*)
}
//----------------------------------------------------------------------
void FTextView::cb_HBarChange (FWidget*, void*)
void FTextView::cb_HBarChange (FWidget*, data_ptr)
{
FScrollbar::sType scrollType;
int distance = 1;

View File

@ -105,8 +105,8 @@ class FTextView : public FWidget
void processChanged();
// Callback methods
void cb_VBarChange (FWidget*, void*);
void cb_HBarChange (FWidget*, void*);
void cb_VBarChange (FWidget*, data_ptr);
void cb_HBarChange (FWidget*, data_ptr);
// Data Members
stringLines data;

View File

@ -668,14 +668,17 @@ void FWidget::setGeometry (int x, int y, int w, int h, bool adjust)
bool FWidget::setCursorPos (register int x, register int y)
{
// sets the input cursor position
widget_cursor_position.setPoint(x,y);
if ( (flags & fc::focus) != 0 && ! isWindowWidget() )
{
if ( (flags & fc::focus) == 0 || isWindowWidget() )
return false;
FWidget* window = FWindow::getWindowWidget(this);
if ( window )
{
if ( ! window )
return false;
if ( term_area* area = window->getVWin() )
{
setAreaCursor ( getTermX() - window->getTermX() + x
@ -684,8 +687,6 @@ bool FWidget::setCursorPos (register int x, register int y)
, area );
return true;
}
}
}
return false;
}

View File

@ -107,9 +107,9 @@ class FWidget : public FVTerm
// Typedefs
typedef std::vector<FWidget*> widgetList;
typedef void (*FCallback)(FWidget*, void*);
typedef void (FWidget::*FMemberCallback)(FWidget*, void*);
typedef void* data_ptr;
typedef void (*FCallback)(FWidget*, data_ptr);
typedef void (FWidget::*FMemberCallback)(FWidget*, data_ptr);
typedef std::vector<accelerator> Accelerators;
// Constructor
@ -242,11 +242,11 @@ class FWidget : public FVTerm
void clearStatusbarMessage();
void addCallback ( FString
, FCallback
, void* = null );
, data_ptr = null );
void addCallback ( FString
, FWidget*
, FMemberCallback
, void* = null );
, data_ptr = null );
void delCallback (FCallback);
void delCallback (FWidget*);
void delCallbacks();

View File

@ -106,7 +106,7 @@ class Calc : public FDialog
void onClose (FCloseEvent*);
// Callback method
void cb_buttonClicked (FWidget*, void*);
void cb_buttonClicked (FWidget*, data_ptr);
private:
// Methods
@ -570,7 +570,7 @@ void Calc::onClose (FCloseEvent* ev)
}
//----------------------------------------------------------------------
void Calc::cb_buttonClicked (FWidget*, void* data_ptr)
void Calc::cb_buttonClicked (FWidget*, data_ptr data)
{
int key;
lDouble* x;
@ -582,7 +582,7 @@ void Calc::cb_buttonClicked (FWidget*, void* data_ptr)
else
x = &a;
key = *(static_cast<int*>(data_ptr));
key = *(static_cast<int*>(data));
switch ( key )
{

View File

@ -6,14 +6,14 @@
#include "flabel.h"
// function prototype
void cb_quit (FWidget*, void*);
void cb_quit (FWidget*, FWidget::data_ptr);
//----------------------------------------------------------------------
// callback function
//----------------------------------------------------------------------
void cb_quit (FWidget*, void* data_ptr)
void cb_quit (FWidget*, FWidget::data_ptr data)
{
FApplication* app = static_cast<FApplication*>(data_ptr);
FApplication* app = static_cast<FApplication*>(data);
app->quit();
}

View File

@ -9,22 +9,22 @@
#include "fradiobutton.h"
// function prototypes
void cb_quit (FWidget*, void*);
void cb_publish (FWidget*, void*);
void cb_quit (FWidget*, FWidget::data_ptr);
void cb_publish (FWidget*, FWidget::data_ptr);
//----------------------------------------------------------------------
// callback functions
//----------------------------------------------------------------------
void cb_quit (FWidget*, void* data_ptr)
void cb_quit (FWidget*, FWidget::data_ptr data)
{
FApplication* app = static_cast<FApplication*>(data_ptr);
FApplication* app = static_cast<FApplication*>(data);
app->quit();
}
void cb_publish (FWidget* widget, void* data_ptr)
void cb_publish (FWidget* widget, FWidget::data_ptr data)
{
FCheckBox* cbox1 = static_cast<FCheckBox*>(widget);
FCheckBox* cbox2 = static_cast<FCheckBox*>(data_ptr);
FCheckBox* cbox2 = static_cast<FCheckBox*>(data);
if ( cbox1->isChecked() )
cbox2->setEnable();

View File

@ -42,8 +42,8 @@ class Menu : public FDialog
void onClose (FCloseEvent*);
// Callback methods
void cb_message (FWidget*, void*);
void cb_exitApp (FWidget*, void*);
void cb_message (FWidget*, data_ptr);
void cb_exitApp (FWidget*, data_ptr);
};
#pragma pack(pop)
@ -257,7 +257,7 @@ void Menu::onClose (FCloseEvent* ev)
}
//----------------------------------------------------------------------
void Menu::cb_message (FWidget* widget, void*)
void Menu::cb_message (FWidget* widget, data_ptr)
{
FMenuItem* menuitem = static_cast<FMenuItem*>(widget);
FString text = menuitem->getText();
@ -266,7 +266,7 @@ void Menu::cb_message (FWidget* widget, void*)
}
//----------------------------------------------------------------------
void Menu::cb_exitApp (FWidget*, void*)
void Menu::cb_exitApp (FWidget*, data_ptr)
{
close();
}

View File

@ -27,8 +27,8 @@ class AttribDlg : public FDialog
void onClose (FCloseEvent*);
// Callback methods
void cb_next (FWidget* = 0, void* = 0);
void cb_back (FWidget* = 0, void* = 0);
void cb_next (FWidget* = 0, data_ptr = 0);
void cb_back (FWidget* = 0, data_ptr = 0);
// Data Members
short bgcolor;
@ -121,7 +121,7 @@ void AttribDlg::onClose (FCloseEvent* ev)
}
//----------------------------------------------------------------------
void AttribDlg::cb_next (FWidget*, void*)
void AttribDlg::cb_next (FWidget*, data_ptr)
{
if ( isMonochron() )
return;
@ -135,7 +135,7 @@ void AttribDlg::cb_next (FWidget*, void*)
}
//----------------------------------------------------------------------
void AttribDlg::cb_back (FWidget*, void*)
void AttribDlg::cb_back (FWidget*, data_ptr)
{
if ( isMonochron() )
return;

View File

@ -32,9 +32,9 @@ class ProgressDialog : public FDialog
void onTimer (FTimerEvent*);
// Callback methods
void cb_reset_bar (FWidget*, void*);
void cb_more_bar (FWidget*, void*);
void cb_exit_bar (FWidget*, void*);
void cb_reset_bar (FWidget*, data_ptr);
void cb_more_bar (FWidget*, data_ptr);
void cb_exit_bar (FWidget*, data_ptr);
// Data Members
FProgressbar* progressBar;
@ -142,20 +142,20 @@ void ProgressDialog::onTimer (FTimerEvent*)
}
//----------------------------------------------------------------------
void ProgressDialog::cb_reset_bar (FWidget*, void*)
void ProgressDialog::cb_reset_bar (FWidget*, data_ptr)
{
progressBar->reset();
}
//----------------------------------------------------------------------
void ProgressDialog::cb_more_bar (FWidget*, void*)
void ProgressDialog::cb_more_bar (FWidget*, data_ptr)
{
int p = progressBar->getPercentage();
progressBar->setPercentage(++p);
}
//----------------------------------------------------------------------
void ProgressDialog::cb_exit_bar (FWidget*, void*)
void ProgressDialog::cb_exit_bar (FWidget*, data_ptr)
{
close();
}
@ -257,22 +257,22 @@ class MyDialog : public FDialog
void onClose (FCloseEvent*);
// Callback methods
void cb_noFunctionMsg (FWidget*, void*);
void cb_about (FWidget*, void*);
void cb_terminfo (FWidget*, void*);
void cb_drives (FWidget*, void*);
void cb_cutClipboard (FWidget*, void*);
void cb_copyClipboard (FWidget*, void*);
void cb_pasteClipboard (FWidget*, void*);
void cb_clearInput (FWidget*, void*);
void cb_input2buttonText (FWidget*, void*);
void cb_setTitlebar (FWidget*, void*);
void cb_ProgressBar (FWidget*, void*);
void cb_updateNumber (FWidget*, void*);
void cb_activateButton (FWidget*, void*);
void cb_view (FWidget*, void*);
void cb_setInput (FWidget*, void*);
void cb_exitApp (FWidget*, void*);
void cb_noFunctionMsg (FWidget*, data_ptr);
void cb_about (FWidget*, data_ptr);
void cb_terminfo (FWidget*, data_ptr);
void cb_drives (FWidget*, data_ptr);
void cb_cutClipboard (FWidget*, data_ptr);
void cb_copyClipboard (FWidget*, data_ptr);
void cb_pasteClipboard (FWidget*, data_ptr);
void cb_clearInput (FWidget*, data_ptr);
void cb_input2buttonText (FWidget*, data_ptr);
void cb_setTitlebar (FWidget*, data_ptr);
void cb_ProgressBar (FWidget*, data_ptr);
void cb_updateNumber (FWidget*, data_ptr);
void cb_activateButton (FWidget*, data_ptr);
void cb_view (FWidget*, data_ptr);
void cb_setInput (FWidget*, data_ptr);
void cb_exitApp (FWidget*, data_ptr);
// Data Members
FLineEdit* myLineEdit;
@ -660,7 +660,7 @@ void MyDialog::onClose (FCloseEvent* ev)
}
//----------------------------------------------------------------------
void MyDialog::cb_noFunctionMsg (FWidget* widget, void*)
void MyDialog::cb_noFunctionMsg (FWidget* widget, data_ptr)
{
FButton* button = static_cast<FButton*>(widget);
FString text = button->getText();
@ -670,7 +670,7 @@ void MyDialog::cb_noFunctionMsg (FWidget* widget, void*)
}
//----------------------------------------------------------------------
void MyDialog::cb_about (FWidget*, void*)
void MyDialog::cb_about (FWidget*, data_ptr)
{
const char libver[] = F_VERSION;
FString line(2, wchar_t(fc::BoxDrawingsHorizontal));
@ -685,7 +685,7 @@ void MyDialog::cb_about (FWidget*, void*)
}
//----------------------------------------------------------------------
void MyDialog::cb_terminfo (FWidget*, void*)
void MyDialog::cb_terminfo (FWidget*, data_ptr)
{
int x = getColumnNumber();
int y = getLineNumber();
@ -702,7 +702,7 @@ void MyDialog::cb_terminfo (FWidget*, void*)
}
//----------------------------------------------------------------------
void MyDialog::cb_drives (FWidget*, void*)
void MyDialog::cb_drives (FWidget*, data_ptr)
{
FMessageBox info2 ( "Drive symbols"
, "Generic: \n\n"
@ -749,7 +749,7 @@ void MyDialog::cb_drives (FWidget*, void*)
}
//----------------------------------------------------------------------
void MyDialog::cb_cutClipboard (FWidget*, void*)
void MyDialog::cb_cutClipboard (FWidget*, data_ptr)
{
if ( ! myLineEdit )
return;
@ -760,7 +760,7 @@ void MyDialog::cb_cutClipboard (FWidget*, void*)
}
//----------------------------------------------------------------------
void MyDialog::cb_copyClipboard (FWidget*, void*)
void MyDialog::cb_copyClipboard (FWidget*, data_ptr)
{
if ( ! myLineEdit )
return;
@ -769,7 +769,7 @@ void MyDialog::cb_copyClipboard (FWidget*, void*)
}
//----------------------------------------------------------------------
void MyDialog::cb_pasteClipboard (FWidget*, void*)
void MyDialog::cb_pasteClipboard (FWidget*, data_ptr)
{
if ( ! myLineEdit )
return;
@ -779,7 +779,7 @@ void MyDialog::cb_pasteClipboard (FWidget*, void*)
}
//----------------------------------------------------------------------
void MyDialog::cb_clearInput (FWidget*, void*)
void MyDialog::cb_clearInput (FWidget*, data_ptr)
{
if ( ! myLineEdit )
return;
@ -790,16 +790,16 @@ void MyDialog::cb_clearInput (FWidget*, void*)
}
//----------------------------------------------------------------------
void MyDialog::cb_input2buttonText (FWidget* widget, void* data_ptr)
void MyDialog::cb_input2buttonText (FWidget* widget, data_ptr data)
{
FButton* button = static_cast<FButton*>(widget);
FLineEdit* lineedit = static_cast<FLineEdit*>(data_ptr);
FLineEdit* lineedit = static_cast<FLineEdit*>(data);
button->setText( lineedit->getText() );
button->redraw();
}
//----------------------------------------------------------------------
void MyDialog::cb_setTitlebar (FWidget* widget, void*)
void MyDialog::cb_setTitlebar (FWidget* widget, data_ptr)
{
FLineEdit* lineedit = static_cast<FLineEdit*>(widget);
lineedit->setXTermTitle(lineedit->getText());
@ -808,17 +808,17 @@ void MyDialog::cb_setTitlebar (FWidget* widget, void*)
}
//----------------------------------------------------------------------
void MyDialog::cb_ProgressBar (FWidget*, void*)
void MyDialog::cb_ProgressBar (FWidget*, data_ptr)
{
ProgressDialog* p_dgl = new ProgressDialog(this);
p_dgl->show();
}
//----------------------------------------------------------------------
void MyDialog::cb_updateNumber (FWidget* widget, void* data_ptr)
void MyDialog::cb_updateNumber (FWidget* widget, data_ptr data)
{
FListBox* list = static_cast<FListBox*>(widget);
FLabel* num = static_cast<FLabel*>(data_ptr);
FLabel* num = static_cast<FLabel*>(data);
int select_num = 0;
uInt end = list->getCount();
@ -831,10 +831,10 @@ void MyDialog::cb_updateNumber (FWidget* widget, void* data_ptr)
}
//----------------------------------------------------------------------
void MyDialog::cb_activateButton (FWidget* widget, void* data_ptr)
void MyDialog::cb_activateButton (FWidget* widget, data_ptr data)
{
FRadioButton* rb = static_cast<FRadioButton*>(widget);
FButton* button = static_cast<FButton*>(data_ptr);
FButton* button = static_cast<FButton*>(data);
if ( rb->isChecked() )
button->setEnable();
@ -845,10 +845,10 @@ void MyDialog::cb_activateButton (FWidget* widget, void* data_ptr)
}
//----------------------------------------------------------------------
void MyDialog::cb_view (FWidget*, void* data_ptr)
void MyDialog::cb_view (FWidget*, data_ptr data)
{
FString file;
FMenuItem* item = static_cast<FMenuItem*>(data_ptr);
FMenuItem* item = static_cast<FMenuItem*>(data);
if ( item && item->getText() )
file = item->getText();
@ -884,16 +884,16 @@ void MyDialog::cb_view (FWidget*, void* data_ptr)
}
//----------------------------------------------------------------------
void MyDialog::cb_setInput (FWidget* widget, void* data_ptr)
void MyDialog::cb_setInput (FWidget* widget, data_ptr data)
{
FListBox* ListBox = static_cast<FListBox*>(widget);
FLineEdit* lineedit = static_cast<FLineEdit*>(data_ptr);
FLineEdit* lineedit = static_cast<FLineEdit*>(data);
lineedit->setText( ListBox->getItem(ListBox->currentItem()).getText() );
lineedit->redraw();
}
//----------------------------------------------------------------------
void MyDialog::cb_exitApp (FWidget*, void*)
void MyDialog::cb_exitApp (FWidget*, data_ptr)
{
close();
}

View File

@ -32,9 +32,9 @@ class watch : public FDialog
void onClose (FCloseEvent*);
// Callback methods
void cb_clock (FWidget*, void*);
void cb_seconds (FWidget*, void*);
void cb_exitApp (FWidget*, void*);
void cb_clock (FWidget*, data_ptr);
void cb_seconds (FWidget*, data_ptr);
void cb_exitApp (FWidget*, data_ptr);
protected:
// Method
@ -155,7 +155,7 @@ void watch::onClose (FCloseEvent* ev)
}
//----------------------------------------------------------------------
void watch::cb_clock (FWidget*, void*)
void watch::cb_clock (FWidget*, data_ptr)
{
if ( clock_sw->isChecked() )
{
@ -171,7 +171,7 @@ void watch::cb_clock (FWidget*, void*)
}
//----------------------------------------------------------------------
void watch::cb_seconds (FWidget*, void*)
void watch::cb_seconds (FWidget*, data_ptr)
{
if ( seconds_sw->isChecked() )
sec = true;
@ -191,7 +191,7 @@ void watch::cb_seconds (FWidget*, void*)
}
//----------------------------------------------------------------------
void watch::cb_exitApp (FWidget*, void*)
void watch::cb_exitApp (FWidget*, data_ptr)
{
close();
}

View File

@ -196,12 +196,12 @@ class Window : public FDialog
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 cb_createWindows (FWidget*, data_ptr);
void cb_closeWindows (FWidget*, data_ptr);
void cb_next (FWidget*, data_ptr);
void cb_previous (FWidget*, data_ptr);
void cb_exitApp (FWidget*, data_ptr);
void cb_destroyWindow (FWidget*, data_ptr);
// Data Members
std::vector<win_data*> windows;
@ -414,7 +414,7 @@ void Window::onClose (FCloseEvent* ev)
}
//----------------------------------------------------------------------
void Window::cb_createWindows (FWidget*, void*)
void Window::cb_createWindows (FWidget*, data_ptr)
{
int w,h,dx,dy;
std::vector<win_data*>::const_iterator iter, begin;
@ -457,7 +457,7 @@ void Window::cb_createWindows (FWidget*, void*)
}
//----------------------------------------------------------------------
void Window::cb_closeWindows (FWidget*, void*)
void Window::cb_closeWindows (FWidget*, data_ptr)
{
if ( ! dialog_list || dialog_list->empty() )
return;
@ -478,7 +478,7 @@ void Window::cb_closeWindows (FWidget*, void*)
}
//----------------------------------------------------------------------
void Window::cb_next (FWidget*, void*)
void Window::cb_next (FWidget*, data_ptr)
{
if ( ! dialog_list || dialog_list->empty() )
return;
@ -516,7 +516,7 @@ void Window::cb_next (FWidget*, void*)
}
//----------------------------------------------------------------------
void Window::cb_previous (FWidget*, void*)
void Window::cb_previous (FWidget*, data_ptr)
{
if ( ! dialog_list || dialog_list->empty() )
return;
@ -555,15 +555,15 @@ void Window::cb_previous (FWidget*, void*)
}
//----------------------------------------------------------------------
void Window::cb_exitApp (FWidget*, void*)
void Window::cb_exitApp (FWidget*, data_ptr)
{
close();
}
//----------------------------------------------------------------------
void Window::cb_destroyWindow (FWidget*, void* data_ptr)
void Window::cb_destroyWindow (FWidget*, data_ptr data)
{
win_data* win_dat = static_cast<win_data*>(data_ptr);
win_data* win_dat = static_cast<win_data*>(data);
if ( win_dat )
win_dat->is_open = false;