Hi Attached, patches to implement ListItem. This class, in wxruby 0.6.0, allows styling of individual items in a ListCtrl, via a particularly clunky API. In disambiguating the overloaded ListCtrl#set_item method it introduces one non backwards-compatible change. I''ve followed the WxPython convention as described in the Wx class ref, renaming set_item(index, col, string, imageid) to set_item_string. One thing that doesn''t work is the constants LIST_FORMAT_LEFT etc. I''m not sure if it''s the same problem I''m seeing with some other groups of constants since upgrading to SWIG 1.3.29, but constants declarations like enum wxListColumnFormat { .... enum wxSystemColour { ... seem to be broken. Lastly, would it be possible and desirable to move class-specific constants (like TE_xxx, SYS_xxx, LIST_xxx, NB_xxx etc) from RubyConstants.i to the relevant .i file in swig/classes? Nothing urgent, just a suggestion as RubyConstants.i is getting unwieldy. alex _______________________________________________ wxruby-users mailing list wxruby-users@rubyforge.org http://rubyforge.org/mailman/listinfo/wxruby-users
On Tue, 2006-03-28 at 01:32 +0100, Alex Fenton wrote:> Lastly, would it be possible and desirable to move > class-specific constants (like TE_xxx, SYS_xxx, LIST_xxx, > NB_xxx etc) from RubyConstants.i to the relevant .i file > in swig/classes? Nothing urgent, just a suggestion as > RubyConstants.i is getting unwieldy.I think so. At least when there is one unambiguous place that each group of constants should go. Another option would be to have multiple .i files for constants, one per category. I''m not sure if that''s a big improvement. Kevin
Alex, I know I added ListItem earlier tonight, but not from these patches. Can you let me know if some or all of this should still be applied, or if it''s now stale? Thanks/sorry, Kevin On Tue, 2006-03-28 at 01:32 +0100, Alex Fenton wrote:> Hi > > Attached, patches to implement ListItem. This class, in wxruby 0.6.0, allows styling of individual items in a ListCtrl, via a particularly clunky API. In disambiguating the overloaded ListCtrl#set_item method it introduces one non backwards-compatible change. I''ve followed the WxPython convention as described in the Wx class ref, renaming set_item(index, col, string, imageid) to set_item_string. > > One thing that doesn''t work is the constants LIST_FORMAT_LEFT etc. I''m not sure if it''s the same problem I''m seeing with some other groups of constants since upgrading to SWIG 1.3.29, but constants declarations like > > enum wxListColumnFormat { > .... > enum wxSystemColour { > ... > > seem to be broken. > > Lastly, would it be possible and desirable to move class-specific constants (like TE_xxx, SYS_xxx, LIST_xxx, NB_xxx etc) from RubyConstants.i to the relevant .i file in swig/classes? Nothing urgent, just a suggestion as RubyConstants.i is getting unwieldy. > > alex > plain text document attachment (RubyConstants.patch) > Index: wxruby2/swig/RubyConstants.i > ==================================================================> RCS file: /var/cvs/wxruby/wxruby2/swig/RubyConstants.i,v > retrieving revision 1.18 > diff -b -u -r1.18 RubyConstants.i > --- wxruby2/swig/RubyConstants.i 29 Nov 2005 00:48:20 -0000 1.18 > +++ wxruby2/swig/RubyConstants.i 28 Mar 2006 00:20:15 -0000 > @@ -14,6 +14,7 @@ > #include <wx/calctrl.h> > #include <wx/treebase.h> > #include <wx/imaglist.h> > +#include <wx/listbase.h> > > // > // All of these exist on only one platform, so in those > @@ -1480,6 +1481,92 @@ > > // for compatibility only > #define wxLC_USER_TEXT wxLC_VIRTUAL > +#define wxLIST_MASK_STATE 0x0001 > +#define wxLIST_MASK_TEXT 0x0002 > +#define wxLIST_MASK_IMAGE 0x0004 > +#define wxLIST_MASK_DATA 0x0008 > +#define wxLIST_SET_ITEM 0x0010 > +#define wxLIST_MASK_WIDTH 0x0020 > +#define wxLIST_MASK_FORMAT 0x0040 > + > +// State flags for indicating the state of an item > +#define wxLIST_STATE_DONTCARE 0x0000 > +#define wxLIST_STATE_DROPHILITED 0x0001 // MSW only > +#define wxLIST_STATE_FOCUSED 0x0002 > +#define wxLIST_STATE_SELECTED 0x0004 > +#define wxLIST_STATE_CUT 0x0008 // MSW only > +#define wxLIST_STATE_DISABLED 0x0010 // OS2 only > +#define wxLIST_STATE_FILTERED 0x0020 // OS2 only > +#define wxLIST_STATE_INUSE 0x0040 // OS2 only > +#define wxLIST_STATE_PICKED 0x0080 // OS2 only > +#define wxLIST_STATE_SOURCE 0x0100 // OS2 only > + > +// Hit test flags, used in HitTest > +#define wxLIST_HITTEST_ABOVE 0x0001 // Above the client area. > +#define wxLIST_HITTEST_BELOW 0x0002 // Below the client area. > +#define wxLIST_HITTEST_NOWHERE 0x0004 // In the client area but below the last item. > +#define wxLIST_HITTEST_ONITEMICON 0x0020 // On the bitmap associated with an item. > +#define wxLIST_HITTEST_ONITEMLABEL 0x0080 // On the label (string) associated with an item. > +#define wxLIST_HITTEST_ONITEMRIGHT 0x0100 // In the area to the right of an item. > +#define wxLIST_HITTEST_ONITEMSTATEICON 0x0200 // On the state icon for a tree view item that is in a user-defined state. > +#define wxLIST_HITTEST_TOLEFT 0x0400 // To the left of the client area. > +#define wxLIST_HITTEST_TORIGHT 0x0800 // To the right of the client area. > + > +#define wxLIST_HITTEST_ONITEM (wxLIST_HITTEST_ONITEMICON | wxLIST_HITTEST_ONITEMLABEL | wxLIST_HITTEST_ONITEMSTATEICON) > + > +// Flags for GetNextItem (MSW only except wxLIST_NEXT_ALL) > +enum > +{ > + wxLIST_NEXT_ABOVE, // Searches for an item above the specified item > + wxLIST_NEXT_ALL, // Searches for subsequent item by index > + wxLIST_NEXT_BELOW, // Searches for an item below the specified item > + wxLIST_NEXT_LEFT, // Searches for an item to the left of the specified item > + wxLIST_NEXT_RIGHT // Searches for an item to the right of the specified item > +}; > + > +// Alignment flags for Arrange (MSW only except wxLIST_ALIGN_LEFT) > +enum > +{ > + wxLIST_ALIGN_DEFAULT, > + wxLIST_ALIGN_LEFT, > + wxLIST_ALIGN_TOP, > + wxLIST_ALIGN_SNAP_TO_GRID > +}; > + > +// Column format (MSW only except wxLIST_FORMAT_LEFT) > +enum wxListColumnFormat > +{ > + wxLIST_FORMAT_LEFT, > + wxLIST_FORMAT_RIGHT, > + wxLIST_FORMAT_CENTRE, > + wxLIST_FORMAT_CENTER = wxLIST_FORMAT_CENTRE > +}; > + > +// Autosize values for SetColumnWidth > +enum > +{ > + wxLIST_AUTOSIZE = -1, > + wxLIST_AUTOSIZE_USEHEADER = -2 // partly supported by generic version > +}; > + > +// Flag values for GetItemRect > +enum > +{ > + wxLIST_RECT_BOUNDS, > + wxLIST_RECT_ICON, > + wxLIST_RECT_LABEL > +}; > + > +// Flag values for FindItem (MSW only) > +enum > +{ > + wxLIST_FIND_UP, > + wxLIST_FIND_DOWN, > + wxLIST_FIND_LEFT, > + wxLIST_FIND_RIGHT > +}; > + > + > > //** ---------------------------------------------------------------------------- ** > // Start constants from wx/button.h > plain text document attachment (ListCtrl.patch) > Index: wxruby2/swig/classes/ListCtrl.i > ==================================================================> RCS file: /var/cvs/wxruby/wxruby2/swig/classes/ListCtrl.i,v > retrieving revision 1.6 > diff -b -u -r1.6 ListCtrl.i > --- wxruby2/swig/classes/ListCtrl.i 21 Aug 2005 01:55:44 -0000 1.6 > +++ wxruby2/swig/classes/ListCtrl.i 28 Mar 2006 00:18:27 -0000 > @@ -3,12 +3,15 @@ > > %include "../common.i" > > +%module(directors="1") wxListCtrl > + > +%rename(SetItemString) wxListCtrl::SetItem(long index, int col, const wxString& label, int imageId = -1); > + > %{ > #include <wx/wx.h> > #include <wx/listctrl.h> > %} > > -%module(directors="1") wxListCtrl > > %ignore wxListCtrl::wxListCtrl(); > // > @@ -21,6 +24,7 @@ > > > > + > %import "include/wxObject.h" > %import "include/wxEvtHandler.h" > %import "include/wxWindow.h" > plain text document attachment (ListItem.i) > # Copyright 2004-2005 by Kevin Smith > # released under the MIT-style wxruby2 license > > %include "../common.i" > > %{ > #include <wx/wx.h> > #include <wx/listctrl.h> > #include <wx/listbase.h> > %} > > %module(directors="1") wxListItem > %ignore wxListItem::GetText; > > > %import "include/wxObject.h" > > > %include "include/wxListItem.h" > > _______________________________________________ > wxruby-users mailing list > wxruby-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/wxruby-users
Hi Kevin I think some of it is still relevant to CVS HEAD: - the patch to RubyConstants.i adds the LIST_*constants for styling ListItem - the patch to ListCtrl.i disambiguates two methods of calling set_item thanks alex Kevin Smith wrote:> Alex, > > I know I added ListItem earlier tonight, but not from these patches. > > Can you let me know if some or all of this should still be applied, or > if it''s now stale? > > Thanks/sorry, > > Kevin > > > > On Tue, 2006-03-28 at 01:32 +0100, Alex Fenton wrote: > >> Hi >> >> Attached, patches to implement ListItem. This class, in wxruby 0.6.0, allows styling of individual items in a ListCtrl, via a particularly clunky API. In disambiguating the overloaded ListCtrl#set_item method it introduces one non backwards-compatible change. I''ve followed the WxPython convention as described in the Wx class ref, renaming set_item(index, col, string, imageid) to set_item_string. >> >> One thing that doesn''t work is the constants LIST_FORMAT_LEFT etc. I''m not sure if it''s the same problem I''m seeing with some other groups of constants since upgrading to SWIG 1.3.29, but constants declarations like >> >> enum wxListColumnFormat { >> .... >> enum wxSystemColour { >> ... >> >> seem to be broken. >> >> Lastly, would it be possible and desirable to move class-specific constants (like TE_xxx, SYS_xxx, LIST_xxx, NB_xxx etc) from RubyConstants.i to the relevant .i file in swig/classes? Nothing urgent, just a suggestion as RubyConstants.i is getting unwieldy. >> >> alex >> plain text document attachment (RubyConstants.patch) >> Index: wxruby2/swig/RubyConstants.i >> ==================================================================>> RCS file: /var/cvs/wxruby/wxruby2/swig/RubyConstants.i,v >> retrieving revision 1.18 >> diff -b -u -r1.18 RubyConstants.i >> --- wxruby2/swig/RubyConstants.i 29 Nov 2005 00:48:20 -0000 1.18 >> +++ wxruby2/swig/RubyConstants.i 28 Mar 2006 00:20:15 -0000 >> @@ -14,6 +14,7 @@ >> #include <wx/calctrl.h> >> #include <wx/treebase.h> >> #include <wx/imaglist.h> >> +#include <wx/listbase.h> >> >> // >> // All of these exist on only one platform, so in those >> @@ -1480,6 +1481,92 @@ >> >> // for compatibility only >> #define wxLC_USER_TEXT wxLC_VIRTUAL >> +#define wxLIST_MASK_STATE 0x0001 >> +#define wxLIST_MASK_TEXT 0x0002 >> +#define wxLIST_MASK_IMAGE 0x0004 >> +#define wxLIST_MASK_DATA 0x0008 >> +#define wxLIST_SET_ITEM 0x0010 >> +#define wxLIST_MASK_WIDTH 0x0020 >> +#define wxLIST_MASK_FORMAT 0x0040 >> + >> +// State flags for indicating the state of an item >> +#define wxLIST_STATE_DONTCARE 0x0000 >> +#define wxLIST_STATE_DROPHILITED 0x0001 // MSW only >> +#define wxLIST_STATE_FOCUSED 0x0002 >> +#define wxLIST_STATE_SELECTED 0x0004 >> +#define wxLIST_STATE_CUT 0x0008 // MSW only >> +#define wxLIST_STATE_DISABLED 0x0010 // OS2 only >> +#define wxLIST_STATE_FILTERED 0x0020 // OS2 only >> +#define wxLIST_STATE_INUSE 0x0040 // OS2 only >> +#define wxLIST_STATE_PICKED 0x0080 // OS2 only >> +#define wxLIST_STATE_SOURCE 0x0100 // OS2 only >> + >> +// Hit test flags, used in HitTest >> +#define wxLIST_HITTEST_ABOVE 0x0001 // Above the client area. >> +#define wxLIST_HITTEST_BELOW 0x0002 // Below the client area. >> +#define wxLIST_HITTEST_NOWHERE 0x0004 // In the client area but below the last item. >> +#define wxLIST_HITTEST_ONITEMICON 0x0020 // On the bitmap associated with an item. >> +#define wxLIST_HITTEST_ONITEMLABEL 0x0080 // On the label (string) associated with an item. >> +#define wxLIST_HITTEST_ONITEMRIGHT 0x0100 // In the area to the right of an item. >> +#define wxLIST_HITTEST_ONITEMSTATEICON 0x0200 // On the state icon for a tree view item that is in a user-defined state. >> +#define wxLIST_HITTEST_TOLEFT 0x0400 // To the left of the client area. >> +#define wxLIST_HITTEST_TORIGHT 0x0800 // To the right of the client area. >> + >> +#define wxLIST_HITTEST_ONITEM (wxLIST_HITTEST_ONITEMICON | wxLIST_HITTEST_ONITEMLABEL | wxLIST_HITTEST_ONITEMSTATEICON) >> + >> +// Flags for GetNextItem (MSW only except wxLIST_NEXT_ALL) >> +enum >> +{ >> + wxLIST_NEXT_ABOVE, // Searches for an item above the specified item >> + wxLIST_NEXT_ALL, // Searches for subsequent item by index >> + wxLIST_NEXT_BELOW, // Searches for an item below the specified item >> + wxLIST_NEXT_LEFT, // Searches for an item to the left of the specified item >> + wxLIST_NEXT_RIGHT // Searches for an item to the right of the specified item >> +}; >> + >> +// Alignment flags for Arrange (MSW only except wxLIST_ALIGN_LEFT) >> +enum >> +{ >> + wxLIST_ALIGN_DEFAULT, >> + wxLIST_ALIGN_LEFT, >> + wxLIST_ALIGN_TOP, >> + wxLIST_ALIGN_SNAP_TO_GRID >> +}; >> + >> +// Column format (MSW only except wxLIST_FORMAT_LEFT) >> +enum wxListColumnFormat >> +{ >> + wxLIST_FORMAT_LEFT, >> + wxLIST_FORMAT_RIGHT, >> + wxLIST_FORMAT_CENTRE, >> + wxLIST_FORMAT_CENTER = wxLIST_FORMAT_CENTRE >> +}; >> + >> +// Autosize values for SetColumnWidth >> +enum >> +{ >> + wxLIST_AUTOSIZE = -1, >> + wxLIST_AUTOSIZE_USEHEADER = -2 // partly supported by generic version >> +}; >> + >> +// Flag values for GetItemRect >> +enum >> +{ >> + wxLIST_RECT_BOUNDS, >> + wxLIST_RECT_ICON, >> + wxLIST_RECT_LABEL >> +}; >> + >> +// Flag values for FindItem (MSW only) >> +enum >> +{ >> + wxLIST_FIND_UP, >> + wxLIST_FIND_DOWN, >> + wxLIST_FIND_LEFT, >> + wxLIST_FIND_RIGHT >> +}; >> + >> + >> >> //** ---------------------------------------------------------------------------- ** >> // Start constants from wx/button.h >> plain text document attachment (ListCtrl.patch) >> Index: wxruby2/swig/classes/ListCtrl.i >> ==================================================================>> RCS file: /var/cvs/wxruby/wxruby2/swig/classes/ListCtrl.i,v >> retrieving revision 1.6 >> diff -b -u -r1.6 ListCtrl.i >> --- wxruby2/swig/classes/ListCtrl.i 21 Aug 2005 01:55:44 -0000 1.6 >> +++ wxruby2/swig/classes/ListCtrl.i 28 Mar 2006 00:18:27 -0000 >> @@ -3,12 +3,15 @@ >> >> %include "../common.i" >> >> +%module(directors="1") wxListCtrl >> + >> +%rename(SetItemString) wxListCtrl::SetItem(long index, int col, const wxString& label, int imageId = -1); >> + >> %{ >> #include <wx/wx.h> >> #include <wx/listctrl.h> >> %} >> >> -%module(directors="1") wxListCtrl >> >> %ignore wxListCtrl::wxListCtrl(); >> // >> @@ -21,6 +24,7 @@ >> >> >> >> + >> %import "include/wxObject.h" >> %import "include/wxEvtHandler.h" >> %import "include/wxWindow.h" >> plain text document attachment (ListItem.i) >> # Copyright 2004-2005 by Kevin Smith >> # released under the MIT-style wxruby2 license >> >> %include "../common.i" >> >> %{ >> #include <wx/wx.h> >> #include <wx/listctrl.h> >> #include <wx/listbase.h> >> %} >> >> %module(directors="1") wxListItem >> %ignore wxListItem::GetText; >> >> >> %import "include/wxObject.h" >> >> >> %include "include/wxListItem.h" >> >> _______________________________________________ >> wxruby-users mailing list >> wxruby-users at rubyforge.org >> http://rubyforge.org/mailman/listinfo/wxruby-users >> > > _______________________________________________ > wxruby-users mailing list > wxruby-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/wxruby-users > > >