summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Melcher <fltk@matthiasm.com>2007-01-21 15:54:53 +0000
committerMatthias Melcher <fltk@matthiasm.com>2007-01-21 15:54:53 +0000
commit9e79fd13d2b56f25e893298e6476f2a858f6adf6 (patch)
treed32ef4b7e21805540e01c9611bbb471db5f886b3
parent30be5f711b5a01e5e0d240671269608588f027d9 (diff)
I changed the Fl_Tabs drawing routine to only redraw the tabs themsleves on a PUSH event, instead of the whole current group. This also allows for a visual feedback from the clicked tab. (str #1520)
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@5629 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
-rw-r--r--CHANGES1
-rw-r--r--src/Fl_Tabs.cxx7
2 files changed, 5 insertions, 3 deletions
diff --git a/CHANGES b/CHANGES
index 815b8946e..0852f937c 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,5 +1,6 @@
CHANGES IN FLTK 1.1.8
+ - Optimized Fl_Tabs drawing for speed (STR #1520)
- OS X resource fork now obsolete (STR #1453)
- Added chapter 10 about multithreading (STR #1532,
1533)
diff --git a/src/Fl_Tabs.cxx b/src/Fl_Tabs.cxx
index c697435f7..235826d2c 100644
--- a/src/Fl_Tabs.cxx
+++ b/src/Fl_Tabs.cxx
@@ -225,7 +225,7 @@ int Fl_Tabs::handle(int event) {
int Fl_Tabs::push(Fl_Widget *o) {
if (push_ == o) return 0;
if (push_ && !push_->visible() || o && !o->visible())
- redraw();
+ redraw_tabs();
push_ = o;
return 1;
}
@@ -309,6 +309,7 @@ void Fl_Tabs::draw_tab(int x1, int x2, int W, int H, Fl_Widget* o, int what) {
int sel = (what == SELECTED);
int dh = Fl::box_dh(box());
int dy = Fl::box_dy(box());
+ Fl_Boxtype bt = (o==push_ &&!sel) ? fl_down(box()) : box();
// compute offsets to make selected tab look bigger
int yofs = sel ? 0 : BORDER;
@@ -323,7 +324,7 @@ void Fl_Tabs::draw_tab(int x1, int x2, int W, int H, Fl_Widget* o, int what) {
Fl_Color c = sel ? selection_color() : o->selection_color();
- draw_box(box(), x1, y() + yofs, W, H + 10 - yofs, c);
+ draw_box(bt, x1, y() + yofs, W, H + 10 - yofs, c);
// Save the previous label color
Fl_Color oc = o->labelcolor();
@@ -349,7 +350,7 @@ void Fl_Tabs::draw_tab(int x1, int x2, int W, int H, Fl_Widget* o, int what) {
Fl_Color c = sel ? selection_color() : o->selection_color();
- draw_box(box(), x1, y() + h() - H - 10, W, H + 10 - yofs, c);
+ draw_box(bt, x1, y() + h() - H - 10, W, H + 10 - yofs, c);
// Save the previous label color
Fl_Color oc = o->labelcolor();