Re: gtk custom widgets



On Thu, Oct 21, 2004 at 04:08:46PM +0800, Daniel Piccoli wrote:

the main reason I'm creating a new widget is to enable me to store a
struct that contains info about a sound file that is displayed by this
widget. I don't see any other way to do it. If I don't create a
composite widget, this struct data will be lost once the signal handler
function which creates it completes.

You could also just declare your struct as static at the toplevel of your C
file. This is a perfectly legitimate and modular programming practice if you
limit the file to the functions that the struct is used in (i.e., you want
to make the scope of the global variable only as large as neccessary; the
static keyword makes it private to the C file.)

See also 

http://www.accu.org/acornsig/public/articles/oop_c.html

for a simple way to do object-based programming in C using opaque structs.

Dave Cook





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]