Buttons on scrollbars draw pushed in (fix from barrero@irit.fr)

Fl_Menu_::remove(int i) will remove an entire submenu if i is the
index of the menu title.


git-svn-id: file:///fltk/svn/fltk/branches/branch-1.0@985 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Bill Spitzak 2000-01-16 04:30:39 +00:00
parent b45efe96dc
commit 685d58c497
4 changed files with 30 additions and 18 deletions

View File

@ -1,6 +1,6 @@
#include <stdio.h>
//
// "$Id: Fl.cxx,v 1.24.2.13 1999/10/23 06:19:59 bill Exp $"
// "$Id: Fl.cxx,v 1.24.2.14 2000/01/16 04:30:36 bill Exp $"
//
// Main event handling code for the Fast Light Tool Kit (FLTK).
//
@ -573,7 +573,11 @@ void Fl_Window::hide() {
#ifdef WIN32
if (x->private_dc) ReleaseDC(x->xid,x->private_dc);
if (x->xid == fl_window) fl_GetDC(0); // releases dc belonging to window
if (x->xid == fl_window && fl_gc) {
ReleaseDC(fl_window, fl_gc);
fl_window = (HWND)-1;
fl_gc = 0;
}
#else
if (x->region) XDestroyRegion(x->region);
#endif
@ -700,5 +704,5 @@ int fl_old_shortcut(const char* s) {
}
//
// End of "$Id: Fl.cxx,v 1.24.2.13 1999/10/23 06:19:59 bill Exp $".
// End of "$Id: Fl.cxx,v 1.24.2.14 2000/01/16 04:30:36 bill Exp $".
//

View File

@ -1,5 +1,5 @@
//
// "$Id: Fl_Menu_add.cxx,v 1.9.2.4 1999/07/12 12:22:45 carl Exp $"
// "$Id: Fl_Menu_add.cxx,v 1.9.2.5 2000/01/16 04:30:37 bill Exp $"
//
// Menu utilities for the Fast Light Tool Kit (FLTK).
//
@ -225,10 +225,17 @@ void Fl_Menu_::remove(int i) {
int n = size();
if (i<0 || i>=n) return;
if (!alloc) copy(menu_);
if (alloc > 1) free((void *)menu_[i].text);
memmove(&menu_[i],&menu_[i+1],(n-i)*sizeof(Fl_Menu_Item));
// find the next item, skipping submenus:
Fl_Menu_Item* item = menu_+i;
const Fl_Menu_Item* next_item = item->next();
// delete the text only if all items were created with add():
if (alloc > 1) {
for (Fl_Menu_Item* m = item; m < next_item; m++)
if (m->text) free((void*)(m->text));
}
memmove(item, next_item, ((menu_+n+1)-next_item)*sizeof(Fl_Menu_Item));
}
//
// End of "$Id: Fl_Menu_add.cxx,v 1.9.2.4 1999/07/12 12:22:45 carl Exp $".
// End of "$Id: Fl_Menu_add.cxx,v 1.9.2.5 2000/01/16 04:30:37 bill Exp $".
//

View File

@ -1,5 +1,5 @@
//
// "$Id: Fl_Scrollbar.cxx,v 1.7.2.4 1999/12/29 03:14:37 mike Exp $"
// "$Id: Fl_Scrollbar.cxx,v 1.7.2.5 2000/01/16 04:30:37 bill Exp $"
//
// Scroll bar widget for the Fast Light Tool Kit (FLTK).
//
@ -106,7 +106,7 @@ int Fl_Scrollbar::handle(int event) {
case FL_LEAVE:
return 1;
case FL_RELEASE:
damage(FL_DAMAGE_EXPOSE);
damage(FL_DAMAGE_ALL);
if (pushed_) {
Fl::remove_timeout(timeout_cb, this);
pushed_ = 0;
@ -120,7 +120,7 @@ int Fl_Scrollbar::handle(int event) {
handle_push();
Fl::add_timeout(INITIALREPEAT, timeout_cb, this);
increment_cb();
damage(FL_DAMAGE_EXPOSE);
damage(FL_DAMAGE_ALL);
return 1;
}
return Fl_Slider::handle(event, X,Y,W,H);
@ -190,9 +190,9 @@ void Fl_Scrollbar::draw() {
if (W < 3*H) {Fl_Slider::draw(X,Y,W,H); return;}
Fl_Slider::draw(X+H,Y,W-2*H,H);
if (damage()&FL_DAMAGE_ALL) {
draw_box((pushed_&1) ? down(slider()) : slider(),
draw_box((pushed_==1) ? down(slider()) : slider(),
X, Y, H, H, selection_color());
draw_box((pushed_&2) ? down(slider()) : slider(),
draw_box((pushed_==2) ? down(slider()) : slider(),
X+W-H, Y, H, H, selection_color());
if (active_r())
fl_color(labelcolor());
@ -210,9 +210,9 @@ void Fl_Scrollbar::draw() {
if (H < 3*W) {Fl_Slider::draw(X,Y,W,H); return;}
Fl_Slider::draw(X,Y+W,W,H-2*W);
if (damage()&FL_DAMAGE_ALL) {
draw_box((pushed_&1) ? down(slider()) : slider(),
draw_box((pushed_==1) ? down(slider()) : slider(),
X, Y, W, W, selection_color());
draw_box((pushed_&2) ? down(slider()) : slider(),
draw_box((pushed_==2) ? down(slider()) : slider(),
X, Y+H-W, W, W, selection_color());
if (active_r())
fl_color(labelcolor());
@ -241,5 +241,5 @@ Fl_Scrollbar::Fl_Scrollbar(int X, int Y, int W, int H, const char* L)
}
//
// End of "$Id: Fl_Scrollbar.cxx,v 1.7.2.4 1999/12/29 03:14:37 mike Exp $".
// End of "$Id: Fl_Scrollbar.cxx,v 1.7.2.5 2000/01/16 04:30:37 bill Exp $".
//

View File

@ -1,5 +1,5 @@
//
// "$Id: menubar.cxx,v 1.6.2.1 1999/04/26 06:45:29 bill Exp $"
// "$Id: menubar.cxx,v 1.6.2.2 2000/01/16 04:30:39 bill Exp $"
//
// Menubar test program for the Fast Light Tool Kit (FLTK).
//
@ -64,7 +64,7 @@ Fl_Menu_Item menutable[] = {
{"shortcut",FL_ALT+FL_SHIFT+'a'},
{"shortcut",FL_ALT+FL_CTRL+'a'},
{"shortcut",FL_ALT+FL_SHIFT+FL_CTRL+'a', 0,0, FL_MENU_DIVIDER},
{"shortcut",'\r'/*FL_Enter*/},
{"shortcut",'\r'/*FL_Enter*/},
{"shortcut",FL_CTRL+FL_Enter, 0,0, FL_MENU_DIVIDER},
{"shortcut",FL_F+1},
{"shortcut",FL_SHIFT+FL_F+1},
@ -201,6 +201,7 @@ int main(int argc, char **argv) {
Fl_Menu_Button mb(0,0,WIDTH,400,"&popup");
mb.type(Fl_Menu_Button::POPUP3);
mb.menu(menutable);
mb.remove(1); // delete the "File" submenu
mb.callback(test_cb);
menus[3] = &mb;
Fl_Box b(200,200,200,100,"Press right button\nfor a pop-up menu");
@ -214,5 +215,5 @@ int main(int argc, char **argv) {
}
//
// End of "$Id: menubar.cxx,v 1.6.2.1 1999/04/26 06:45:29 bill Exp $".
// End of "$Id: menubar.cxx,v 1.6.2.2 2000/01/16 04:30:39 bill Exp $".
//