[Aptitude-svn-commit] r3312 - in branches/aptitude-0.3/aptitude: . src/vscreen
Daniel Burrows
dburrows@costa.debian.org
Sat, 04 Jun 2005 18:07:38 +0000
Author: dburrows
Date: Sat Jun 4 18:07:36 2005
New Revision: 3312
Modified:
branches/aptitude-0.3/aptitude/ChangeLog
branches/aptitude-0.3/aptitude/src/vscreen/vs_menu.cc
branches/aptitude-0.3/aptitude/src/vscreen/vs_menu.h
Log:
Update the menu widget to the new display protocol.
Modified: branches/aptitude-0.3/aptitude/ChangeLog
==============================================================================
--- branches/aptitude-0.3/aptitude/ChangeLog (original)
+++ branches/aptitude-0.3/aptitude/ChangeLog Sat Jun 4 18:07:36 2005
@@ -1,5 +1,9 @@
2005-06-04 Daniel Burrows <dburrows@debian.org>
+ * src/vscreen/vs_menu.cc, src/vscreen/vs_menu.h:
+
+ Update menus for the new display protocol.
+
* src/vscreen/vs_layout_item.cc, src/vscreen/vs_layout_item.h:
Handle the new display protocol.
Modified: branches/aptitude-0.3/aptitude/src/vscreen/vs_menu.cc
==============================================================================
--- branches/aptitude-0.3/aptitude/src/vscreen/vs_menu.cc (original)
+++ branches/aptitude-0.3/aptitude/src/vscreen/vs_menu.cc Sat Jun 4 18:07:36 2005
@@ -356,12 +356,17 @@
// FIXME: handle truncated menus (eg, from menus appearing that are
// larger than the screen). REALLY FIX THIS! It's incredibly annoying in, eg,
// GTK+, and text screens have even less space to play with..
-void vs_menu::paint()
+void vs_menu::paint(const style &st)
{
int width, height;
+ const style border_style=st+get_style("MenuBorder");
+ const style highlighted_style=st+get_style("HighlightedMenuEntry");
+ const style entry_style=st+get_style("MenuEntry");
+ const style disabled_style=st+get_style("DisabledMenuEntry");
+
getmaxyx(height, width);
- attrset(get_color("MenuBorder"));
+ apply_style(border_style);
mvaddch(0, 0, ACS_ULCORNER);
for(int i=1; i<width-1; i++)
addch(ACS_HLINE);
@@ -377,7 +382,7 @@
{
bool boldthis=false;
- attrset(get_color("MenuBorder"));
+ apply_style(border_style);
mvaddch(1+i, 0, ACS_VLINE);
mvaddch(1+i, width-1, ACS_VLINE);
@@ -387,11 +392,11 @@
bool enabled=items[i]->is_enabled();
if(i==cursorloc)
- attrset(get_color("HighlightedMenuEntry"));
+ apply_style(highlighted_style);
else if(enabled)
- attrset(get_color("MenuEntry"));
+ apply_style(entry_style);
else
- attrset(get_color("DisabledMenuEntry"));
+ apply_style(disabled_style);
move(1+i, 1);
@@ -428,14 +433,14 @@
}
else
{
- attrset(get_color("MenuBorder"));
+ apply_style(border_style);
mvaddch(1+i, 0, ACS_LTEE);
for(int j=1; j<width-1; j++)
addch(ACS_HLINE);
addch(ACS_RTEE);
}
- attrset(get_color("MenuBorder"));
+ apply_style(border_style);
for(int i=items.size()+1; i<height-1; i++)
{
move(i, 0);
Modified: branches/aptitude-0.3/aptitude/src/vscreen/vs_menu.h
==============================================================================
--- branches/aptitude-0.3/aptitude/src/vscreen/vs_menu.h (original)
+++ branches/aptitude-0.3/aptitude/src/vscreen/vs_menu.h Sat Jun 4 18:07:36 2005
@@ -173,7 +173,7 @@
void remove_item(vs_menu_item *item);
virtual bool focus_me();
- virtual void paint();
+ virtual void paint(const style &st);
virtual void dispatch_mouse(short id, int x, int y, int z, mmask_t bstate);
// Emitted when an item is highlighted or when the selection "goes away".