add vmenubar
This commit is contained in:
parent
d37619b5be
commit
b1c8c70391
3
doc/TODO
3
doc/TODO
|
@ -6,7 +6,8 @@ Missing Features
|
||||||
~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~
|
||||||
- application menu
|
- application menu
|
||||||
- FMenuBar()
|
- FMenuBar()
|
||||||
- FPopupMenu()
|
- FMenu()
|
||||||
|
- FMenuItem()
|
||||||
|
|
||||||
- list/tree view with Columns
|
- list/tree view with Columns
|
||||||
- FListView()
|
- FListView()
|
||||||
|
|
|
@ -677,8 +677,8 @@ void FDialog::move (int x, int y)
|
||||||
|
|
||||||
dx = xpos - x;
|
dx = xpos - x;
|
||||||
dy = ypos - y;
|
dy = ypos - y;
|
||||||
old_x = xpos;
|
old_x = getGlobalX();
|
||||||
old_y = ypos;
|
old_y = getGlobalY();
|
||||||
short& rsw = shadow.x_ref(); // right shadow width;
|
short& rsw = shadow.x_ref(); // right shadow width;
|
||||||
short& bsh = shadow.y_ref(); // bottom shadow height
|
short& bsh = shadow.y_ref(); // bottom shadow height
|
||||||
oldGeometry = getGeometryShadow();
|
oldGeometry = getGeometryShadow();
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
#include "fapp.h"
|
#include "fapp.h"
|
||||||
#include "fstatusbar.h"
|
#include "fstatusbar.h"
|
||||||
|
#include "fmenubar.h"
|
||||||
#include "fwidget.h"
|
#include "fwidget.h"
|
||||||
#include "fwindow.h"
|
#include "fwindow.h"
|
||||||
|
|
||||||
|
@ -13,6 +14,7 @@ static FWidget* rootObject = 0;
|
||||||
uInt FWidget::modal_dialogs;
|
uInt FWidget::modal_dialogs;
|
||||||
|
|
||||||
FStatusBar* FWidget::statusbar = 0;
|
FStatusBar* FWidget::statusbar = 0;
|
||||||
|
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;
|
||||||
|
@ -233,6 +235,14 @@ void FWidget::setColorTheme()
|
||||||
wc.titlebar_inactive_bg = fc::DarkGray;
|
wc.titlebar_inactive_bg = fc::DarkGray;
|
||||||
wc.titlebar_button_fg = fc::Black;
|
wc.titlebar_button_fg = fc::Black;
|
||||||
wc.titlebar_button_bg = fc::LightGray;
|
wc.titlebar_button_bg = fc::LightGray;
|
||||||
|
wc.menu_active_focus_fg = fc::White;
|
||||||
|
wc.menu_active_focus_bg = fc::Blue;
|
||||||
|
wc.menu_active_fg = fc::Black;
|
||||||
|
wc.menu_active_bg = fc::White;
|
||||||
|
wc.menu_inactive_fg = fc::LightGray;
|
||||||
|
wc.menu_inactive_bg = fc::White;
|
||||||
|
wc.menu_hotkey_fg = fc::Red;
|
||||||
|
wc.menu_hotkey_bg = fc::White;
|
||||||
wc.statusbar_fg = fc::White;
|
wc.statusbar_fg = fc::White;
|
||||||
wc.statusbar_bg = fc::Blue;
|
wc.statusbar_bg = fc::Blue;
|
||||||
wc.statusbar_hotkey_fg = fc::LightRed;
|
wc.statusbar_hotkey_fg = fc::LightRed;
|
||||||
|
@ -311,6 +321,14 @@ void FWidget::setColorTheme()
|
||||||
wc.titlebar_inactive_bg = fc::LightGray;
|
wc.titlebar_inactive_bg = fc::LightGray;
|
||||||
wc.titlebar_button_fg = fc::Black;
|
wc.titlebar_button_fg = fc::Black;
|
||||||
wc.titlebar_button_bg = fc::LightGray;
|
wc.titlebar_button_bg = fc::LightGray;
|
||||||
|
wc.menu_active_focus_fg = fc::LightGray;
|
||||||
|
wc.menu_active_focus_bg = fc::Blue;
|
||||||
|
wc.menu_active_fg = fc::Black;
|
||||||
|
wc.menu_active_bg = fc::LightGray;
|
||||||
|
wc.menu_inactive_fg = fc::DarkGray;
|
||||||
|
wc.menu_inactive_bg = fc::LightGray;
|
||||||
|
wc.menu_hotkey_fg = fc::Red;
|
||||||
|
wc.menu_hotkey_bg = fc::LightGray;
|
||||||
wc.statusbar_fg = fc::LightGray;
|
wc.statusbar_fg = fc::LightGray;
|
||||||
wc.statusbar_bg = fc::Blue;
|
wc.statusbar_bg = fc::Blue;
|
||||||
wc.statusbar_hotkey_fg = fc::Red;
|
wc.statusbar_hotkey_fg = fc::Red;
|
||||||
|
@ -435,6 +453,17 @@ void FWidget::setStatusBar (FStatusBar* sbar)
|
||||||
statusbar = sbar;
|
statusbar = sbar;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
void FWidget::setMenuBar (FMenuBar* mbar)
|
||||||
|
{
|
||||||
|
if ( ! mbar || menubar == mbar )
|
||||||
|
return;
|
||||||
|
if ( menubar )
|
||||||
|
delete menubar;
|
||||||
|
|
||||||
|
menubar = mbar;
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
bool FWidget::event (FEvent* ev)
|
bool FWidget::event (FEvent* ev)
|
||||||
{
|
{
|
||||||
|
@ -900,6 +929,15 @@ FStatusBar* FWidget::statusBar()
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
FMenuBar* FWidget::menuBar()
|
||||||
|
{
|
||||||
|
if ( menubar )
|
||||||
|
return menubar;
|
||||||
|
else
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FWidget::addCallback ( FString cb_signal,
|
void FWidget::addCallback ( FString cb_signal,
|
||||||
FWidget::FCallback cb_handler,
|
FWidget::FCallback cb_handler,
|
||||||
|
@ -1104,6 +1142,13 @@ void FWidget::redraw()
|
||||||
++iter;
|
++iter;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if ( menubar && vmenubar )
|
||||||
|
{
|
||||||
|
int w = vmenubar->width;
|
||||||
|
int h = vmenubar->height;
|
||||||
|
std::fill_n (vmenubar->text, w * h, default_char);
|
||||||
|
menubar->redraw();
|
||||||
|
}
|
||||||
if ( statusbar && vstatusbar )
|
if ( statusbar && vstatusbar )
|
||||||
{
|
{
|
||||||
int w = vstatusbar->width;
|
int w = vstatusbar->width;
|
||||||
|
@ -1154,6 +1199,12 @@ void FWidget::resize()
|
||||||
closeConsole();
|
closeConsole();
|
||||||
resizeVTerm();
|
resizeVTerm();
|
||||||
resizeArea (vdesktop);
|
resizeArea (vdesktop);
|
||||||
|
if ( menubar )
|
||||||
|
{
|
||||||
|
menubar->setGeometry(1, 1, width, 1, false);
|
||||||
|
if ( vmenubar )
|
||||||
|
resizeArea(vmenubar);
|
||||||
|
}
|
||||||
if ( statusbar )
|
if ( statusbar )
|
||||||
{
|
{
|
||||||
statusbar->setGeometry(1, height, width, 1, false);
|
statusbar->setGeometry(1, height, width, 1, false);
|
||||||
|
@ -1530,8 +1581,8 @@ void FWidget::getTermGeometry()
|
||||||
rootObject->ymin = 1;
|
rootObject->ymin = 1;
|
||||||
rootObject->xmax = rootObject->width;
|
rootObject->xmax = rootObject->width;
|
||||||
rootObject->ymax = rootObject->height;
|
rootObject->ymax = rootObject->height;
|
||||||
rootObject->client_xmin = 1;
|
rootObject->client_xmin = 1 + rootObject->left_padding;
|
||||||
rootObject->client_ymin = 1;
|
rootObject->client_ymin = 1 + rootObject->top_padding;
|
||||||
rootObject->client_xmax = rootObject->width;
|
rootObject->client_xmax = rootObject->width;
|
||||||
rootObject->client_ymax = rootObject->height;
|
rootObject->client_ymax = rootObject->height;
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
#define NO_UNDERLINE 0x00000100
|
#define NO_UNDERLINE 0x00000100
|
||||||
|
|
||||||
class FStatusBar;
|
class FStatusBar;
|
||||||
|
class FMenuBar;
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
// class FWidget
|
// class FWidget
|
||||||
|
@ -123,6 +124,14 @@ class FWidget : public FObject, public FTerm
|
||||||
uChar titlebar_inactive_bg;
|
uChar titlebar_inactive_bg;
|
||||||
uChar titlebar_button_fg;
|
uChar titlebar_button_fg;
|
||||||
uChar titlebar_button_bg;
|
uChar titlebar_button_bg;
|
||||||
|
uChar menu_active_focus_fg;
|
||||||
|
uChar menu_active_focus_bg;
|
||||||
|
uChar menu_active_fg;
|
||||||
|
uChar menu_active_bg;
|
||||||
|
uChar menu_inactive_fg;
|
||||||
|
uChar menu_inactive_bg;
|
||||||
|
uChar menu_hotkey_fg;
|
||||||
|
uChar menu_hotkey_bg;
|
||||||
uChar statusbar_fg;
|
uChar statusbar_fg;
|
||||||
uChar statusbar_bg;
|
uChar statusbar_bg;
|
||||||
uChar statusbar_hotkey_fg;
|
uChar statusbar_hotkey_fg;
|
||||||
|
@ -190,6 +199,7 @@ class FWidget : public FObject, public FTerm
|
||||||
FString statusbar_message;
|
FString statusbar_message;
|
||||||
|
|
||||||
static FStatusBar* statusbar;
|
static FStatusBar* statusbar;
|
||||||
|
static FMenuBar* menubar;
|
||||||
static FWidget* show_root_widget;
|
static FWidget* show_root_widget;
|
||||||
static FWidget* redraw_root_widget;
|
static FWidget* redraw_root_widget;
|
||||||
friend class FApplication;
|
friend class FApplication;
|
||||||
|
@ -207,6 +217,7 @@ class FWidget : public FObject, public FTerm
|
||||||
protected:
|
protected:
|
||||||
virtual void adjustSize();
|
virtual void adjustSize();
|
||||||
virtual void setStatusBar (FStatusBar*);
|
virtual void setStatusBar (FStatusBar*);
|
||||||
|
virtual void setMenuBar (FMenuBar*);
|
||||||
// Event handlers
|
// Event handlers
|
||||||
bool event (FEvent*);
|
bool event (FEvent*);
|
||||||
virtual void onKeyPress (FKeyEvent*);
|
virtual void onKeyPress (FKeyEvent*);
|
||||||
|
@ -248,6 +259,7 @@ class FWidget : public FObject, public FTerm
|
||||||
virtual bool close();
|
virtual bool close();
|
||||||
|
|
||||||
static FStatusBar* statusBar();
|
static FStatusBar* statusBar();
|
||||||
|
static FMenuBar* menuBar();
|
||||||
void setStatusbarMessage (FString);
|
void setStatusbarMessage (FString);
|
||||||
void clearStatusbarMessage();
|
void clearStatusbarMessage();
|
||||||
FString getStatusbarMessage();
|
FString getStatusbarMessage();
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
// class FWindow
|
// class FWindow
|
||||||
|
|
||||||
#include "fapp.h"
|
#include "fapp.h"
|
||||||
|
#include "fmenubar.h"
|
||||||
#include "fstatusbar.h"
|
#include "fstatusbar.h"
|
||||||
#include "fwindow.h"
|
#include "fwindow.h"
|
||||||
|
|
||||||
|
@ -82,6 +83,9 @@ FWindow* FWindow::windowWidgetAt(int x, int y)
|
||||||
if ( statusBar() && statusBar()->getGeometryGlobal().contains(x,y) )
|
if ( statusBar() && statusBar()->getGeometryGlobal().contains(x,y) )
|
||||||
return statusBar();
|
return statusBar();
|
||||||
|
|
||||||
|
if ( menuBar() && menuBar()->getGeometryGlobal().contains(x,y) )
|
||||||
|
return menuBar();
|
||||||
|
|
||||||
if ( window_list && ! window_list->empty() )
|
if ( window_list && ! window_list->empty() )
|
||||||
{
|
{
|
||||||
widgetList::const_iterator iter, begin;
|
widgetList::const_iterator iter, begin;
|
||||||
|
|
Loading…
Reference in New Issue