Problem with resize



Hi Folks

I'm trying to implement a dockable window with advanced
functionnalities (which are described on 
http://logout.free.fr/Gtk/SynapsIDE/ for those of you
who are curious) and I'm experiencing some problems with
resize.

* the background:
I have a standard window that contains a hbox. This hbox, 
in turn, contains 2 other box (one of them is the widget
I want to create, call it DW, the second is a dummy box, 
named WhatYouWant (WYW)).
The DW widget contains:
 - a vbox DWBOX1 (with 3 buttons inside)
 - a hbox DWBOX2 (where the user add what he wants)
The top level window have allow_grow, allow_shrink and
not auto_shrink.
The 3 buttons in the DW widget are:
 - close/hide [B1]
 - expand/collapse [B2]
 - dock/undock [B3]
B[123] cannot get the focus (they are just clicked).

* ok, now, the experience
 - clicking on B1 is okay. The DW widget is hidden, and
   WYW now expand to all the available space. Good.
 - clicking on B3 reparent DW in a newly created POPUP window. 
   So WYW expands too. A new click on B3 will reparent DW
   in the source window (1-see below), and WYW shrinks to
   ive some space to DW. Good.
 - clicking on B2 hides/shows DWBOX2. Now my problem arise.
   In such case, I want WYW to auto resize to expand if
   DWBOX2 is not visible or to shrink if DWBOX2 is visible.
   But it does not want to do it. Perhaps WYW is a lazy vbox,
   but I can't believe it - so there might be a problem in
   my code.

Figure:

    -----------------------------------
    |                                 |
    |  ----------------  -----------  |
    |  | |            |  |         |  |
    |  | |            |  |         |  |
    |  ----------------  -----------  |
    |                                 |
    -----------------------------------


When I click on B2 once, I want to have

    -----------------------------------
    |                                 |
    |  ---  ------------------------  |
    |  | |  |                      |  |
    |  | |  |                      |  |
    |  ---  ------------------------  |
    |                                 |
    -----------------------------------

But instead, I have:

    -----------------------------------
    |                                 |
    |  ---               -----------  |
    |  | |               |         |  |
    |  | |               |         |  |
    |  ---               -----------  |
    |                                 |
    -----------------------------------

Which is
(a) not really the 'Cool Effect Of The Year'(tm)
(b) ugly (*very* ugly).

I tried to set the resize mode of DW to 
GTK_RESIZE_IMMEDIATE --> no effect on this. I tried
to do the same thing on the DW parent without
any sucess.

Now, it's 6am, I forgot to sleep, I'm very tired, I don't
want to throw my old P100 through the window, etc.

Does anybody have an idea? Thanks a lot.

    Yours,

    Emmanuel

(1) well - I experienced some problems with reparenting
[Gdk-Critical in gdk_window_reparent() - Gdk loses the
window when I do a lot of reparent on the same 
widget/group of widget. By the way, I read the discussion
about the current reparenting bug - on composed widgets.
Perhaps it may be a good idea to have a way to register
widgets that are associated to another widget [such as
the two arrows of a spin button]. Another possibility is
to propagate the reparent message - by using the
(*reparent)() field of the GtkWidgetClass. This should 
probably be a better idea, since it will not break the
1.2 line.



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