Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Phase

Retreiving GtkWidget geometry?

This topic is 5225 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey. How can I retrieve the size (width, height) of a GtkWidget? I''ve tried gtk_widget_size_request and gdk_window_get_size, but it seems like they only work if you have set that size with gtk_widget_set_size_request? Isn''t there another way to retrieve the size without setting the size with gtk_widget_set_size_request? Regards, phase

Share this post


Link to post
Share on other sites
Advertisement
GtkWidget has a member named "allocation" that stores the dimensions of the widget. While there isn''t an accessor function like most "public" members in GTK+, it is a public member of the structure as far as I can tell. I think it''s only valid while the widget is realized (see GTK_WIDGET_REALIZED and gtk_widget_realize to check and force realization, respectively). You can connect to the "size-allocate" signal to track changes to the size of a widget.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!