[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
Re: PROP_TYPE_LIST declaration
- From: Lars Clausen <lrclause cs uiuc edu>
- To: dia-list gnome org
- Subject: Re: PROP_TYPE_LIST declaration
- Date: Thu, 10 Apr 2003 21:19:39 -0500
On Thu, 10 Apr 2003, ashalper@cox.net wrote:
> I was wondering if someone could help me out with a PROP_TYPE_LIST
> declaration (I couldn't find any examples in the CVS code).
There aren't any, in fact.
Note that if your list is static, you may want to use PROP_TYPE_ENUM. I
think it's prettier and easier to deal with (though I may end up changing
the PROP_TYPE_LIST widget (or even removing it -- there's not much
difference between the two, all PROP_TYPE_LIST seems to have going for it
is that it uses GPtrArray)).
> I think I've got my PropDescription struct correct, but I need help on
> the offsets and the declaration in my object struct. The PROP_TYPE_LIST
> macro in properties.h is:
>
> #define PROP_TYPE_LIST "list" /* ListProperty */
> /* (offset is a GPtrArray of (const gchar *). offset2 is a gint, index of the
> active item, -1 if none active.) */
>
> My object struct looks something like:
>
> typedef struct _Independent {
> Element element;
>
> GPtrArray *column_list; /* the ListProperty? */
> .
> .
> .
>
> } Independent;
>
> but I'm missing the index, and I'm not at all sure how to declare the
> PropOffset array correctly.
You need to declare the index within your structure as well:
GPtrArray *column_list; /* The list of items */
int column_list_index; /* The currently selected item */
To declare a ListProp in the PropOffset array, you give it the offset of
both the list and the index:
{ "column_list", PROP_TYPE_LIST, offsetof(Independent, column_list),
offsetof(Independent, column_list_index) },
Remember to create the GPtrArray when you create the array, and set the
index to something reasonable (-1 for no initial selection). You may also
need to do a deep copy of the list when the object gets copied.
-Lars
--
Lars Clausen (http://shasta.cs.uiuc.edu/~lrclause)| HÃ¥rdgrim of Numenor
"I do not agree with a word that you say, but I |----------------------------
will defend to the death your right to say it." | Where are we going, and
--Evelyn Beatrice Hall paraphrasing Voltaire | what's with the handbasket?
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
Mail converted by Mofo Magic and the Flying D
All trademarks and copyrights are the property of
their respective owners.
Related Sites:
eBay Registration |
Bakie Directory |
Directory Owners Forum |
eLoan |
Cash Advance |
OPEN |
OPEN |
OPEN |
FreeCreditReport.com |
Powered by: vBulletin Version 3.5.3,
Copyright ©2000 - 2003, Jelsoft Enterprises Limited.
GuideSMACK