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

Re: c++ and gtk



yeah, without any problems!

the only tricky bit is in the callbacks -- they're all done with function
pointers (which, to my knowledge, is the only way to do them in c) but the
functions all have to be static if they are to be class members.

my code ends up looking like this:

  class MyGtkButton {
  private:
    GtkButton* button_;
  public:
    MyGtkButton(char* title) {
      // initialize button, connect clicked signal, etc...
    }
  private:
    static void clickedSignal(..., gpointer data) {
      // cast data to MyGtkButton (pass the function "this",
      // to have access to members despite being static).
    }
  }

etc.

i guess i forgot some semicolons, but you get the idea :)

dan

On Thu, 10 Jun 1999, The Master Detective wrote:

> can a c++ app use straight gtk? or does it have to use a wrapper like
> gtk--?
> 
> thanks
> 
> 
> 
> 
> http://www.op.net/~finklesk/index.html
> 
> 
> 
> "The problem is not that the world is full of fools. The problem is that
> lightning isn't being distributed right." - Mark Twain
> 
> 
> 
> -- 
>          To unsubscribe: mail gtk-app-devel-list-request@redhat.com with 
>                        "unsubscribe" as the Subject.
> 
> 	Mailing list concerns should be mailed to <listmaster@redhat.com>
> 
> 



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