[GDL] How to place a widget in a placeholder?

View: New views
5 Messages — Rating Filter:   Alert me  

[GDL] How to place a widget in a placeholder?

by Nicolas Joseph :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello,

I have construct an ui based on GDL with the same layout.xml that Anjuta.

 

I don't undestand how tadd a new widget in the placeholder. Have you got a short example?

 

Thank's in adavance.

-- 
Nicolas Joseph

http://www.valaide.org

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Anjuta-devel mailing list
Anjuta-devel@...
https://lists.sourceforge.net/lists/listinfo/anjuta-devel

Re: [GDL] How to place a widget in a placeholder?

by Sébastien Granjoux :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Nicolas,

Nicolas Joseph a écrit :
> I have construct an ui based on GDL with the same layout.xml that Anjuta.
> I don't undestand how tadd a new widget in the placeholder. Have you got
> a short example?

I think it's done in anjuta with the function anjuta_shell_add_widget
which end calling anjuta_app_add_widget_full in src/anjuta-app.c

Regards,

Sébastien

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Anjuta-devel mailing list
Anjuta-devel@...
https://lists.sourceforge.net/lists/listinfo/anjuta-devel

Re: [GDL] How to place a widget in a placeholder?

by Nicolas Joseph :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


> I think it's done in anjuta with the function anjuta_shell_add_widget
> which end calling anjuta_app_add_widget_full in src/anjuta-app.c

Yes, but it simply:

    gdl_dock_add_item (GDL_DOCK (app->dock),
                       GDL_DOCK_ITEM (item), placement);

When I use the same code (for example, with placement = GDK_DOCK_LEFT),
the new item is added at the left of the others items, not within the
notebook.

I also tries something like:

  ph = gdl_dock_get_placeholder_by_name (dock, "ph_left");
  gdl_dock_placeholder_attach (ph, item);

--
Nicolas Joseph

http://www.valaide.org

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Anjuta-devel mailing list
Anjuta-devel@...
https://lists.sourceforge.net/lists/listinfo/anjuta-devel

Re: [GDL] How to place a widget in a placeholder?

by Johannes Schmid-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi!

Am Sonntag, den 08.11.2009, 12:30 +0100 schrieb Nicolas Joseph:

> > I think it's done in anjuta with the function anjuta_shell_add_widget
> > which end calling anjuta_app_add_widget_full in src/anjuta-app.c
>
> Yes, but it simply:
>
>     gdl_dock_add_item (GDL_DOCK (app->dock),
>                        GDL_DOCK_ITEM (item), placement);
>
> When I use the same code (for example, with placement = GDK_DOCK_LEFT),
> the new item is added at the left of the others items, not within the
> notebook.
Well, if say LEFT than it will be added on the left side of the window
or if you already added an item on with LEFT before it should be stacked
on top of the other item.
That means, if you have added a item the CENTER and have no LEFT item
yet and then you want to add the next item on top of the CENTER item you
will have to use CENTER even if the item appears on the left side of the
window currently.

Regards,
Johannes


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Anjuta-devel mailing list
Anjuta-devel@...
https://lists.sourceforge.net/lists/listinfo/anjuta-devel

signature.asc (204 bytes) Download Attachment

Re: [GDL] How to place a widget in a placeholder?

by Nicolas Joseph :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Sorry, I'm really incompetent, I don't understand :(

I've written a small example in C. It doesn't work, I would like that the
last two items are displayed, respectively, in the left and in the bottom
notebook.

Thank's for your patience.

Regards,

On Sun, 08 Nov 2009 19:38:00 +0100, Johannes <jhs@...> wrote:
> Hi!
>
> Am Sonntag, den 08.11.2009, 12:30 +0100 schrieb Nicolas Joseph:
>> > I think it's done in anjuta with the function anjuta_shell_add_widget

>> > which end calling anjuta_app_add_widget_full in src/anjuta-app.c
>>
>> Yes, but it simply:
>>
>>     gdl_dock_add_item (GDL_DOCK (app->dock),
>>                        GDL_DOCK_ITEM (item), placement);
>>
>> When I use the same code (for example, with placement = GDK_DOCK_LEFT),
>> the new item is added at the left of the others items, not within the
>> notebook.
>
> Well, if say LEFT than it will be added on the left side of the window
> or if you already added an item on with LEFT before it should be stacked
> on top of the other item.
> That means, if you have added a item the CENTER and have no LEFT item
> yet and then you want to add the next item on top of the CENTER item you
> will have to use CENTER even if the item appears on the left side of the
> window currently.
>
> Regards,
> Johannes
--
Nicolas Joseph

http://www.valaide.org
<?xml version="1.0"?>
<dock-layout>
  <layout name="__default__">
    <dock name="__dock_1" floating="no" width="-1" height="-1" floatx="0" floaty="0">
                        <paned orientation="vertical" locked="no" position="326">
                                <paned orientation="horizontal" locked="no" position="249">
                                        <notebook orientation="vertical" locked="no" page="0">
            <item name="projects" orientation="vertical" locked="no" />
            <item name="file-browser-plugin" orientation="vertical" locked="no"/>
            <item name="symbol-browser-plugin" orientation="vertical" locked="no"/>
            <item name="opened-documents-plugin" orientation="vertical" locked="no"/>
                                                <placeholder name="ph_left" next-placement="center"/>
                                        </notebook>
                                        <paned orientation="horizontal" locked="no" position="500">
                                                <paned orientation="vertical" locked="no" position="200">
                                                        <notebook orientation="vertical" locked="no" page="0">
                                                                <placeholder name="ph_top" next-placement="center"/>
                                                        </notebook>
                                                        <notebook orientation="vertical" locked="no" page="0">
                <item name="documents" orientation="vertical" locked="no" />
                                                                <placeholder name="ph_center" next-placement="center"/>
                                                        </notebook>
                                                </paned>
                                                <notebook orientation="vertical" locked="no" page="0">
                                                        <placeholder name="ph_right" next-placement="center"/>
                                                </notebook>
                                        </paned>
                                </paned>
                                <notebook orientation="vertical" locked="no" page="0">
          <item name="executables" orientation="vertical" locked="no" />
          <item name="todo-plugin" orientation="vertical" locked="no"/>
                                        <placeholder name="ph_bottom" next-placement="center"/>
                                </notebook>
                        </paned>
    </dock>
  </layout>
</dock-layout>


#include <gdl/gdl.h>
#include <gtk/gtk.h>

GtkWidget *dock = NULL;

void add_widget (GtkWidget *widget, const char *name, const char *long_name,
                 GdlDockPlacement placement)
{
  GtkWidget *item = NULL;

  item = gdl_dock_item_new (name, long_name, GDL_DOCK_ITEM_BEH_NORMAL);
  gtk_container_add (GTK_CONTAINER (item), gtk_text_view_new ());
  gdl_dock_add_item (GDL_DOCK (dock), GDL_DOCK_ITEM (item), placement);
}

int main (int argc, char **argv)
{
  GtkWidget *hbox = NULL;
  GtkWidget *window = NULL;
  GtkWidget *dockbar = NULL;
  GdlDockLayout *layout = NULL;

  gtk_init (&argc, &argv);

  window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  g_signal_connect (G_OBJECT (window), "destroy", gtk_main_quit, NULL);

  hbox = gtk_hbox_new (FALSE, 0);
  gtk_container_add (GTK_CONTAINER (window), hbox);

  dock = gdl_dock_new ();

  layout = gdl_dock_layout_new (GDL_DOCK (dock));
  gdl_dock_layout_load_from_file (layout, "layout.xml");
  gdl_dock_layout_load_layout (layout, "__default__");

  dockbar = gdl_dock_bar_new (GDL_DOCK (dock));
  gdl_dock_bar_set_style (GDL_DOCK_BAR (dockbar), GDL_DOCK_BAR_BOTH);
  gtk_box_pack_start (GTK_BOX (hbox), dockbar, FALSE, TRUE, 0);

  gtk_box_pack_start (GTK_BOX (hbox), dock, TRUE, TRUE, 0);

  gdl_dock_placeholder_new ("ph_top", GDL_DOCK_OBJECT (dock), GDL_DOCK_TOP, FALSE);
  gdl_dock_placeholder_new ("ph_bottom", GDL_DOCK_OBJECT (dock), GDL_DOCK_BOTTOM, FALSE);
  gdl_dock_placeholder_new ("ph_left", GDL_DOCK_OBJECT (dock), GDL_DOCK_LEFT, FALSE);
  gdl_dock_placeholder_new ("ph_center", GDL_DOCK_OBJECT (dock), GDL_DOCK_CENTER, FALSE);
  gdl_dock_placeholder_new ("ph_right", GDL_DOCK_OBJECT (dock), GDL_DOCK_RIGHT, FALSE);

  add_widget (gtk_text_view_new (), "executables", "Messages", GDL_DOCK_BOTTOM);
  add_widget (gtk_text_view_new (), "todo-plugin", "Todo", GDL_DOCK_BOTTOM);
  add_widget (gtk_text_view_new (), "projects", "Projects", GDL_DOCK_LEFT);
  add_widget (gtk_text_view_new (), "file-browser-plugin", "Files", GDL_DOCK_LEFT);
  add_widget (gtk_text_view_new (), "documents", "Documents", GDL_DOCK_CENTER);

  gtk_widget_show_all (window);
  gtk_main ();  
  return 0;
}


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Anjuta-devel mailing list
Anjuta-devel@...
https://lists.sourceforge.net/lists/listinfo/anjuta-devel