Author: matt
Date: 2011-06-24 13:46:09 -0700 (Fri, 24 Jun 2011)
New Revision: 8840
Log:
123: 'table' test1 compiles (but does not run correctly), not all functions 
wrapped yet, but we are getting close.

Modified:
   branches/branch-3.0/FL/Fl_Table.H
   branches/branch-3.0/FL/Fl_Table_Row.H
   branches/branch-3.0/FL/Fl_Tree.H

Modified: branches/branch-3.0/FL/Fl_Table.H
===================================================================
--- branches/branch-3.0/FL/Fl_Table.H   2011-06-22 21:51:20 UTC (rev 8839)
+++ branches/branch-3.0/FL/Fl_Table.H   2011-06-24 20:46:09 UTC (rev 8840)
@@ -98,109 +98,165 @@
     _p->wrapper(this);
   }
   
-#if 0 // TODO: 123 
-  virtual void clear() { rows(0); cols(0); }
-  void table_box(Fl_Boxtype val);
-  Fl_Boxtype table_box( void );
-#endif
+  Fl_Table() { /* empty */ }
+  
+  /*virtual*/ void clear() { 
+    ((fltk3::Table*)_p)->clear();
+  }
 
+  void table_box(Fl_Boxtype val) {
+    ((fltk3::Table*)_p)->table_box(fltk3::_1to3_boxtype(val));
+  }
+
+  Fl_Boxtype table_box( void ) {
+    return fltk3::_3to1_boxtype( ((fltk3::Table*)_p)->table_box() );
+  }
+
   void rows(int val) {
-    ((Fl_Table*)_p)->rows(val);
+    ((fltk3::Table*)_p)->rows(val);
   }
 
   int rows() {
-    return ((Fl_Table*)_p)->rows();
+    return ((fltk3::Table*)_p)->rows();
   }
 
   void cols(int val) {
-    ((Fl_Table*)_p)->cols(val);
+    ((fltk3::Table*)_p)->cols(val);
   }
 
   int cols() {
-    return ((Fl_Table*)_p)->cols();
+    return ((fltk3::Table*)_p)->cols();
   }
 
-#if 0
-  inline void visible_cells(int& r1, int& r2, int& c1, int& c2);
-  int is_interactive_resize();
-#endif
+  void visible_cells(int& r1, int& r2, int& c1, int& c2) {
+    ((fltk3::Table*)_p)->visible_cells(r1, r2, c1, c2);
+  }
 
+  int is_interactive_resize() {
+    return ((fltk3::Table*)_p)->is_interactive_resize();
+  }
+
   int row_resize() {
-    return ((Fl_Table*)_p)->row_resize();
+    return ((fltk3::Table*)_p)->row_resize();
   }
 
   void row_resize(int flag) {
-    ((Fl_Table*)_p)->row_resize(flag);
+    ((fltk3::Table*)_p)->row_resize(flag);
   }
 
   int col_resize() {
-    return ((Fl_Table*)_p)->col_resize();
+    return ((fltk3::Table*)_p)->col_resize();
   }
 
   void col_resize(int flag) {
-    ((Fl_Table*)_p)->col_resize(flag);
+    ((fltk3::Table*)_p)->col_resize(flag);
   }
 
-#if 0
-  inline int col_resize_min();
-  void col_resize_min(int val);
-  inline int row_resize_min();
-  void row_resize_min(int val);
-#endif
+  int col_resize_min() {
+    return ((fltk3::Table*)_p)->col_resize_min();
+  }
 
+  void col_resize_min(int val) {
+    ((fltk3::Table*)_p)->col_resize_min(val);
+  }
+
+  int row_resize_min() {
+    return ((fltk3::Table*)_p)->row_resize_min();
+  }
+
+  void row_resize_min(int val) {
+    ((fltk3::Table*)_p)->row_resize_min(val);
+  }
+
   int row_header() {
-    return ((Fl_Table*)_p)->row_header();
+    return ((fltk3::Table*)_p)->row_header();
   }
 
   void row_header(int flag) {
-    ((Fl_Table*)_p)->row_header();
+    ((fltk3::Table*)_p)->row_header();
   }
 
   int col_header() {
-    return ((Fl_Table*)_p)->col_header();
+    return ((fltk3::Table*)_p)->col_header();
   }
 
   void col_header(int flag) {
-    ((Fl_Table*)_p)->col_header(flag);
+    ((fltk3::Table*)_p)->col_header(flag);
   }
 
-#if 0
-  inline void col_header_height(int height);
-  inline int col_header_height();
-  inline void row_header_width(int width);
-  inline int row_header_width();
-#endif
+  void col_header_height(int height) {
+    ((fltk3::Table*)_p)->col_header_height(height);
+  }
 
+  int col_header_height() {
+    return ((fltk3::Table*)_p)->col_header_height();
+  }
+
+  void row_header_width(int width) {
+    ((fltk3::Table*)_p)->row_header_width(width);
+  }
+
+  int row_header_width() {
+    return ((fltk3::Table*)_p)->row_header_width();
+  }
+
   void row_header_color(Fl_Color val) {
-    ((Fl_Table*)_p)->row_header_color(fltk3::_1to3_color(val));
+    ((fltk3::Table*)_p)->row_header_color(fltk3::_1to3_color(val));
   }
 
   Fl_Color row_header_color() {
-    return fltk3::_3to1_color( ((Fl_Table*)_p)->row_header_color() );
+    return fltk3::_3to1_color( ((fltk3::Table*)_p)->row_header_color() );
   }
 
-#if 0
-  inline void col_header_color(Fl_Color val);
-  inline Fl_Color col_header_color();
-  void row_height(int row, int height);
-  inline int row_height(int row);
-  void col_width(int col, int width);
-  inline int col_width(int col);
-#endif
+  void col_header_color(Fl_Color val) {
+    ((fltk3::Table*)_p)->col_header_color(fltk3::_1to3_color(val));
+  }
 
+  inline Fl_Color col_header_color() {
+    return fltk3::_3to1_color( ((fltk3::Table*)_p)->col_header_color() );
+  }
+
+  void row_height(int row, int height) {
+    ((fltk3::Table*)_p)->row_height(row, height);
+  }
+
+  int row_height(int row) {
+    return ((fltk3::Table*)_p)->row_height(row);
+  }
+
+  void col_width(int col, int width) {
+    ((fltk3::Table*)_p)->col_width(col, width);
+  }
+
+  int col_width(int col) {
+    return ((fltk3::Table*)_p)->col_width(col);
+  }
+
   void row_height_all(int height) {
-    ((Fl_Table*)_p)->row_height_all(height);
+    ((fltk3::Table*)_p)->row_height_all(height);
   }
 
   void col_width_all(int width) {
-    ((Fl_Table*)_p)->col_width_all(width);
+    ((fltk3::Table*)_p)->col_width_all(width);
   }
 
+  void row_position(int row) {
+    ((fltk3::Table*)_p)->row_position(row);
+  }
+
+  void col_position(int col) {
+    ((fltk3::Table*)_p)->col_position(col);
+  }
+
+  int row_position() {
+    return ((fltk3::Table*)_p)->row_position();
+  }
+
+  int col_position() {
+    return ((fltk3::Table*)_p)->col_position();
+  }
+
 #if 0
-  void row_position(int row);                  // set/get table's current 
scroll position
-  void col_position(int col);
-  int row_position() {                         // current row position
-  int col_position() {                         // current col position
   inline void top_row(int row) {               // set/get top row (deprecated)
   inline int top_row() {
   int is_selected(int r, int c);               // selected cell
@@ -222,9 +278,21 @@
   int children() const {
   int find(const Fl_Widget *w) const {
   int find(const Fl_Widget &w) const {
+#endif
+
   int callback_row() {
+    return ((fltk3::Table*)_p)->callback_row();
+  }
+
   int callback_col() {
-  TableContext callback_context() {
+    return ((fltk3::Table*)_p)->callback_col();
+  }
+
+  TableContext callback_context() { 
+    return (TableContext)((fltk3::Table*)_p)->callback_context();
+  }
+
+#if 0
   void do_callback(TableContext context, int row, int col) {
 #endif
     

Modified: branches/branch-3.0/FL/Fl_Table_Row.H
===================================================================
--- branches/branch-3.0/FL/Fl_Table_Row.H       2011-06-22 21:51:20 UTC (rev 
8839)
+++ branches/branch-3.0/FL/Fl_Table_Row.H       2011-06-24 20:46:09 UTC (rev 
8840)
@@ -1,4 +1,3 @@
-#error header has not been ported to 3.0 yet
 //
 // "$Id$"
 //
@@ -33,127 +32,36 @@
 //
 //
 
+#include <fltk3/TableRow.h>
 #include "Fl_Table.H"
 
-/**
- A table with row selection capabilities.
- 
- This class implements a simple table with the ability to select
- rows.  This widget is similar to an Fl_Browser with columns.  Most
- methods of importance will be found in the Fl_Table widget, such
- as Fl_Table::rows() and Fl_Table::cols().
- 
- To be useful it must be subclassed and at minimum the draw_cell()
- method must be overridden to provide the content of the cells. This widget
- does \em not manage the cell's data content; it is up to the parent
- class's draw_cell() method override to provide this.
- 
- Events on the cells and/or headings generate callbacks when they are 
- clicked by the user.  You control when events are generated based on
- the values you supply for Fl_Table::when().
- */
 class FL_EXPORT Fl_Table_Row : public Fl_Table {
+
 public:
+
   enum TableRowSelectMode {
     SELECT_NONE,               // no selection allowed
     SELECT_SINGLE,             // single row selection
     SELECT_MULTI               // multiple row selection (default)
   }; 
-private:
-  // An STL-ish vector without templates
-  class FL_EXPORT CharVector {
-    char *arr;
-    int _size;
-    void init() {
-      arr = NULL;
-      _size = 0;
-    }
-    void copy(char *newarr, int newsize) {
-      size(newsize);
-      memcpy(arr, newarr, newsize * sizeof(char));
-    }
-  public:
-    CharVector() {                             // CTOR
-      init();
-    }
-    ~CharVector() {                            // DTOR
-      if ( arr ) free(arr);
-      arr = NULL;
-    }
-    CharVector(CharVector&o) {                 // COPY CTOR
-      init();
-      copy(o.arr, o._size);
-    }
-    CharVector& operator=(CharVector&o) {      // ASSIGN
-      init();
-      copy(o.arr, o._size);
-      return(*this);
-    }
-    char operator[](int x) const {
-      return(arr[x]);
-    }
-    char& operator[](int x) {
-      return(arr[x]);
-    }
-    int size() {
-      return(_size);
-    }
-    void size(int count) {
-      if ( count != _size ) {
-        arr = (char*)realloc(arr, count * sizeof(char));
-        _size = count;
-      }
-    }
-    char pop_back() {
-      char tmp = arr[_size-1];
-      _size--;
-      return(tmp);
-    }
-    void push_back(char val) {
-      int x = _size;
-      size(_size+1);
-      arr[x] = val;
-    }
-    char back() {
-      return(arr[_size-1]);
-    }
-  };
-  CharVector _rowselect;               // selection flag for each row
-  
-  // handle() state variables.
-  //    Put here instead of local statics in handle(), so more
-  //    than one instance can exist without crosstalk between.
-  //
-  int _dragging_select;                // dragging out a selection?
-  int _last_row;
-  int _last_y;                 // last event's Y position
-  int _last_push_x;            // last PUSH event's X position
-  int _last_push_y;            // last PUSH event's Y position
-  
-  TableRowSelectMode _selectmode;
-  
+
+#if 0 // FIXME: 123
 protected:
   int handle(int event);
   int find_cell(TableContext context,          // find cell's x/y/w/h given r/c
                 int R, int C, int &X, int &Y, int &W, int &H) {
     return(Fl_Table::find_cell(context, R, C, X, Y, W, H));
   }
-  
+#endif
+ 
 public:
-  /**
-   The constructor for the Fl_Table_Row.
-   This creates an empty table with no rows or columns,
-   with headers and row/column resize behavior disabled.
-   */   
-  Fl_Table_Row(int X, int Y, int W, int H, const char *l=0) : 
Fl_Table(X,Y,W,H,l) {
-    _dragging_select = 0;
-    _last_row        = -1;
-    _last_y          = -1;
-    _last_push_x     = -1;
-    _last_push_y     = -1;
-    _selectmode      = SELECT_MULTI;
+
+  Fl_Table_Row(int X, int Y, int W, int H, const char *l=0)  {
+    _p = new fltk3::TableRow(X, Y, W, H, l);
+    _p->wrapper(this);
   }
   
+#if 0 // FIXME: 123
   /**
    The destructor for the Fl_Table_Row.
    Destroys the table and its associated widgets.
@@ -183,8 +91,13 @@
    change the selection of a row by clicking on it, or by using
    select_row(row, flag)
    */
-  int row_selected(int row);           // is row selected? (0=no, 1=yes, 
-1=range err)
+#endif
+
+  int row_selected(int row) {
+    return ((fltk3::TableRow*)_p)->row_selected(row);
+  }
   
+#if 0 // FIXME: 123
   /**
    Changes the selection state for 'row', depending on the value
    of 'flag'.  0=deselected, 1=select, 2=toggle existing state.
@@ -203,6 +116,8 @@
     cols(0);
     Fl_Table::clear(); // clear the table
   }
+#endif
+
 };
 
 #endif /*_FL_TABLE_ROW_H*/

Modified: branches/branch-3.0/FL/Fl_Tree.H
===================================================================
--- branches/branch-3.0/FL/Fl_Tree.H    2011-06-22 21:51:20 UTC (rev 8839)
+++ branches/branch-3.0/FL/Fl_Tree.H    2011-06-24 20:46:09 UTC (rev 8840)
@@ -213,22 +213,41 @@
   }
   void show_self() {
   }
+#endif
+
   Fl_Fontsize item_labelsize() const {
+    return fltk3::_3to1_fontsize( ((fltk3::Tree*)_p)->item_labelsize() );
   }
+
   void item_labelsize(Fl_Fontsize val) {
+    ((fltk3::Tree*)_p)->item_labelsize( fltk3::_1to3_fontsize(val) );
   }
+
   Fl_Font item_labelfont() const {
+    return fltk3::_3to1_font( ((fltk3::Tree*)_p)->item_labelfont() );
   }
+
   void item_labelfont(Fl_Font val) {
+    ((fltk3::Tree*)_p)->item_labelfont( fltk3::_1to3_font(val) );
   }
+
   Fl_Color item_labelfgcolor(void) const {
+    return fltk3::_3to1_color( ((fltk3::Tree*)_p)->item_labelfgcolor() );
   }
+
   void item_labelfgcolor(Fl_Color val) {
+    ((fltk3::Tree*)_p)->item_labelfgcolor( fltk3::_1to3_color(val) );
   }
+
   Fl_Color item_labelbgcolor(void) const {
+    return fltk3::_3to1_color( ((fltk3::Tree*)_p)->item_labelbgcolor() );
   }
+
   void item_labelbgcolor(Fl_Color val) {
+    ((fltk3::Tree*)_p)->item_labelbgcolor( fltk3::_1to3_color(val) );
   }
+
+#if 0
   Fl_Color connectorcolor() const {
   }
   void connectorcolor(Fl_Color val) {
@@ -249,10 +268,17 @@
   }
   void connectorwidth(int val) {
   }
+#endif
+
   Fl_Image *usericon() const {
+    return fltk3::_3to1_image( ((fltk3::Tree*)_p)->usericon() );
   }
+
   void usericon(Fl_Image *val) {
+    ((fltk3::Tree*)_p)->usericon( fltk3::_1to3_image(val) );
   }
+
+#if 0
   Fl_Image *openicon() const {
   }
   void openicon(Fl_Image *val) {
@@ -273,10 +299,17 @@
   }
   void connectorstyle(Fl_Tree_Connector val) {
   }
+#endif 
+
   Fl_Tree_Sort sortorder() const {
+    return (Fl_Tree_Sort)((fltk3::Tree*)_p)->sortorder();
   }
+
   void sortorder(Fl_Tree_Sort val) {
+    ((fltk3::Tree*)_p)->sortorder( (fltk3::TreeSort)val );
   }
+
+#if 0
   Fl_Boxtype selectbox() const {
   }
   void selectbox(Fl_Boxtype val) {
@@ -306,18 +339,26 @@
     ((fltk3::Tree*)_p)->scrollbar_size(size);
   }   
   
-#if 0
   void callback_item(Fl_Tree_Item* item) {
+    ((fltk3::Tree*)_p)->callback_item((fltk3::TreeItem*)item);
   }
+
   Fl_Tree_Item* callback_item() {
+    return (Fl_Tree_Item*)((fltk3::Tree*)_p)->callback_item();
   }
+
   void callback_reason(Fl_Tree_Reason reason) {
+    ((fltk3::Tree*)_p)->callback_reason((fltk3::TreeReason)reason);
   }
+
   Fl_Tree_Reason callback_reason() const {
+    return (Fl_Tree_Reason)((fltk3::Tree*)_p)->callback_reason();
   }
-  void load(class Fl_Preferences&);
-#endif
-  
+
+  void load(class Fl_Preferences &p) {
+    ((fltk3::Tree*)_p)->load((fltk3::Preferences&)p);
+  }  
+
 };
 
 #endif /*FL_TREE_H*/

_______________________________________________
fltk-commit mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-commit

Reply via email to