Proposal: ( was Re: [gtk-list] spinbuttons more flexible look-wise? )



Adrian Likins wrote:
> 	Howdy. Been playing with using some spinbuttons for dialogs in the
> gimp, and while I found them very useful, I was wondering if there was anyway
> to perhaps make the appearence more flexible. In particular, I'm thinking
> about the pane that surronds the arrows. I would like the option to turn this
> pane off (or set the shadow type somehow). 
>

I've come across a possible excuse to think about rewriting the innards
of GtkSpinbutton. My reason for wanting to do this will be outlined below,
but it might offer a good solution to Adrian and maybe others too.

I'm writing a program to allow the viewing and editing of routes and
waypoints obtained from Garmin GPS receivers. In time I hope to be able
to deal with all sorts of other GPS receiver output too. Right now I've
got as far as a map viewer. It even knows about the outline of the British
Isles (thanks to the CIA World Book!), other countries and lands to follow
of course.

Anyway, back to spin buttons. I've written a widget (which may later be
useful to distribute) which consists of two spin buttons, one for Longitude
and one for Latitude. Below them is a button which pops up a list of waypoints
to allow the user to jump straight to a named point. Trouble is that
though the 'up' and 'down' buttons of the Lat and Long spin buttons allow
the user to pan around the map display, I want to arrange those up and
down buttons myself into a 'pad' of four buttons in the obvious "X, Y, Up
and Down" arrangement.

So what I thought was: why not rewrite GtkSpinbutton so that it is just
a special case of a more generic widget (called "GtkSpinner", say). All
the work of being a spin-button is done by GtkSpinner, and all that
GtkSpinbutton now does is to pack the three visible parts of a GtkSpinner
in the familiar "Entry-box followed by two little buttons" formation that
we know and love. All its other functions come from GtkSpinner. The change
should be completely invisible to a user of GtkSpinbutton.

My map-panning widget would then be rewritten to employ two of these
GtkSpinners and a button, and would pack the up and down buttons of the
spinners in the way I mentioned above.

Adrian could then write a variant of GtkSpinbutton for himself with the
minimum of fuss to achieve his needs too.


Now: - I'm a total novice. Maybe I'm biting off more than I can chew here,
and maybe there's a better way to do it. But what do you GTK gurus think of
my suggestion? I've looked at the code for GtkSpinbutton, and *might* be
able to try the idea out, but it's right at the limits of my widget-
writing ability currently. Others might be able to offer such a rewrite
in an afternoon if it was deemed useful.

--

Steve                                       | Steve's law of House Rewiring:
S.Hosgood@swansea.ac.uk                     | "No matter how many power sockets
Phone: +44 1792 297292 + ask for Steve      |  you fit in a room, you will run
Fax:   +44 1792 295811                      |  out within the first week of use
--------------------------------------------+  even if you took Steve's law of
http://iiit.swan.ac.uk/~iisteve/steve.html  |  House Rewiring into account"




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