Re: Top down layout



---------- Original Message ----------
To: Matthew Allen (list sydneyband com au)
From: Tristan Van Berkom (tvb gnome org)
Subject: Re: Top down layout
Date: 9/6/2010 1:44:30p

On Tue, Jun 8, 2010 at 11:09 PM, Matthew Allen <list sydneyband com au> 
wrote: ---------- Original Message ----------
To: Matthew Allen (list sydneyband com au)
From: Tristan Van Berkom (tvb gnome org)
Subject: Re: Top down layout
Date: 9/6/2010 12:55:44p

On Tue, Jun 8, 2010 at 10:36 PM, Matthew Allen
<list sydneyband com au> wrote: This sort of behaviour might not
be possible with GTK. But at least I thought I'd ask.

Actually whats the first signal generated when the user attempts to
resize the GtkWindow?

I should hook that and stop it get limited to the requested size...
then my window is free to resize arbitrarily, and I can sort out
the layout from there. Is there some way of seeing the signals
being fired?
Do you need to let the window be smaller than the space that its
children occupy ?

Yes. The GtkWindow should not be limited to the contents at all, thats
what I want.

You could just put everything in a scrolled window and hide the
scrollbars if thats

An interesting idea... I might have a look at the implementation details
of the scrollable area widget.

I'm currently reading through gdkevents-win32.c in an attempt to find 
where it enforces the minimum window size. I was hoping that somewhere
in the WM_SIZING handler it would get the current allocation and set the
RECT pointed to by lParam to that size. Or something like that, but so
far I haven't got my head around it.

Or maybe it's happening in WM_WINDOWPOSCHANGING?

For a clearer answer on that particularly, GtkWindow size is
"constrained" by the minimum size
of its contents, scrollable area widgets exist to allow encapsulation
of larger areas that dont
fit on screen.

When I tried putting putting a scrollable area into a window... I didn't get very convincing results. The 
code below attempts to put a very large button into a 300x300 size window. The scrollable does not track with 
the size of the GtkWindow as I resize it... and I don't know why. I was expecting that as I resize the 
GtkWindow the child scrollable would resize along with the client area of the window. But it doesn't it just 
stays there the same size as it was created.

GtkObject *h = gtk_adjustment_new(0, 0, 2000, 1, 10, 300);
GtkObject *v = gtk_adjustment_new(0, 0, 2000, 1, 10, 300);
GtkWidget *root;
GtkWindow *Wnd; // created before this code
if (root = gtk_scrolled_window_new(0, 0))
{
    gtk_container_add(GTK_CONTAINER(Wnd), root);
    gtk_widget_show(root);

    GtkWidget *vp = gtk_viewport_new(GTK_ADJUSTMENT(h), GTK_ADJUSTMENT(v));
    if (vp)
    {
        gtk_container_add(GTK_CONTAINER(root), vp);
        gtk_widget_show(vp);

        GtkWidget *btn = gtk_button_new();
        if (btn)
        {
            gtk_widget_set_size_request(btn, 2000, 2000);
            gtk_container_add(GTK_CONTAINER(vp), btn);
            gtk_widget_show(btn);
        }
    }
}

I still fail to see the point, what is supposed to be in the UI ?
buttons labels text areas treeviews and notebooks and menubars and normal stuff ?

Yes... but I want to use my own layout, not GTK's. It won't make me popular here, but thats not my aim, I 
just want the app to look and behave the way it does now. Most of the "controls" I have are owner draw, so 
they aren't GTK buttons/labels/lists etc, but just need a drawable area that they can address.

Eventually I might migrate to GTK native layout for NEW projects, but the existing code isn't going to be 
rewritten as I don't have time to do that.

is it a big canvas that you need to scroll around in ?

Nope.

Rather, what does an interface look like when you shrink it smaller
than its contents ?

Not much, it just starts clipping.

Do you just let buttons clip off to the right and the bottom ?

Yes.
--
Matthew Allen




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