Refactoring FDialog::initDialogMenu

This commit is contained in:
Markus Gans 2018-02-18 22:45:49 +01:00
parent 69956ce76f
commit 4322e957c9
3 changed files with 28 additions and 4 deletions

View File

@ -1,6 +1,7 @@
2017-02-18 Markus Gans <guru.mail@muenster.de> 2017-02-18 Markus Gans <guru.mail@muenster.de>
* Avoid scroll bar overshooting * Avoid scroll bar overshooting
* Refactoring FListView::onMouseMove * Refactoring FListView::onMouseMove
* Refactoring FDialog::initDialogMenu
2017-02-17 Markus Gans <guru.mail@muenster.de> 2017-02-17 Markus Gans <guru.mail@muenster.de>
* Generalize scroll functions in FTextView * Generalize scroll functions in FTextView

View File

@ -179,6 +179,9 @@ class FDialog : public FWindow
// Methods // Methods
void init(); void init();
void initDialogMenu(); void initDialogMenu();
void initMoveSizeMenuItem (FMenu*);
void initZoomMenuItem (FMenu*);
void initCloseMenuItem (FMenu*);
virtual void drawBorder(); virtual void drawBorder();
void drawTitleBar(); void drawTitleBar();
void drawBarButton(); void drawBarButton();

View File

@ -925,9 +925,22 @@ void FDialog::initDialogMenu()
dgl_menuitem->unsetFocusable(); dgl_menuitem->unsetFocusable();
} }
// Add the move/size menu item
initMoveSizeMenuItem (dialog_menu);
// Add the zoom menu item
initZoomMenuItem (dialog_menu);
// Add the close menu item
initCloseMenuItem (dialog_menu);
}
//----------------------------------------------------------------------
void FDialog::initMoveSizeMenuItem (FMenu* menu)
{
try try
{ {
move_size_item = new FMenuItem (dialog_menu); move_size_item = new FMenuItem (menu);
} }
catch (const std::bad_alloc& ex) catch (const std::bad_alloc& ex)
{ {
@ -943,10 +956,14 @@ void FDialog::initDialogMenu()
"clicked", "clicked",
F_METHOD_CALLBACK (this, &FDialog::cb_move) F_METHOD_CALLBACK (this, &FDialog::cb_move)
); );
}
//----------------------------------------------------------------------
void FDialog::initZoomMenuItem (FMenu* menu)
{
try try
{ {
zoom_item = new FMenuItem (dialog_menu); zoom_item = new FMenuItem (menu);
} }
catch (const std::bad_alloc& ex) catch (const std::bad_alloc& ex)
{ {
@ -962,10 +979,14 @@ void FDialog::initDialogMenu()
"clicked", "clicked",
F_METHOD_CALLBACK (this, &FDialog::cb_zoom) F_METHOD_CALLBACK (this, &FDialog::cb_zoom)
); );
}
//----------------------------------------------------------------------
void FDialog::initCloseMenuItem (FMenu* menu)
{
try try
{ {
close_item = new FMenuItem ("&Close", dialog_menu); close_item = new FMenuItem ("&Close", menu);
} }
catch (const std::bad_alloc& ex) catch (const std::bad_alloc& ex)
{ {
@ -1067,7 +1088,6 @@ void FDialog::drawBarButton()
setReverse(true); setReverse(true);
} }
if ( isNewFont() ) if ( isNewFont() )
{ {
print (fc::NF_rev_menu_button1); print (fc::NF_rev_menu_button1);