Author: matt Date: 2011-06-03 09:54:44 -0700 (Fri, 03 Jun 2011) New Revision: 8777 Log: 123: porting headers in sequential order now.
Modified: branches/branch-3.0/FL/Enumerations.H branches/branch-3.0/FL/Fl.H branches/branch-3.0/FL/Fl_Adjuster.H branches/branch-3.0/FL/Fl_Bitmap.H branches/branch-3.0/FL/Fl_Box.H branches/branch-3.0/FL/Fl_Browser.H branches/branch-3.0/FL/Fl_Browser_.H branches/branch-3.0/FL/Fl_Button.H branches/branch-3.0/FL/Fl_Scrollbar.H branches/branch-3.0/FL/filename.H branches/branch-3.0/fltk3/Adjuster.h branches/branch-3.0/fltk3/Box.h branches/branch-3.0/fltk3/Scrollbar.h branches/branch-3.0/test/demo.cxx Modified: branches/branch-3.0/FL/Enumerations.H =================================================================== --- branches/branch-3.0/FL/Enumerations.H 2011-06-03 16:08:42 UTC (rev 8776) +++ branches/branch-3.0/FL/Enumerations.H 2011-06-03 16:54:44 UTC (rev 8777) @@ -2,6 +2,7 @@ // "$Id$" // // Enumerations for the Fast Light Tool Kit (FLTK). +// FLTK 123 wrapper complete // // Copyright 1998-2011 by Bill Spitzak and others. // Modified: branches/branch-3.0/FL/Fl.H =================================================================== --- branches/branch-3.0/FL/Fl.H 2011-06-03 16:08:42 UTC (rev 8776) +++ branches/branch-3.0/FL/Fl.H 2011-06-03 16:54:44 UTC (rev 8777) @@ -2,8 +2,11 @@ // "$Id$" // // Main header file for the Fast Light Tool Kit (FLTK). +// FLTK 123 wrapper started +// - function pointers missing (see FIXME) +// - callbacks not verified // -// Copyright 1998-2010 by Bill Spitzak and others. +// Copyright 1998-2011 by Bill Spitzak and others. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Library General Public Modified: branches/branch-3.0/FL/Fl_Adjuster.H =================================================================== --- branches/branch-3.0/FL/Fl_Adjuster.H 2011-06-03 16:08:42 UTC (rev 8776) +++ branches/branch-3.0/FL/Fl_Adjuster.H 2011-06-03 16:54:44 UTC (rev 8777) @@ -1,10 +1,10 @@ -#error header has not been ported to 3.0 yet // // "$Id$" // // Adjuster widget header file for the Fast Light Tool Kit (FLTK). +// FLTK 123 wrapper complete // -// Copyright 1998-2010 by Bill Spitzak and others. +// Copyright 1998-2011 by Bill Spitzak and others. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Library General Public @@ -26,54 +26,41 @@ // http://www.fltk.org/str.php // -/* \file - Fl_Adjuster widget . */ - -// 3-button "slider", made for Nuke - #ifndef Fl_Adjuster_H #define Fl_Adjuster_H -#ifndef Fl_Valuator_H +#include <fltk3/Adjuster.h> #include "Fl_Valuator.H" -#endif -/** - The Fl_Adjuster widget was stolen from Prisms, and has proven - to be very useful for values that need a large dynamic range. - \image html adjuster1.png - \image latex adjuster1.png "Fl_Adjuster" width=4cm - <P>When you press a button and drag to the right the value increases. - When you drag to the left it decreases. The largest button adjusts by - 100 * step(), the next by 10 * step() and that - smallest button by step(). Clicking on the buttons - increments by 10 times the amount dragging by a pixel does. Shift + - click decrements by 10 times the amount. -*/ + class FL_EXPORT Fl_Adjuster : public Fl_Valuator { - int drag; - int ix; - int soft_; + protected: - void draw(); - int handle(int); - void value_damage(); + + FLTK3_WRAPPER_VCALLS_OBJECT(Adjuster, draw(), draw(), Draw) + + FLTK3_WRAPPER_VCALLS_OBJECT_INT(Adjuster, handle(int event), handle(event), Handle) + + void value_damage() { + ((fltk3::Ajuster*)_p)->value_damage(); + } + public: - Fl_Adjuster(int X,int Y,int W,int H,const char *l=0); - /** - If "soft" is turned on, the user is allowed to drag the value outside - the range. If they drag the value to one of the ends, let go, then - grab again and continue to drag, they can get to any value. Default is - one. - */ - void soft(int s) {soft_ = s;} - /** - If "soft" is turned on, the user is allowed to drag the value outside - the range. If they drag the value to one of the ends, let go, then - grab again and continue to drag, they can get to any value. Default is - one. - */ - int soft() const {return soft_;} + + Fl_Adjuster() { /* empty */ } + + Fl_Adjuster(int x, int y, int w, int h, const char *label=0) { + _p = new fltk3::Adjuster(x, y, w, h, label); + _p->wrapper(this); + } + + void soft(int s) { + ((fltk3::Ajuster*)_p)->soft(s); + } + + int soft() const { + return ((fltk3::Ajuster*)_p)->soft(); + } }; #endif Modified: branches/branch-3.0/FL/Fl_Bitmap.H =================================================================== --- branches/branch-3.0/FL/Fl_Bitmap.H 2011-06-03 16:08:42 UTC (rev 8776) +++ branches/branch-3.0/FL/Fl_Bitmap.H 2011-06-03 16:54:44 UTC (rev 8777) @@ -1,8 +1,10 @@ -#error header has not been ported to 3.0 yet // // "$Id$" // // Bitmap header file for the Fast Light Tool Kit (FLTK). +// FLTK 123 wrapper started +// - virtual image functions missing +// - "copy" needs to generate a wrapper // // Copyright 1998-2010 by Bill Spitzak and others. // @@ -26,56 +28,59 @@ // http://www.fltk.org/str.php // -/* \file - Fl_Bitmap widget . */ - #ifndef Fl_Bitmap_H #define Fl_Bitmap_H -# include "Fl_Image.H" +#include <fltk3/Bitmap.h> +#include "Fl_Image.H" + class Fl_Widget; struct Fl_Menu_Item; -/** - The Fl_Bitmap class supports caching and drawing of mono-color - (bitmap) images. Images are drawn using the current color. -*/ class FL_EXPORT Fl_Bitmap : public Fl_Image { - friend class Fl_Quartz_Graphics_Driver; - friend class Fl_GDI_Graphics_Driver; - friend class Fl_Xlib_Graphics_Driver; + public: - - /** pointer to raw bitmap data */ - const uchar *array; - /** Non-zero if array points to bitmap data allocated internally */ - int alloc_array; - private: + const uchar *get_array() { + return ((fltk3::Bitmap*)_p)->array; + } + + int get_alloca_arrya() { + return ((fltk3::Bitmap*)_p)->alloc_array; + } -#if defined(__APPLE__) || defined(WIN32) - /** for internal use */ - void *id_; -#else - /** for internal use */ - unsigned id_; -#endif // __APPLE__ || WIN32 + Fl_Bitmap(const uchar *bits, int W, int H) { + _p = new fltk3::Bitmap(bits, W, H); + _p->wrapper(this); + } - public: + Fl_Bitmap(const char *bits, int W, int H) { + _p = new fltk3::Bitmap(bits, W, H); + _p->wrapper(this); + } - /** The constructors create a new bitmap from the specified bitmap data */ - Fl_Bitmap(const uchar *bits, int W, int H) : - Fl_Image(W,H,0), array(bits), alloc_array(0), id_(0) {data((const char **)&array, 1);} - /** The constructors create a new bitmap from the specified bitmap data */ - Fl_Bitmap(const char *bits, int W, int H) : - Fl_Image(W,H,0), array((const uchar *)bits), alloc_array(0), id_(0) {data((const char **)&array, 1);} - virtual ~Fl_Bitmap(); - virtual Fl_Image *copy(int W, int H); - Fl_Image *copy() { return copy(w(), h()); } + // FIXME: 123 - virtual funciton! + virtual Fl_Image *copy(int W, int H) { + ((fltk3::Bitmap*)_p)-> + } + + // FIXME: 123 - virtual function! Creates a new object! + Fl_Image *copy(); + + // FIXME: 123 - virtual function! virtual void draw(int X, int Y, int W, int H, int cx=0, int cy=0); - void draw(int X, int Y) {draw(X, Y, w(), h(), 0, 0);} + + void draw(int X, int Y) { + ((fltk3::Bitmap*)_p)->draw(X, Y); + } + + // FIXME: 123 - virtual function! virtual void label(Fl_Widget*w); + + // FIXME: 123 - virtual function! virtual void label(Fl_Menu_Item*m); + + // FIXME: 123 - virtual function! virtual void uncache(); }; Modified: branches/branch-3.0/FL/Fl_Box.H =================================================================== --- branches/branch-3.0/FL/Fl_Box.H 2011-06-03 16:08:42 UTC (rev 8776) +++ branches/branch-3.0/FL/Fl_Box.H 2011-06-03 16:54:44 UTC (rev 8777) @@ -2,8 +2,9 @@ // "$Id$" // // Box header file for the Fast Light Tool Kit (FLTK). +// FLTK 123 wrapper complete // -// Copyright 1998-2010 by Bill Spitzak and others. +// Copyright 1998-2011 by Bill Spitzak and others. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Library General Public @@ -33,10 +34,9 @@ class FL_EXPORT Fl_Box : public Fl_Widget { -#if 0 // FIXME: 123 protected: - void draw(); -#endif + + FLTK3_WRAPPER_VCALLS_OBJECT(Box, draw(), draw(), Draw) public: Fl_Box(int x, int y, int w, int h, const char *label=0) { @@ -49,9 +49,7 @@ _p->wrapper(this); } -#if 0 // FIXME: 123 - virtual int handle(int); -#endif + FLTK3_WRAPPER_VCALLS_OBJECT_INT(Box, handle(int event), handle(event), Handle) }; #endif Modified: branches/branch-3.0/FL/Fl_Browser.H =================================================================== --- branches/branch-3.0/FL/Fl_Browser.H 2011-06-03 16:08:42 UTC (rev 8776) +++ branches/branch-3.0/FL/Fl_Browser.H 2011-06-03 16:54:44 UTC (rev 8777) @@ -1,8 +1,8 @@ -#error header has not been ported to 3.0 yet // // "$Id$" // // Browser header file for the Fast Light Tool Kit (FLTK). +// FLTK 123 wrapper started // // Copyright 1998-2011 by Bill Spitzak and others. // @@ -26,82 +26,20 @@ // http://www.fltk.org/str.php // -/* \file - Fl_Browser widget . */ - -// Forms-compatible browser. Probably useful for other -// lists of textual data. Notice that the line numbers -// start from 1, and 0 means "no line". - #ifndef Fl_Browser_H #define Fl_Browser_H +#include <fltk3/Browser.h> #include "Fl_Browser_.H" #include "Fl_Image.H" struct FL_BLINE; -/** - The Fl_Browser widget displays a scrolling list of text - lines, and manages all the storage for the text. This is not a text - editor or spreadsheet! But it is useful for showing a vertical list of - named objects to the user. - - Each line in the browser is identified by number. <I>The numbers - start at one</I> (this is so that zero can be reserved for "no line" in - the selective browsers). <I>Unless otherwise noted, the methods do not - check to see if the passed line number is in range and legal. It must - always be greater than zero and <= size().</I> - - Each line contains a null-terminated string of text and a void * - data pointer. The text string is displayed, the void * - pointer can be used by the callbacks to reference the object the text - describes. - - The base class does nothing when the user clicks on it. The - subclasses - Fl_Select_Browser, - Fl_Hold_Browser, and - Fl_Multi_Browser react to user clicks to select lines in - the browser and do callbacks. - - The base class - Fl_Browser_ provides the scrolling and selection mechanisms of - this and all the subclasses, but the dimensions and appearance of each - item are determined by the subclass. You can use Fl_Browser_ - to display information other than text, or text that is dynamically - produced from your own data structures. If you find that loading the - browser is a lot of work or is inefficient, you may want to make a - subclass of Fl_Browser_. - - Some common coding patterns used for working with Fl_Browser: - \code - // How to loop through all the items in the browser - for ( int t=1; t<=browser->size(); t++ ) { // index 1 based..! - printf("item #%d, label='%s'\n", t, browser->text(t)); - } - \endcode - - Note: If you are <I>subclassing</I> Fl_Browser, it's more efficient - to use the protected methods item_first() and item_next(), since - Fl_Browser internally uses linked lists to manage the browser's items. - For more info, see find_item(int). -*/ class FL_EXPORT Fl_Browser : public Fl_Browser_ { - FL_BLINE *first; // the array of lines - FL_BLINE *last; - FL_BLINE *cache; - int cacheline; // line number of cache - int lines; // Number of lines - int full_height_; - const int* column_widths_; - char format_char_; // alternative to @-sign - char column_char_; // alternative to tab - protected: - // required routines for Fl_Browser_ subclass: + // FIXME: 123 - many of these are virtual! void* item_first() const ; void* item_next(void* item) const ; void* item_prev(void* item) const ; @@ -114,17 +52,7 @@ int full_height() const ; int incr_height() const ; const char *item_text(void *item) const; - /** Swap the items \p a and \p b. - You must call redraw() to make any changes visible. - \param[in] a,b the items to be swapped. - \see swap(int,int), item_swap() - */ void item_swap(void *a, void *b) { swap((FL_BLINE*)a, (FL_BLINE*)b); } - /** Return the item at specified \p line. - \param[in] line The line of the item to return. (1 based) - \returns The item, or NULL if line out of range. - \see item_at(), find_line(), lineno() - */ void *item_at(int line) const { return (void*)find_line(line); } FL_BLINE* find_line(int line) const ; @@ -142,180 +70,40 @@ int load(const char* filename); void swap(int a, int b); void clear(); - - /** - Returns how many lines are in the browser. - The last line number is equal to this. - Returns 0 if browser is empty. - */ int size() const { return lines; } void size(int W, int H) { Fl_Widget::size(W, H); } - int topline() const ; - /** For internal use only? */ enum Fl_Line_Position { TOP, BOTTOM, MIDDLE }; void lineposition(int line, Fl_Line_Position pos); - /** - Scrolls the browser so the top item in the browser - is showing the specified \p line. - \param[in] line The line to be displayed at the top. - \see topline(), middleline(), bottomline(), displayed(), lineposition() - */ void topline(int line) { lineposition(line, TOP); } - /** - Scrolls the browser so the bottom item in the browser - is showing the specified \p line. - \param[in] line The line to be displayed at the bottom. - \see topline(), middleline(), bottomline(), displayed(), lineposition() - */ void bottomline(int line) { lineposition(line, BOTTOM); } - /** - Scrolls the browser so the middle item in the browser - is showing the specified \p line. - \param[in] line The line to be displayed in the middle. - \see topline(), middleline(), bottomline(), displayed(), lineposition() - */ void middleline(int line) { lineposition(line, MIDDLE); } - int select(int line, int val=1); int selected(int line) const ; void show(int line); - /** Shows the entire Fl_Browser widget -- opposite of hide(). */ void show() { Fl_Widget::show(); } void hide(int line); - /** Hides the entire Fl_Browser widget -- opposite of show(). */ void hide() { Fl_Widget::hide(); } int visible(int line) const ; - int value() const ; - /** - Sets the browser's value(), which selects the specified \p line. - This is the same as calling select(line). - \see select(), selected(), value(), item_select(), item_selected() - */ void value(int line) { select(line); } const char* text(int line) const ; void text(int line, const char* newtext); void* data(int line) const ; void data(int line, void* d); - Fl_Browser(int X, int Y, int W, int H, const char *L = 0); - /** - The destructor deletes all list items and destroys the browser. - */ ~Fl_Browser() { clear(); } - - /** - Gets the current format code prefix character, which by default is '\@'. - A string of formatting codes at the start of each column are stripped off - and used to modify how the rest of the line is printed: - - \li <tt>'\@.'</tt> Print rest of line, don't look for more '\@' signs - \li <tt>'\@\@'</tt> Print rest of line starting with '\@' - \li <tt>'\@l'</tt> Use a LARGE (24 point) font - \li <tt>'\@m'</tt> Use a medium large (18 point) font - \li <tt>'\@s'</tt> Use a <SMALL>small</SMALL> (11 point) font - \li <tt>'\@b'</tt> Use a <B>bold</B> font (adds FL_BOLD to font) - \li <tt>'\@i'</tt> Use an <I>italic</I> font (adds FL_ITALIC to font) - \li <tt>'\@f' or '\@t'</tt> Use a fixed-pitch - font (sets font to FL_COURIER) - \li <tt>'\@c'</tt> Center the line horizontally - \li <tt>'\@r'</tt> Right-justify the text - \li <tt>'\@B0', '\@B1', ... '\@B255'</tt> Fill the backgound with - fl_color(n) - \li <tt>'\@C0', '\@C1', ... '\@C255'</tt> Use fl_color(n) to draw the text - \li <tt>'\@F0', '\@F1', ...</tt> Use fl_font(n) to draw the text - \li <tt>'\@S1', '\@S2', ...</tt> Use point size n to draw the text - \li <tt>'\@u' or '\@_'</tt> Underline the text. - \li <tt>'\@-'</tt> draw an engraved line through the middle. - - Notice that the '\@.' command can be used to reliably - terminate the parsing. To print a random string in a random color, use - <tt>sprintf("@C%d@.%s", color, string)</tt> and it will work even if the - string starts with a digit or has the format character in it. - */ char format_char() const { return format_char_; } - /** - Sets the current format code prefix character to \p c. - The default prefix is '\@'. Set the prefix to 0 to disable formatting. - \see format_char() for list of '\@' codes - */ void format_char(char c) { format_char_ = c; } - /** - Gets the current column separator character. - The default is '\\t' (tab). - \see column_char(), column_widths() - */ char column_char() const { return column_char_; } - /** - Sets the column separator to c. - This will only have an effect if you also set column_widths(). - The default is '\\t' (tab). - \see column_char(), column_widths() - */ void column_char(char c) { column_char_ = c; } - /** - Gets the current column width array. - This array is zero-terminated and specifies the widths in pixels of - each column. The text is split at each column_char() and each part is - formatted into it's own column. After the last column any remaining - text is formatted into the space between the last column and the - right edge of the browser, even if the text contains instances of - column_char() . The default value is a one-element array of just - a zero, which means there are no columns. - - Example: - \code - Fl_Browser *b = new Fl_Browser(..); - int widths[] = { 50, 50, 50, 70, 70, 40, 40, 70, 70, 50, 0 }; // widths for each column - b->column_widths(widths); // assign array to widget - b->column_char('\t'); // use tab as the column character - b->add("USER\tPID\tCPU\tMEM\tVSZ\tRSS\tTTY\tSTAT\tSTART\tTIME\tCOMMAND"); - b->add("root\t2888\t0.0\t0.0\t1352\t0\ttty3\tSW\tAug15\t0:00\t@b@f/sbin/mingetty tty3"); - b->add("root\t13115\t0.0\t0.0\t1352\t0\ttty2\tSW\tAug30\t0:00\t@b@f/sbin/mingetty tty2"); - [..] - \endcode - \see column_char(), column_widths() - */ const int* column_widths() const { return column_widths_; } - /** - Sets the current array to \p arr. Make sure the last entry is zero. - \see column_char(), column_widths() - */ void column_widths(const int* arr) { column_widths_ = arr; } - - /** - Returns non-zero if \p line has been scrolled to a position where it is being displayed. - Checks to see if the item's vertical position is within the top and bottom - edges of the display window. This does NOT take into account the hide()/show() - status of the widget or item. - \param[in] line The line to be checked - \returns 1 if visible, 0 if not visible. - \see topline(), middleline(), bottomline(), displayed(), lineposition() - */ int displayed(int line) const { return Fl_Browser_::displayed(find_line(line)); } - - /** - Make the item at the specified \p line visible(). - Functionally similar to show(int line). - If \p line is out of range, redisplay top or bottom of list as appropriate. - \param[in] line The line to be made visible. - \see show(int), hide(int), display(), visible(), make_visible() - */ - void make_visible(int line) { - if (line < 1) Fl_Browser_::display(find_line(1)); - else if (line > lines) Fl_Browser_::display(find_line(lines)); - else Fl_Browser_::display(find_line(line)); - } - - // icon support + void make_visible(int line) ; void icon(int line, Fl_Image* icon); Fl_Image* icon(int line) const; void remove_icon(int line); - - /** For back compatibility only. */ - void replace(int a, const char* b) { text(a, b); } - void display(int line, int val=1); }; #endif Modified: branches/branch-3.0/FL/Fl_Browser_.H =================================================================== --- branches/branch-3.0/FL/Fl_Browser_.H 2011-06-03 16:08:42 UTC (rev 8776) +++ branches/branch-3.0/FL/Fl_Browser_.H 2011-06-03 16:54:44 UTC (rev 8777) @@ -1,10 +1,10 @@ -#error header has not been ported to 3.0 yet // // "$Id$" // // Common browser header file for the Fast Light Tool Kit (FLTK). +// FLTK 123 wrapper started // -// Copyright 1998-2010 by Bill Spitzak and others. +// Copyright 1998-2011 by Bill Spitzak and others. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Library General Public @@ -26,19 +26,12 @@ // http://www.fltk.org/str.php // -/* \file - Fl_Browser_ widget . */ - -// Yes, I know this should be a template... - #ifndef Fl_Browser__H #define Fl_Browser__H -#ifndef Fl_Group_H #include "Fl_Group.H" -#endif #include "Fl_Scrollbar.H" -#include <FL/Fl.H> // Fl::scrollbar_size() +#include "Fl.H" #define FL_NORMAL_BROWSER 0 /**< type() of Fl_Browser */ #define FL_SELECT_BROWSER 1 /**< type() of FL_Select_Browser */ @@ -48,131 +41,27 @@ #define FL_SORT_ASCENDING 0 /**< sort browser items in ascending alphabetic order. */ #define FL_SORT_DESCENDING 1 /**< sort in descending order */ -/** - This is the base class for browsers. To be useful it must be - subclassed and several virtual functions defined. The Forms-compatible - browser and the file chooser's browser are subclassed off of this. - - This has been designed so that the subclass has complete control - over the storage of the data, although because next() and - prev() functions are used to index, it works best as a linked list - or as a large block of characters in which the line breaks must be - searched for. - - A great deal of work has been done so that the "height" of a data - object does not need to be determined until it is drawn. This is - useful if actually figuring out the size of an object requires - accessing image data or doing stat() on a file or doing some - other slow operation. -*/ class FL_EXPORT Fl_Browser_ : public Fl_Group { - int position_; // where user wants it scrolled to - int real_position_; // the current vertical scrolling position - int hposition_; // where user wants it panned to - int real_hposition_; // the current horizontal scrolling position - int offset_; // how far down top_ item the real_position is - int max_width; // widest object seen so far - uchar has_scrollbar_; // which scrollbars are enabled - Fl_Font textfont_; - Fl_Fontsize textsize_; - Fl_Color textcolor_; - void* top_; // which item scrolling position is in - void* selection_; // which is selected (except for FL_MULTI_BROWSER) - void *redraw1,*redraw2; // minimal update pointers - void* max_width_item; // which item has max_width_ - int scrollbar_size_; // size of scrollbar trough - void update_top(); - protected: - // All of the following must be supplied by the subclass: - /** - This method must be provided by the subclass - to return the first item in the list. - \see item_first(), item_next(), item_last(), item_prev() - */ virtual void *item_first() const = 0; - /** - This method must be provided by the subclass - to return the item in the list after \p item. - \see item_first(), item_next(), item_last(), item_prev() - */ virtual void *item_next(void *item) const = 0; - /** - This method must be provided by the subclass - to return the item in the list before \p item. - \see item_first(), item_next(), item_last(), item_prev() - */ virtual void *item_prev(void *item) const = 0; - /** - This method must be provided by the subclass - to return the last item in the list. - \see item_first(), item_next(), item_last(), item_prev() - */ virtual void *item_last() const { return 0L; } - /** - This method must be provided by the subclass to return - the height of \p item in pixels. - Allow for two additional pixels for the list selection box. - \param[in] item The item whose height is returned. - \returns The height of the specified \p item in pixels. - \see item_height(), item_width(), item_quick_height() - */ virtual int item_height(void *item) const = 0; - /** - This method must be provided by the subclass to return the width of the - \p item in pixels. Allow for two additional pixels for the list - selection box. - \param[in] item The item whose width is returned. - \returns The width of the item in pixels. - */ virtual int item_width(void *item) const = 0; virtual int item_quick_height(void *item) const ; - /** - This method must be provided by the subclass to draw the \p item - in the area indicated by \p X, \p Y, \p W, \p H. - */ virtual void item_draw(void *item,int X,int Y,int W,int H) const = 0; - /** - This optional method returns a string (label) that may be used for sorting. - \param[in] item The item whose label text is returned. - \returns The item's text label. (Can be NULL if blank) - */ virtual const char *item_text(void *item) const { (void)item; return 0L; } - /** - This optional method should be provided by the subclass - to efficiently swap browser items \p a and \p b, such as for sorting. - \param[in] a,b The two items to be swapped. - */ virtual void item_swap(void *a,void *b) { (void)a; (void)b; } - /** - This method must be provided by the subclass - to return the item for the specified \p index. - \param[in] index The \p index of the item to be returned - \returns The item at the specified \p index. - */ virtual void *item_at(int index) const { (void)index; return 0L; } - // you don't have to provide these but it may help speed it up: virtual int full_width() const ; // current width of all items virtual int full_height() const ; // current height of all items virtual int incr_height() const ; // average height of an item - // These only need to be done by subclass if you want a multi-browser: virtual void item_select(void *item,int val=1); virtual int item_selected(void *item) const ; - - // things the subclass may want to call: - /** - Returns the item that appears at the top of the list. - */ void *top() const { return top_; } - /** - Returns the item currently selected, or NULL if there is no selection. - - For multiple selection browsers this call returns the currently focused item, - even if it is not selected. To find all selected items, call - Fl_Multi_Browser::selected() for every item in question. - */ void *selection() const { return selection_; } void new_list(); // completely clobber all data, as though list replaced void deleting(void *item); // get rid of any pointers to item @@ -181,64 +70,28 @@ void inserting(void *a,void *b); // insert b near a int displayed(void *item) const ; // true if this item is visible void redraw_line(void *item); // minimal update, no change in size - /** - This method will cause the entire list to be redrawn. - \see redraw_lines(), redraw_line() - */ void redraw_lines() { damage(FL_DAMAGE_SCROLL); } // redraw all of them void bbox(int &X,int &Y,int &W,int &H) const; int leftedge() const; // x position after scrollbar & border void *find_item(int ypos); // item under mouse - void draw(); Fl_Browser_(int X,int Y,int W,int H,const char *L=0); public: - /** - Vertical scrollbar. Public, so that it can be accessed directly. - */ Fl_Scrollbar scrollbar; - /** - Horizontal scrollbar. Public, so that it can be accessed directly. - */ Fl_Scrollbar hscrollbar; int handle(int event); void resize(int X,int Y,int W,int H); - int select(void *item,int val=1,int docallbacks=0); int select_only(void *item,int docallbacks=0); int deselect(int docallbacks=0); - /** - Gets the vertical scroll position of the list as a pixel position \p pos. - The position returned is how many pixels of the list are scrolled off the top edge - of the screen. Example: A position of '3' indicates the top 3 pixels of - the list are scrolled off the top edge of the screen. - \see position(), hposition() - */ int position() const { return position_; } void position(int pos); // scroll to here - /** - Gets the horizontal scroll position of the list as a pixel position \p pos. - The position returned is how many pixels of the list are scrolled off the left edge - of the screen. Example: A position of '18' indicates the left 18 pixels of - the list are scrolled off the left edge of the screen. - \see position(), hposition() - */ int hposition() const { return hposition_; } void hposition(int); // pan to here void display(void *item); // scroll so this item is shown - - /** - Values for has_scrollbar(). - */ - /** Anonymous enum bit flags for has_scrollbar(). - - bit 0: horizontal - - bit 1: vertical - - bit 2: 'always' (to be combined with bits 0 and 1) - - bit 3-31: reserved for future use - */ enum { // values for has_scrollbar() HORIZONTAL = 1, ///< Only show horizontal scrollbar. VERTICAL = 2, ///< Only show vertical scrollbar. @@ -248,126 +101,19 @@ VERTICAL_ALWAYS = 6, ///< Vertical scrollbar always on. BOTH_ALWAYS = 7 ///< Both scrollbars always on. }; - /** - Returns the current scrollbar mode, see Fl_Browser_::has_scrollbar(uchar) - */ uchar has_scrollbar() const { return has_scrollbar_; } - /** - Sets whether the widget should have scrollbars or not (default Fl_Browser_::BOTH). - By default you can scroll in both directions, and the scrollbars - disappear if the data will fit in the widget. - has_scrollbar() changes this based on the value of \p mode: - - - 0 - No scrollbars. - - - Fl_Browser_::HORIZONTAL - Only a horizontal scrollbar. - - - Fl_Browser_::VERTICAL - Only a vertical scrollbar. - - - Fl_Browser_::BOTH - The default is both scrollbars. - - - Fl_Browser_::HORIZONTAL_ALWAYS - Horizontal scrollbar always on, - vertical always off. - - - Fl_Browser_::VERTICAL_ALWAYS - Vertical scrollbar always on, - horizontal always off. - - - Fl_Browser_::BOTH_ALWAYS - Both always on. - */ void has_scrollbar(uchar mode) { has_scrollbar_ = mode; } - - /** - Gets the default text font for the lines in the browser. - \see textfont(), textsize(), textcolor() - */ Fl_Font textfont() const { return textfont_; } - /** - Sets the default text font for the lines in the browser to \p font. - */ void textfont(Fl_Font font) { textfont_ = font; } - - /** - Gets the default text size (in pixels) for the lines in the browser. - */ Fl_Fontsize textsize() const { return textsize_; } - /** - Sets the default text size (in pixels) for the lines in the browser to \p size. - */ void textsize(Fl_Fontsize size) { textsize_ = size; } - - /** - Gets the default text color for the lines in the browser. - */ Fl_Color textcolor() const { return textcolor_; } - /** - Sets the default text color for the lines in the browser to color \p col. - */ void textcolor(Fl_Color col) { textcolor_ = col; } - - /** - Gets the current size of the scrollbars' troughs, in pixels. - - If this value is zero (default), this widget will use the - Fl::scrollbar_size() value as the scrollbar's width. - - \returns Scrollbar size in pixels, or 0 if the global Fl::scrollsize() is being used. - \see Fl::scrollbar_size(int) - */ - int scrollbar_size() const { - return(scrollbar_size_); - } - /** - Sets the pixel size of the scrollbars' troughs to the \p size, in pixels. - - Normally you should not need this method, and should use - Fl::scrollbar_size(int) instead to manage the size of ALL - your widgets' scrollbars. This ensures your application - has a consistent UI, is the default behavior, and is normally - what you want. - - Only use THIS method if you really need to override the global - scrollbar size. The need for this should be rare. - - Setting \p size to the special value of 0 causes the widget to - track the global Fl::scrollbar_size(), which is the default. - - \param[in] size Sets the scrollbar size in pixels.\n - If 0 (default), scrollbar size tracks the global Fl::scrollbar_size() - \see Fl::scrollbar_size() - */ - void scrollbar_size(int size) { - scrollbar_size_ = size; - } - /** - This method has been deprecated, existing for backwards compatibility only. - Use scrollbar_size() instead. - This method always returns the global value Fl::scrollbar_size(). - \returns Always returns the global value Fl::scrollbar_size(). - \todo This method should eventually be removed in 1.4+ - */ - int scrollbar_width() const { - return(Fl::scrollbar_size()); - } - /** - This method has been deprecated, existing for backwards compatibility only. - Use scrollbar_size(int) instead. - This method sets the global Fl::scrollbar_size(), and forces this - instance of the widget to use it. - \todo This method should eventually be removed in 1.4+ - */ - void scrollbar_width(int width) { - Fl::scrollbar_size(width); - scrollbar_size_ = 0; - } - /** - Moves the vertical scrollbar to the righthand side of the list. - For back compatibility. - */ + int scrollbar_size() const; + void scrollbar_size(int size); + int scrollbar_width() const; + void scrollbar_width(int width); void scrollbar_right() { scrollbar.align(FL_ALIGN_RIGHT); } - /** - Moves the vertical scrollbar to the lefthand side of the list. - For back compatibility. - */ void scrollbar_left() { scrollbar.align(FL_ALIGN_LEFT); } void sort(int flags=0); }; Modified: branches/branch-3.0/FL/Fl_Button.H =================================================================== --- branches/branch-3.0/FL/Fl_Button.H 2011-06-03 16:08:42 UTC (rev 8776) +++ branches/branch-3.0/FL/Fl_Button.H 2011-06-03 16:54:44 UTC (rev 8777) @@ -2,8 +2,9 @@ // "$Id$" // // Button header file for the Fast Light Tool Kit (FLTK). +// FLTK 123 wrapper complete // -// Copyright 1998-2010 by Bill Spitzak and others. +// Copyright 1998-2011 by Bill Spitzak and others. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Library General Public Modified: branches/branch-3.0/FL/Fl_Scrollbar.H =================================================================== --- branches/branch-3.0/FL/Fl_Scrollbar.H 2011-06-03 16:08:42 UTC (rev 8776) +++ branches/branch-3.0/FL/Fl_Scrollbar.H 2011-06-03 16:54:44 UTC (rev 8777) @@ -1,4 +1,3 @@ -#error header has not been ported to 3.0 yet // // "$Id$" // @@ -32,86 +31,46 @@ #ifndef Fl_Scrollbar_H #define Fl_Scrollbar_H +#include <fltk3/Scrollbar.h> #include "Fl_Slider.H" -/** - The Fl_Scrollbar widget displays a slider with arrow buttons at - the ends of the scrollbar. Clicking on the arrows move up/left and - down/right by linesize(). Scrollbars also accept FL_SHORTCUT events: - the arrows move by linesize(), and vertical scrollbars take Page - Up/Down (they move by the page size minus linesize()) and Home/End - (they jump to the top or bottom). - - Scrollbars have step(1) preset (they always return integers). If - desired you can set the step() to non-integer values. You will then - have to use casts to get at the floating-point versions of value() - from Fl_Slider. - - \image html scrollbar.png - \image latex scrollbar.png "Fl_Scrollbar" width=4cm -*/ class FL_EXPORT Fl_Scrollbar : public Fl_Slider { - int linesize_; - int pushed_; - static void timeout_cb(void*); - void increment_cb(); protected: - void draw(); - + + FLTK3_WRAPPER_VCALLS_OBJECT(Scrollbar, draw(), draw(), Draw) + public: - Fl_Scrollbar(int X,int Y,int W,int H, const char *L = 0); - ~Fl_Scrollbar(); - int handle(int); + Fl_Scrollbar() { /* empty */ } + + Fl_Scrollbar(int X,int Y,int W,int H, const char *L = 0) { + _p = new fltk3::Scrollbar(X, Y, W, H, L); + _p->wrapper(this); + } + + FLTK3_WRAPPER_VCALLS_OBJECT_INT(Scrollbar, handle(int event), handle(event), Handle) - /** - Gets the integer value (position) of the slider in the scrollbar. - You can get the floating point value with Fl_Slider::value(). - - \see Fl_Scrollbar::value(int p) - \see Fl_Scrollbar::value(int pos, int size, int first, int total) - */ - int value() const {return int(Fl_Slider::value());} - - /** - Sets the value (position) of the slider in the scrollbar. - - \see Fl_Scrollbar::value() - \see Fl_Scrollbar::value(int pos, int size, int first, int total) - */ - int value(int p) {return int(Fl_Slider::value((double)p));} - - /** - Sets the position, size and range of the slider in the scrollbar. - \param[in] pos position, first line displayed - \param[in] size window size, number of lines displayed - \param[in] first number of first line - \param[in] total total number of lines - - You should call this every time your window changes size, your data - changes size, or your scroll position changes (even if in response - to a callback from this scrollbar). - All necessary calls to redraw() are done. - - Calls Fl_Slider::scrollvalue(int pos, int size, int first, int total). - */ + int value() const { + return ((fltk3::Scrollbar*)_p)->value(); + } + + int value(int p) { + return ((fltk3::Scrollbar*)_p)->value(p); + } + int value(int pos, int size, int first, int total) { - return scrollvalue(pos, size, first, total); + return ((fltk3::Scrollbar*)_p)->value(pos, size, first, total); } + + int linesize() const { + return ((fltk3::Scrollbar*)_p)->linesize(); + } + + void linesize(int i) { + ((fltk3::Scrollbar*)_p)->linesize(i); + } - /** - Get the size of step, in lines, that the arror keys move. - */ - int linesize() const {return linesize_;} - - /** - This number controls how big the steps are that the arrow keys do. - In addition page up/down move by the size last sent to value() - minus one linesize(). The default is 16. - */ - void linesize(int i) {linesize_ = i;} - }; #endif Modified: branches/branch-3.0/FL/filename.H =================================================================== --- branches/branch-3.0/FL/filename.H 2011-06-03 16:08:42 UTC (rev 8776) +++ branches/branch-3.0/FL/filename.H 2011-06-03 16:54:44 UTC (rev 8777) @@ -26,39 +26,19 @@ * http://www.fltk.org/str.php */ -/* Xcode on OS X includes files by recursing down into directories. - * This code catches the cycle and directly includes the required file. - */ -#ifdef fl_dirent_h_cyclic_include -# include "/usr/include/dirent.h" -#endif - #ifndef FL_FILENAME_H -# define FL_FILENAME_H +#define FL_FILENAME_H -# include "Fl_Export.H" +// FIXME: 123 - this is bad because now we can only include this file form a c++ file! +#include <fltk3/filename.h> +#include "Fl_Export.H" -/** \addtogroup filenames File names and URI utility functions - File names and URI functions defined in <FL/filename.H> - @{ */ +#define FL_PATH_MAX 2048 -# define FL_PATH_MAX 2048 /**< all path buffers should use this length */ -/** Gets the file name from a path. - Similar to basename(3), exceptions shown below. - \code - #include <FL/filename.H> - [..] - const char *out; - out = fl_filename_name("/usr/lib"); // out="lib" - out = fl_filename_name("/usr/"); // out="" (basename(3) returns "usr" instead) - out = fl_filename_name("/usr"); // out="usr" - out = fl_filename_name("/"); // out="" (basename(3) returns "/" instead) - out = fl_filename_name("."); // out="." - out = fl_filename_name(".."); // out=".." - \endcode - \return a pointer to the char after the last slash, or to \p filename if there is none. - */ -FL_EXPORT const char *fl_filename_name(const char * filename); +const char *fl_filename_name(const char * filename) { + return fltk3::filename_name(filename); +} + FL_EXPORT const char *fl_filename_ext(const char *buf); FL_EXPORT char *fl_filename_setext(char *to, int tolen, const char *ext); FL_EXPORT int fl_filename_expand(char *to, int tolen, const char *from); @@ -67,19 +47,17 @@ FL_EXPORT int fl_filename_match(const char *name, const char *pattern); FL_EXPORT int fl_filename_isdir(const char *name); -# if defined(__cplusplus) && !defined(FL_DOXYGEN) -/* - * Under WIN32, we include filename.H from numericsort.c; this should probably change... - */ +# if defined(__cplusplus) inline char *fl_filename_setext(char *to, const char *ext) { return fl_filename_setext(to, FL_PATH_MAX, ext); } inline int fl_filename_expand(char *to, const char *from) { return fl_filename_expand(to, FL_PATH_MAX, from); } inline int fl_filename_absolute(char *to, const char *from) { return fl_filename_absolute(to, FL_PATH_MAX, from); } FL_EXPORT int fl_filename_relative(char *to, int tolen, const char *from, const char *cwd); inline int fl_filename_relative(char *to, const char *from) { return fl_filename_relative(to, FL_PATH_MAX, from); } -# endif /* __cplusplus */ +# endif + # if defined(WIN32) && !defined(__CYGWIN__) && !defined(__WATCOMC__) struct dirent {char d_name[1];}; @@ -89,20 +67,6 @@ # include <direct.h> # else -/* - * WARNING: on some systems (very few nowadays?) <dirent.h> may not exist. - * The correct information is in one of these files: - * - * #include <sys/ndir.h> - * #include <sys/dir.h> - * #include <ndir.h> - * - * plus you must do the following #define: - * - * #define dirent direct - * - * It would be best to create a <dirent.h> file that does this... - */ # include <sys/types.h> # define fl_dirent_h_cyclic_include # include <dirent.h> @@ -113,69 +77,30 @@ extern "C" { # endif /* __cplusplus */ -# if !defined(FL_DOXYGEN) FL_EXPORT int fl_alphasort(struct dirent **, struct dirent **); FL_EXPORT int fl_casealphasort(struct dirent **, struct dirent **); FL_EXPORT int fl_casenumericsort(struct dirent **, struct dirent **); FL_EXPORT int fl_numericsort(struct dirent **, struct dirent **); -# endif typedef int (Fl_File_Sort_F)(struct dirent **, struct dirent **); /**< File sorting function. \see fl_filename_list() */ # if defined(__cplusplus) } -/* - * Portable "scandir" function. Ugly but necessary... - */ - FL_EXPORT int fl_filename_list(const char *d, struct dirent ***l, Fl_File_Sort_F *s = fl_numericsort); FL_EXPORT void fl_filename_free_list(struct dirent ***l, int n); -/* - * Generic function to open a Uniform Resource Identifier (URI) using a - * system-defined program (added in FLTK 1.1.8) - */ - FL_EXPORT int fl_open_uri(const char *uri, char *msg = (char *)0, int msglen = 0); -# ifndef FL_DOXYGEN -/* - * _fl_filename_isdir_quick() is a private function that checks for a - * trailing slash and assumes that the passed name is a directory if - * it finds one. This function is used by Fl_File_Browser and - * Fl_File_Chooser to avoid extra stat() calls, but is not supported - * outside of FLTK... - */ int _fl_filename_isdir_quick(const char *name); -# endif # endif /* __cplusplus */ -/* - * FLTK 1.0.x compatibility definitions... - */ -# ifdef FLTK_1_0_COMPAT -# define filename_absolute fl_filename_absolute -# define filename_expand fl_filename_expand -# define filename_ext fl_filename_ext -# define filename_isdir fl_filename_isdir -# define filename_list fl_filename_list -# define filename_match fl_filename_match -# define filename_name fl_filename_name -# define filename_relative fl_filename_relative -# define filename_setext fl_filename_setext -# define numericsort fl_numericsort -# endif /* FLTK_1_0_COMPAT */ - - #endif /* FL_FILENAME_H */ -/** @} */ - /* * End of "$Id$". */ Modified: branches/branch-3.0/fltk3/Adjuster.h =================================================================== --- branches/branch-3.0/fltk3/Adjuster.h 2011-06-03 16:08:42 UTC (rev 8776) +++ branches/branch-3.0/fltk3/Adjuster.h 2011-06-03 16:54:44 UTC (rev 8777) @@ -37,6 +37,8 @@ #include "Valuator.h" +class Fl_Adjuster; + namespace fltk3 { /** @@ -52,6 +54,9 @@ click decrements by 10 times the amount. */ class FLTK3_EXPORT Adjuster : public Valuator { + + friend class ::Fl_Adjuster; + int drag; int ix; int soft_; Modified: branches/branch-3.0/fltk3/Box.h =================================================================== --- branches/branch-3.0/fltk3/Box.h 2011-06-03 16:08:42 UTC (rev 8776) +++ branches/branch-3.0/fltk3/Box.h 2011-06-03 16:54:44 UTC (rev 8777) @@ -33,6 +33,8 @@ #include "Widget.h" +class Fl_Box; + namespace fltk3 { class Widget; @@ -43,6 +45,9 @@ will let you draw a frame around them. */ class FLTK3_EXPORT Box : public fltk3::Widget { + + friend class ::Fl_Box; + protected: void draw(); public: Modified: branches/branch-3.0/fltk3/Scrollbar.h =================================================================== --- branches/branch-3.0/fltk3/Scrollbar.h 2011-06-03 16:08:42 UTC (rev 8776) +++ branches/branch-3.0/fltk3/Scrollbar.h 2011-06-03 16:54:44 UTC (rev 8777) @@ -33,6 +33,8 @@ #include "Slider.h" +class Fl_Scrollbar; + namespace fltk3 { /** @@ -53,6 +55,8 @@ */ class FLTK3_EXPORT Scrollbar : public fltk3::Slider { + friend class ::Fl_Scrollbar; + int linesize_; int pushed_; static void timeout_cb(void*); Modified: branches/branch-3.0/test/demo.cxx =================================================================== --- branches/branch-3.0/test/demo.cxx 2011-06-03 16:08:42 UTC (rev 8776) +++ branches/branch-3.0/test/demo.cxx 2011-06-03 16:54:44 UTC (rev 8777) @@ -82,13 +82,11 @@ choice->add("none"); choice->add("gtk+"); choice->add("plastic"); - choice->add("classic"); choice->callback((fltk3::Callback *)doscheme); fltk3::scheme(NULL); if (!fltk3::scheme()) choice->value(0); else if (!strcmp(fltk3::scheme(), "gtk+")) choice->value(1); - else if (!strcmp(fltk3::scheme(), "plastic")) choice->value(2); - else choice->value(3); + else choice->value(2); obj = new fltk3::Button(10,15,330,380); obj->type(fltk3::HIDDEN_BUTTON); obj->callback(doback); obj = but[0] = new fltk3::Button( 30, 85,90,90); _______________________________________________ fltk-commit mailing list [email protected] http://lists.easysw.com/mailman/listinfo/fltk-commit
