Adding a dialog list with the entries in the chronological order of the generation
This commit is contained in:
parent
9ef3bd3243
commit
ef201a1a33
|
@ -1,3 +1,7 @@
|
||||||
|
2016-07-14 Markus Gans <guru.mail@muenster.de>
|
||||||
|
* Adding a dialog list with the entries in the chronological
|
||||||
|
order of the generation
|
||||||
|
|
||||||
2016-07-13 Markus Gans <guru.mail@muenster.de>
|
2016-07-13 Markus Gans <guru.mail@muenster.de>
|
||||||
* Bind accelerator key from the FMenuItem to the root widget
|
* Bind accelerator key from the FMenuItem to the root widget
|
||||||
|
|
||||||
|
|
|
@ -52,6 +52,7 @@ FDialog::~FDialog() // destructor
|
||||||
accelerator_list = 0;
|
accelerator_list = 0;
|
||||||
activatePrevWindow();
|
activatePrevWindow();
|
||||||
delWindow(this);
|
delWindow(this);
|
||||||
|
delDialog(this);
|
||||||
fapp = static_cast<FApplication*>(getRootWidget());
|
fapp = static_cast<FApplication*>(getRootWidget());
|
||||||
|
|
||||||
if ( ! fapp->quit_now )
|
if ( ! fapp->quit_now )
|
||||||
|
@ -102,6 +103,7 @@ void FDialog::init()
|
||||||
ignore_padding = true;
|
ignore_padding = true;
|
||||||
window_object = true;
|
window_object = true;
|
||||||
dialog_object = true;
|
dialog_object = true;
|
||||||
|
addDialog(this);
|
||||||
addWindow(this);
|
addWindow(this);
|
||||||
setActiveWindow(this);
|
setActiveWindow(this);
|
||||||
|
|
||||||
|
@ -324,6 +326,36 @@ void FDialog::cb_close (FWidget*, void*)
|
||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
void FDialog::addDialog (FWidget* obj)
|
||||||
|
{
|
||||||
|
// add the dialog object obj to the dialog list
|
||||||
|
if ( dialog_list )
|
||||||
|
dialog_list->push_back(obj);
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
void FDialog::delDialog (FWidget* obj)
|
||||||
|
{
|
||||||
|
// delete the dialog object obj from the dialog list
|
||||||
|
if ( ! dialog_list || dialog_list->empty() )
|
||||||
|
return;
|
||||||
|
|
||||||
|
widgetList::iterator iter;
|
||||||
|
iter = dialog_list->begin();
|
||||||
|
|
||||||
|
while ( iter != dialog_list->end() )
|
||||||
|
{
|
||||||
|
if ( (*iter) == obj )
|
||||||
|
{
|
||||||
|
dialog_list->erase(iter);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
++iter;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// protected methods of FDialog
|
// protected methods of FDialog
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
|
@ -67,6 +67,8 @@ class FDialog : public FWindow
|
||||||
void drawTitleBar();
|
void drawTitleBar();
|
||||||
void leaveMenu();
|
void leaveMenu();
|
||||||
void cb_close (FWidget*, void*);
|
void cb_close (FWidget*, void*);
|
||||||
|
static void addDialog (FWidget*);
|
||||||
|
static void delDialog (FWidget*);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void done (int);
|
virtual void done (int);
|
||||||
|
|
|
@ -52,5 +52,5 @@ void FDialogListMenu::init()
|
||||||
FMenuItem* menuitem = getItem();
|
FMenuItem* menuitem = getItem();
|
||||||
|
|
||||||
if ( menuitem )
|
if ( menuitem )
|
||||||
menuitem->dialog_list = true;
|
menuitem->dialog_index = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,7 @@ FMenuItem::FMenuItem (FWidget* parent)
|
||||||
, checkable(false)
|
, checkable(false)
|
||||||
, checked(false)
|
, checked(false)
|
||||||
, radio_button(false)
|
, radio_button(false)
|
||||||
, dialog_list(false)
|
, dialog_index(false)
|
||||||
, text_length(0)
|
, text_length(0)
|
||||||
, hotkey(0)
|
, hotkey(0)
|
||||||
, accel_key(0)
|
, accel_key(0)
|
||||||
|
@ -42,7 +42,7 @@ FMenuItem::FMenuItem (FString& txt, FWidget* parent)
|
||||||
, checkable(false)
|
, checkable(false)
|
||||||
, checked(false)
|
, checked(false)
|
||||||
, radio_button(false)
|
, radio_button(false)
|
||||||
, dialog_list(false)
|
, dialog_index(false)
|
||||||
, text_length(0)
|
, text_length(0)
|
||||||
, hotkey(0)
|
, hotkey(0)
|
||||||
, accel_key(0)
|
, accel_key(0)
|
||||||
|
@ -61,7 +61,7 @@ FMenuItem::FMenuItem (const std::string& txt, FWidget* parent)
|
||||||
, checkable(false)
|
, checkable(false)
|
||||||
, checked(false)
|
, checked(false)
|
||||||
, radio_button(false)
|
, radio_button(false)
|
||||||
, dialog_list(false)
|
, dialog_index(false)
|
||||||
, text_length(0)
|
, text_length(0)
|
||||||
, hotkey(0)
|
, hotkey(0)
|
||||||
, accel_key(0)
|
, accel_key(0)
|
||||||
|
@ -80,7 +80,7 @@ FMenuItem::FMenuItem (const char* txt, FWidget* parent)
|
||||||
, checkable(false)
|
, checkable(false)
|
||||||
, checked(false)
|
, checked(false)
|
||||||
, radio_button(false)
|
, radio_button(false)
|
||||||
, dialog_list(false)
|
, dialog_index(false)
|
||||||
, text_length(0)
|
, text_length(0)
|
||||||
, hotkey(0)
|
, hotkey(0)
|
||||||
, accel_key(0)
|
, accel_key(0)
|
||||||
|
@ -99,7 +99,7 @@ FMenuItem::FMenuItem (int k, FString& txt, FWidget* parent)
|
||||||
, checkable(false)
|
, checkable(false)
|
||||||
, checked(false)
|
, checked(false)
|
||||||
, radio_button(false)
|
, radio_button(false)
|
||||||
, dialog_list(false)
|
, dialog_index(false)
|
||||||
, text_length(0)
|
, text_length(0)
|
||||||
, hotkey(0)
|
, hotkey(0)
|
||||||
, accel_key(k)
|
, accel_key(k)
|
||||||
|
@ -118,7 +118,7 @@ FMenuItem::FMenuItem (int k, const std::string& txt, FWidget* parent)
|
||||||
, checkable(false)
|
, checkable(false)
|
||||||
, checked(false)
|
, checked(false)
|
||||||
, radio_button(false)
|
, radio_button(false)
|
||||||
, dialog_list(false)
|
, dialog_index(false)
|
||||||
, text_length(0)
|
, text_length(0)
|
||||||
, hotkey(0)
|
, hotkey(0)
|
||||||
, accel_key(k)
|
, accel_key(k)
|
||||||
|
@ -137,7 +137,7 @@ FMenuItem::FMenuItem (int k, const char* txt, FWidget* parent)
|
||||||
, checkable(false)
|
, checkable(false)
|
||||||
, checked(false)
|
, checked(false)
|
||||||
, radio_button(false)
|
, radio_button(false)
|
||||||
, dialog_list(false)
|
, dialog_index(false)
|
||||||
, text_length(0)
|
, text_length(0)
|
||||||
, hotkey(0)
|
, hotkey(0)
|
||||||
, accel_key(k)
|
, accel_key(k)
|
||||||
|
@ -256,17 +256,14 @@ void FMenuItem::createDialogList (FMenu* winmenu)
|
||||||
{
|
{
|
||||||
winmenu->clear();
|
winmenu->clear();
|
||||||
|
|
||||||
if ( window_list && ! window_list->empty() )
|
if ( dialog_list && ! dialog_list->empty() )
|
||||||
{
|
{
|
||||||
widgetList::const_iterator iter, begin;
|
widgetList::const_iterator iter;
|
||||||
iter = window_list->end();
|
iter = dialog_list->begin();
|
||||||
begin = window_list->begin();
|
|
||||||
|
|
||||||
do
|
while ( iter != dialog_list->end() )
|
||||||
{
|
{
|
||||||
--iter;
|
if ( *iter && (*iter)->isDialog() )
|
||||||
|
|
||||||
if ( (*iter)->isDialog() )
|
|
||||||
{
|
{
|
||||||
FDialog* win = dynamic_cast<FDialog*>(*iter);
|
FDialog* win = dynamic_cast<FDialog*>(*iter);
|
||||||
|
|
||||||
|
@ -283,8 +280,9 @@ void FMenuItem::createDialogList (FMenu* winmenu)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
++iter;
|
||||||
}
|
}
|
||||||
while ( iter != begin );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
winmenu->menu_dimension();
|
winmenu->menu_dimension();
|
||||||
|
@ -837,7 +835,7 @@ void FMenuItem::openMenu()
|
||||||
open_menu->hideSubMenus();
|
open_menu->hideSubMenus();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( dialog_list )
|
if ( dialog_index )
|
||||||
createDialogList (dd_menu);
|
createDialogList (dd_menu);
|
||||||
|
|
||||||
setOpenMenu(dd_menu);
|
setOpenMenu(dd_menu);
|
||||||
|
|
|
@ -49,7 +49,7 @@ class FMenuItem : public FWidget
|
||||||
bool checkable;
|
bool checkable;
|
||||||
bool checked;
|
bool checked;
|
||||||
bool radio_button;
|
bool radio_button;
|
||||||
bool dialog_list;
|
bool dialog_index;
|
||||||
uInt text_length;
|
uInt text_length;
|
||||||
int hotkey;
|
int hotkey;
|
||||||
int accel_key;
|
int accel_key;
|
||||||
|
|
|
@ -18,6 +18,7 @@ FMenuBar* FWidget::menubar = 0;
|
||||||
FWidget* FWidget::show_root_widget = 0;
|
FWidget* FWidget::show_root_widget = 0;
|
||||||
FWidget* FWidget::redraw_root_widget = 0;
|
FWidget* FWidget::redraw_root_widget = 0;
|
||||||
FWidget::widgetList* FWidget::window_list = 0;
|
FWidget::widgetList* FWidget::window_list = 0;
|
||||||
|
FWidget::widgetList* FWidget::dialog_list = 0;
|
||||||
FWidget::widgetList* FWidget::close_widget = 0;
|
FWidget::widgetList* FWidget::close_widget = 0;
|
||||||
FWidget::widget_colors FWidget::wc;
|
FWidget::widget_colors FWidget::wc;
|
||||||
|
|
||||||
|
@ -127,6 +128,7 @@ FWidget::~FWidget() // destructor
|
||||||
void FWidget::init()
|
void FWidget::init()
|
||||||
{
|
{
|
||||||
window_list = new widgetList();
|
window_list = new widgetList();
|
||||||
|
dialog_list = new widgetList();
|
||||||
close_widget = new widgetList();
|
close_widget = new widgetList();
|
||||||
|
|
||||||
getTermGeometry(); // <-----.
|
getTermGeometry(); // <-----.
|
||||||
|
@ -178,6 +180,12 @@ void FWidget::finish()
|
||||||
close_widget = 0;
|
close_widget = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( dialog_list )
|
||||||
|
{
|
||||||
|
delete dialog_list;
|
||||||
|
dialog_list = 0;
|
||||||
|
}
|
||||||
|
|
||||||
if ( window_list )
|
if ( window_list )
|
||||||
{
|
{
|
||||||
delete window_list;
|
delete window_list;
|
||||||
|
|
|
@ -92,6 +92,7 @@ class FWidget : public FObject, public FTerm
|
||||||
public:
|
public:
|
||||||
typedef std::vector<FWidget*> widgetList;
|
typedef std::vector<FWidget*> widgetList;
|
||||||
static widgetList* window_list;
|
static widgetList* window_list;
|
||||||
|
static widgetList* dialog_list;
|
||||||
static widgetList* close_widget;
|
static widgetList* close_widget;
|
||||||
|
|
||||||
typedef void (*FCallback)(FWidget*, void*);
|
typedef void (*FCallback)(FWidget*, void*);
|
||||||
|
|
|
@ -143,8 +143,9 @@ void FWindow::addWindow (FWidget* obj)
|
||||||
void FWindow::delWindow (FWidget* obj)
|
void FWindow::delWindow (FWidget* obj)
|
||||||
{
|
{
|
||||||
// delete the window object obj from the window list
|
// delete the window object obj from the window list
|
||||||
if ( window_list && ! window_list->empty() )
|
if ( ! window_list || window_list->empty() )
|
||||||
{
|
return;
|
||||||
|
|
||||||
widgetList::iterator iter;
|
widgetList::iterator iter;
|
||||||
iter = window_list->begin();
|
iter = window_list->begin();
|
||||||
|
|
||||||
|
@ -158,7 +159,6 @@ void FWindow::delWindow (FWidget* obj)
|
||||||
|
|
||||||
++iter;
|
++iter;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
Loading…
Reference in New Issue