summaryrefslogtreecommitdiff
path: root/test/browser.cxx
diff options
context:
space:
mode:
authorMichael R Sweet <michael.r.sweet@gmail.com>2004-07-26 20:52:52 +0000
committerMichael R Sweet <michael.r.sweet@gmail.com>2004-07-26 20:52:52 +0000
commita529510e5b8f84b15aacd103936df89bb767bb29 (patch)
tree48fed13b2239bc7de94c680ab1efa3b16c41c432 /test/browser.cxx
parentdd193b3820f9b59233834d0f4bc020cd91168f58 (diff)
More documentation updates...
Fl_File_Chooser did not handle some cases for filename completion (STR #376) Fl_Help_View didn't properly compute the default maximum width of the page properly, resulting in non-wrapped text in table cells (STR #464) Fl_Text_Editor no longer tries to emulate the Emacs CTRL-A shortcut to move to the first column, since there is a key for that and the widget does not emulate any other Emacs keys (STR #421) Fl_File_Chooser always disabled the OK button when the user pressed DELETE or BACKSPACE (STR #397) Added Fl_Browser::swap() methods (STR #459) git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@3698 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'test/browser.cxx')
-rw-r--r--test/browser.cxx32
1 files changed, 25 insertions, 7 deletions
diff --git a/test/browser.cxx b/test/browser.cxx
index 054bc0dfa..446a8ebf6 100644
--- a/test/browser.cxx
+++ b/test/browser.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: browser.cxx,v 1.5.2.6.2.6 2004/04/11 04:39:00 easysw Exp $"
+// "$Id: browser.cxx,v 1.5.2.6.2.7 2004/07/26 20:52:52 easysw Exp $"
//
// Browser test program for the Fast Light Tool Kit (FLTK).
//
@@ -74,7 +74,8 @@ Fl_Select_Browser *browser;
Fl_Button *top,
*bottom,
*middle,
- *visible;
+ *visible,
+ *swap;
Fl_Int_Input *field;
void b_cb(Fl_Widget* o, void*) {
@@ -101,6 +102,19 @@ void show_cb(Fl_Widget *o, void *) {
browser->make_visible(line);
}
+void swap_cb(Fl_Widget *o, void *) {
+ int a = -1, b = -1;
+ for ( int t=0; t<browser->size(); t++ ) { // find two selected items
+ if ( browser->selected(t) ) {
+ if ( a < 0 )
+ { a = t; }
+ else
+ { b = t; break; }
+ }
+ }
+ browser->swap(a, b); // swap them
+}
+
int main(int argc, char **argv) {
int i;
if (!Fl::args(argc,argv,i)) Fl::fatal(Fl::help);
@@ -139,24 +153,28 @@ int main(int argc, char **argv) {
field = new Fl_Int_Input(50, 350, 350, 25, "Line #:");
field->callback(show_cb);
- top = new Fl_Button(0, 375, 100, 25, "Top");
+ top = new Fl_Button(0, 375, 80, 25, "Top");
top->callback(show_cb);
- bottom = new Fl_Button(100, 375, 100, 25, "Bottom");
+ bottom = new Fl_Button(80, 375, 80, 25, "Bottom");
bottom->callback(show_cb);
- middle = new Fl_Button(200, 375, 100, 25, "Middle");
+ middle = new Fl_Button(160, 375, 80, 25, "Middle");
middle->callback(show_cb);
- visible = new Fl_Button(300, 375, 100, 25, "Make Vis.");
+ visible = new Fl_Button(240, 375, 80, 25, "Make Vis.");
visible->callback(show_cb);
+ swap = new Fl_Button(320, 375, 80, 25, "Swap");
+ swap->callback(swap_cb);
+ swap->tooltip("Swaps two selected lines\n(Use CTRL-click to select two lines)");
+
window.resizable(browser);
window.show(argc,argv);
return Fl::run();
}
//
-// End of "$Id: browser.cxx,v 1.5.2.6.2.6 2004/04/11 04:39:00 easysw Exp $".
+// End of "$Id: browser.cxx,v 1.5.2.6.2.7 2004/07/26 20:52:52 easysw Exp $".
//