(1) How to implement Image Buttons without gaps? (2) Can GtkImage stretch an image automatically?
- From: Daniel Yek <dyek real com>
- To: gtk-devel-list gnome org
- Subject: (1) How to implement Image Buttons without gaps? (2) Can GtkImage stretch an image automatically?
- Date: Wed, 20 Aug 2008 17:07:00 -0700
[I sent this gtk-app-devel-list earlier, but I suppose this list might
have an answer for me.
I'm just trying to figure things out...]
Hi,
(1) I have been looking for a way to use GtkButton to create an Image
Button that is exactly of the same size as the GtkImage that it
contains, so that two Image Buttons next to each others would leave no
gap in between.
I have some ideas in mind, but I wonder if I'm going to over-engineering
them and if there is a well-known approach to solve this, supposedly,
common problem.
For this first issue, this is the main idea that I am considering to
investigate:
(1a) Subclassing GtkButton and force it to allocate the size of the
GtkImage it contains and overwrite all its drawing functionalities that
cause non-image area to appear around GtkImage. If focus or default
lines are to be drawn, draw them on the inside edge of GtkImage or
suppress them entirely if necessary.
I haven't looked into GtkButton source code lately, but I think this
approach can potentially boil down to reimplementing the entire button
from scratch to derive from GtkWidget, if GtkButton turns out to not
allow a subclass to override certain drawing function. Reimplementing a
new button widget can cause deviation in functionalities in future GTK+
releases and I want to avoid if there is a better solution available.
I am hoping someone would point out to me an easier way to accomplish this.
If GtkButton simply is not able to function as Image Buttons without
gap, I wonder if GTK+ developers considered the usage during the process
of GtkButton implementation/development? I wonder if the usage model was
intentionally excluded (for reasons that I am obviously not sure of --
maybe for memory efficiency reasons; or for theming reasons)? Or is it
simply the case that it wasn't implemented yet? Or is this usage model
really unusual?
(2) I implemented image tiling using lower-level APIs before. However, I
thought it was odd that tiling or stretching functionalities are missing
from GtkImage. Is there a widget that can tile/stretch, for display, an
image to cover its allocated size automatically?
If not, are there popular approaches used to implement this
functionality, other than using low-level drawing APIs?
Insights are very much appreciated. Thanks.
--
Daniel Yek.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]