Beispiel #1
0
int main(int argc,char *argv[ ])
{
    GtkWidget *window, *paned1, *paned2, *paned3;
    GtkWidget *button;

    gtk_init(&argc,&argv);
    window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
    gtk_signal_connect(GTK_OBJECT(window),"delete_event",G_CALLBACK(gtk_main_quit),NULL);

    paned1 = gtk_vpaned_new();
    gtk_container_add(GTK_CONTAINER(window), paned1);

    paned2 = gtk_hpaned_new();
    gtk_paned_add1(GTK_PANED(paned1),paned2);

    button = gtk_button_new_with_label("Button1");
    gtk_paned_add2(GTK_PANED(paned1),button);

    button = gtk_button_new_with_label("Button2");
    gtk_paned_add1(GTK_PANED(paned2),button);

    paned3 = gtk_vpaned_new();
    gtk_paned_add2(GTK_PANED(paned2),paned3);

    button = gtk_button_new_with_label("Button3");
    gtk_paned_add1(GTK_PANED(paned3),button);

    button = gtk_button_new_with_label("Button4");
    gtk_paned_add2(GTK_PANED(paned3),button);

    gtk_widget_show_all(window);
    gtk_main();

    return 0;
}
Beispiel #2
0
/**
 * 创建所有区域.
 * @return 主窗体
 */
GtkWidget *DialogPeer::CreateAllArea()
{
        GtkWidget *box;
        GtkWidget *hpaned, *vpaned;
        gint position;

        box = gtk_vbox_new(FALSE, 0);

        /* 加入菜单条 */
        gtk_box_pack_start(GTK_BOX(box), CreateMenuBar(), FALSE, FALSE, 0);

        /* 加入主区域 */
        hpaned = gtk_hpaned_new();
        g_datalist_set_data(&widset, "main-paned", hpaned);
        g_object_set_data(G_OBJECT(hpaned), "position-name",
                                 (gpointer)"main-paned-divide");
        position = GPOINTER_TO_INT(g_datalist_get_data(&dtset, "main-paned-divide"));
        gtk_paned_set_position(GTK_PANED(hpaned), position);
        gtk_box_pack_start(GTK_BOX(box), hpaned, TRUE, TRUE, 0);
        g_signal_connect(hpaned, "notify::position",
                         G_CALLBACK(PanedDivideChanged), &dtset);
        /*/* 加入聊天历史记录&输入区域 */
        vpaned = gtk_vpaned_new();
        g_object_set_data(G_OBJECT(vpaned), "position-name",
                         (gpointer)"historyinput-paned-divide");
        position = GPOINTER_TO_INT(g_datalist_get_data(&dtset,
                                 "historyinput-paned-divide"));
        gtk_paned_set_position(GTK_PANED(vpaned), position);
        gtk_paned_pack1(GTK_PANED(hpaned), vpaned, TRUE, TRUE);
        g_signal_connect(vpaned, "notify::position",
                         G_CALLBACK(PanedDivideChanged), &dtset);
        gtk_paned_pack1(GTK_PANED(vpaned), CreateHistoryArea(), TRUE, TRUE);
        gtk_paned_pack2(GTK_PANED(vpaned), CreateInputArea(), FALSE, TRUE);
        /* 加入好友信息&附件区域 */
        vpaned = gtk_vpaned_new();
        g_object_set_data(G_OBJECT(vpaned), "position-name",
                         (gpointer)"infoenclosure-paned-divide");
        position = GPOINTER_TO_INT(g_datalist_get_data(&dtset,
                                 "infoenclosure-paned-divide"));
        gtk_paned_set_position(GTK_PANED(vpaned), position);
        gtk_paned_pack2(GTK_PANED(hpaned), vpaned, FALSE, TRUE);
        g_signal_connect(vpaned, "notify::position",
                         G_CALLBACK(PanedDivideChanged), &dtset);
        gtk_paned_pack1(GTK_PANED(vpaned), CreateInfoArea(), TRUE, TRUE);
        gtk_paned_pack2(GTK_PANED(vpaned), CreateFileArea(), FALSE, TRUE);

        return box;
}
Beispiel #3
0
/**
 * gwy_module_browser:
 *
 * Shows a simple module browser.
 **/
void
gwy_module_browser(void)
{
    GtkWidget *browser, *scroll, *paned, *info;

    if (window) {
        gtk_window_present(GTK_WINDOW(window));
        return;
    }

    window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
    gtk_window_set_default_size(GTK_WINDOW(window), 480, 480);
    gtk_window_set_title(GTK_WINDOW(window), _("Module Browser"));
    gtk_window_set_wmclass(GTK_WINDOW(window), "browser_module",
                           g_get_application_name());
    paned = gtk_vpaned_new();
    gtk_container_add(GTK_CONTAINER(window), paned);
    scroll = gtk_scrolled_window_new(NULL, NULL);
    gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scroll),
                                   GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);
    gtk_paned_pack1(GTK_PANED(paned), scroll, TRUE, FALSE);
    browser = gwy_module_browser_construct(window);
    gtk_container_add(GTK_CONTAINER(scroll), browser);
    info = gwy_module_browser_info_table(window);
    gtk_paned_pack2(GTK_PANED(paned), info, FALSE, FALSE);

    g_signal_connect(window, "destroy", G_CALLBACK(gtk_widget_destroy), NULL);
    g_signal_connect_swapped(window, "destroy",
                             G_CALLBACK(g_nullify_pointer), &window);
    gtk_widget_show_all(window);
}
Beispiel #4
0
static void
dialog_set_container (PsppireDialog *dialog)
{
  if ( dialog->box != NULL)
    {
      gtk_container_remove (GTK_CONTAINER (dialog), dialog->box);
    }

  switch (dialog->orientation)
    {
    case PSPPIRE_HORIZONTAL:
      if ( dialog->slidable)
	dialog->box = gtk_hpaned_new();
      else
	dialog->box = gtk_hbox_new (FALSE, 5);
      break;
    case PSPPIRE_VERTICAL:
      if ( dialog->slidable)
	dialog->box = gtk_vpaned_new();
      else
	dialog->box = gtk_vbox_new (FALSE, 5);
      break;
    case PSPPIRE_TABULAR:
      dialog->box = gtk_table_new (2, 3, FALSE);
      g_object_set (dialog->box,
		    "row-spacing", 5,
		    "column-spacing", 5,
		    NULL);
      break;
    }

  gtk_widget_show_all (dialog->box);
  gtk_container_add (GTK_CONTAINER (dialog), dialog->box);
}
Beispiel #5
0
int
main (int argc, char *argv[])
{
    GtkWidget *window;
    GtkWidget *vpaned;
    GtkWidget *list;
    GtkWidget *text;

    gtk_init (&argc, &argv);
   
    window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
    gtk_window_set_title (GTK_WINDOW (window), "Paned Windows");
    gtk_signal_connect (GTK_OBJECT (window), "destroy",
                        GTK_SIGNAL_FUNC (gtk_main_quit), NULL);
    gtk_container_border_width (GTK_CONTAINER (window), 10);
   
    /* vpaned widget을 만들어서 toplevel 윈도에 더한다. */
   
    vpaned = gtk_vpaned_new ();
    gtk_container_add (GTK_CONTAINER(window), vpaned);
    gtk_widget_show (vpaned);
   
    /* 이제 윈도 두 부분의 내용을 만든다. */
   
    list = create_list ();
    gtk_paned_add1 (GTK_PANED(vpaned), list);
    gtk_widget_show (list);
   
    text = create_text ();
    gtk_paned_add2 (GTK_PANED(vpaned), text);
    gtk_widget_show (text);
    gtk_widget_show (window);
    gtk_main ();
    return 0;
}
Beispiel #6
0
GtkWidget *
gtk_paned_new (GtkOrientation  orientation)
{
  if (orientation == GTK_ORIENTATION_HORIZONTAL)
    return gtk_hpaned_new ();
  else
    return gtk_vpaned_new ();
}
Beispiel #7
0
static void cookie_manager_page_init(CookieManagerPage *self)
{
    GtkWidget *tree_swin;
    GtkWidget *desc_swin;
    GtkWidget *paned;
    GtkWidget *filter_hbox;
    GtkWidget *treeview;
    CookieManagerPagePrivate *priv;

    self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
                 COOKIE_MANAGER_PAGE_TYPE, CookieManagerPagePrivate);
    priv = self->priv;
    priv->ignore_changed_filter = FALSE;

    cm_create_toolbar(self);

    priv->desc_label = gtk_label_new(CM_EMPTY_LABEL_TEXT);
    gtk_label_set_selectable(GTK_LABEL(priv->desc_label), TRUE);
    gtk_label_set_line_wrap(GTK_LABEL(priv->desc_label), TRUE);
    gtk_label_set_line_wrap_mode(GTK_LABEL(priv->desc_label), PANGO_WRAP_CHAR);
    gtk_misc_set_alignment(GTK_MISC(priv->desc_label), 0, 0);
    gtk_misc_set_padding(GTK_MISC(priv->desc_label), 3, 3);
    gtk_widget_show(priv->desc_label);

    desc_swin = gtk_scrolled_window_new(NULL, NULL);
    gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(desc_swin),
                                   GTK_POLICY_AUTOMATIC, GTK_POLICY_NEVER);
    gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(desc_swin), GTK_SHADOW_NONE);
    gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(desc_swin), priv->desc_label);
    gtk_widget_show(desc_swin);

    treeview = cm_tree_prepare(self);
    gtk_widget_show(treeview);

    tree_swin = gtk_scrolled_window_new(NULL, NULL);
    gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(tree_swin),
                                   GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
    gtk_container_add(GTK_CONTAINER(tree_swin), treeview);
    gtk_widget_show(tree_swin);

    priv->filter_entry = sokoke_search_entry_new (_("Search Cookies by Name or Domain"));
    gtk_widget_show(priv->filter_entry);
    g_signal_connect(priv->filter_entry, "changed", G_CALLBACK(cm_filter_entry_changed_cb), self);
    g_signal_connect(priv->filter_entry, "activate", G_CALLBACK(cm_filter_entry_changed_cb), self);

    filter_hbox = gtk_hbox_new(FALSE, 0);
    gtk_box_pack_start(GTK_BOX(filter_hbox), priv->filter_entry, TRUE, TRUE, 3);
    gtk_widget_show(filter_hbox);

    paned = gtk_vpaned_new();
    gtk_paned_pack1(GTK_PANED(paned), tree_swin, TRUE, FALSE);
    gtk_paned_pack2(GTK_PANED(paned), desc_swin, FALSE, FALSE);
    gtk_widget_show(paned);

    gtk_box_pack_start(GTK_BOX(self), filter_hbox, FALSE, FALSE, 5);
    gtk_box_pack_start(GTK_BOX(self), paned, TRUE, TRUE, 0);
}
Beispiel #8
0
GtkWidget*
create_MainWindow (void)
{
  GtkWidget *MainWindow;
  GtkWidget *SplitPane;
  GtkWidget *RemoteText;
  GtkWidget *LocalText;
  GtkTooltips *tooltips;

  tooltips = gtk_tooltips_new ();

  MainWindow = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  gtk_widget_set_size_request (MainWindow, 400, 300);
  gtk_window_set_title (GTK_WINDOW (MainWindow), "Synchronet Sysop Chat");
  gtk_window_set_icon_name (GTK_WINDOW (MainWindow), "stock_help-chat");
  gtk_window_set_type_hint (GTK_WINDOW (MainWindow), GDK_WINDOW_TYPE_HINT_UTILITY);

  SplitPane = gtk_vpaned_new ();
  gtk_widget_show (SplitPane);
  gtk_container_add (GTK_CONTAINER (MainWindow), SplitPane);
  gtk_paned_set_position (GTK_PANED (SplitPane), 148);

  RemoteText = gtk_text_view_new ();
  gtk_widget_show (RemoteText);
  gtk_paned_pack1 (GTK_PANED (SplitPane), RemoteText, FALSE, TRUE);
  GTK_WIDGET_UNSET_FLAGS (RemoteText, GTK_CAN_FOCUS);
  gtk_tooltips_set_tip (tooltips, RemoteText, "Remote Text Window", NULL);
  gtk_text_view_set_editable (GTK_TEXT_VIEW (RemoteText), FALSE);
  gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (RemoteText), GTK_WRAP_WORD);

  LocalText = gtk_text_view_new ();
  gtk_widget_show (LocalText);
  gtk_paned_pack2 (GTK_PANED (SplitPane), LocalText, TRUE, TRUE);
  gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (LocalText), GTK_WRAP_WORD);
  gtk_text_view_set_editable (GTK_TEXT_VIEW (LocalText), FALSE);

  g_signal_connect ((gpointer) MainWindow, "destroy",
                    G_CALLBACK (on_MainWindow_destroy),
                    NULL);
  g_signal_connect ((gpointer) LocalText, "key_press_event",
                    G_CALLBACK (on_LocalText_key_press_event),
                    NULL);

  /* Store pointers to all widgets, for use by lookup_widget(). */
  GLADE_HOOKUP_OBJECT_NO_REF (MainWindow, MainWindow, "MainWindow");
  GLADE_HOOKUP_OBJECT (MainWindow, SplitPane, "SplitPane");
  GLADE_HOOKUP_OBJECT (MainWindow, RemoteText, "RemoteText");
  GLADE_HOOKUP_OBJECT (MainWindow, LocalText, "LocalText");
  GLADE_HOOKUP_OBJECT_NO_REF (MainWindow, tooltips, "tooltips");

  gtk_widget_grab_focus (LocalText);

  gtk_timeout_add(50, get_from_remote, RemoteText);

  return MainWindow;
}
Beispiel #9
0
static int hview_init(void)
{
      GtkWidget		*menubar;
      GtkWidget		*toolbar;
      GtkWidget		*statusbar;
      GtkWidget		*vpaned;
      GtkWidget		*hpaned;
      GtkWidget		*main_vbox;

// Create main window ---------------------------------------------------------
      main_window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
      g_signal_connect(G_OBJECT(main_window), "destroy",
		       G_CALLBACK(gtk_main_quit),
		       NULL);
      gtk_window_set_title(GTK_WINDOW(main_window), HVIEW_TITLE);
      gtk_widget_set_size_request(GTK_WIDGET(main_window),
				  HVIEW_MAIN_WINDOW_WIDTH,
				  HVIEW_MAIN_WINDOW_HEIGHT);
//-----------------------------------------------------------------------------

      main_vbox = gtk_vbox_new(FALSE, 1);
      gtk_container_set_border_width(GTK_CONTAINER(main_vbox), 1);
      gtk_container_add(GTK_CONTAINER(main_window), main_vbox);

      menubar = hview_get_menubar();
      gtk_box_pack_start(GTK_BOX(main_vbox), menubar, FALSE, FALSE, 0);

      vpaned = gtk_vpaned_new();
      hpaned = gtk_hpaned_new();

// Create scrolled "tree window" and add it to horizontal paned window --------
      tree_window = hview_get_tree_window();
      gtk_paned_add1(GTK_PANED(hpaned), tree_window);
//-----------------------------------------------------------------------------

// Create scrolled "detail window" and add it to hpaned window ----------------
      detail_window = hview_get_detail_window();
      gtk_paned_add2(GTK_PANED(hpaned), detail_window);
//-----------------------------------------------------------------------------

// Create scrolled "log window" and add it with hpaned window to vertical paned
      log_window = hview_get_log_window();
      gtk_text_view_set_editable(GTK_TEXT_VIEW(log_view), FALSE);
      gtk_text_view_set_cursor_visible(GTK_TEXT_VIEW(log_view), FALSE);
      hview_print(HVIEW_NAME_VERSION);
      gtk_paned_add1(GTK_PANED(vpaned), hpaned);
      gtk_paned_add2(GTK_PANED(vpaned), log_window);
//-----------------------------------------------------------------------------

      gtk_box_pack_start(GTK_BOX(main_vbox), vpaned, TRUE, TRUE, 0);

      gtk_widget_show_all(main_window);

      return 0;
}
Beispiel #10
0
void cgraphics_splitter_widget_create( widget_t *widget )
{
	widget->ndata = (void *)0; // (ab)using the ndata pointer for a count
	
	if ( widget->flags & cSplitterVertical )
		widget->native = gtk_vpaned_new( );
	else
		widget->native = gtk_hpaned_new( );
		
	cgraphics_widget_create( widget );
}
GtkWidget   *   gwrgtk_vpaned_new()
{
    GtkWidget   *   w   = NULL;
    //  ........................................................................
    #if GWR_GTK_VERSION_GE(3,2)
        w   =   gtk_paned_new( GTK_ORIENTATION_VERTICAL );
    #else
        w   =   gtk_vpaned_new();
    #endif
    return w;
}
Beispiel #12
0
GtkWidget* GetSplitterWidget()
{
    static GtkWidget* widget;

    if (widget == NULL)
    {
        widget = gtk_vpaned_new();
        gtk_container_add(GetContainer(), widget);
        gtk_widget_realize(widget);
    }

    return widget;
}
Beispiel #13
0
static void
create_window(void)
{
    GtkWidget		*vbox, *hbox;

    shell = g_new0(Shell, 1);

    shell->window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
    gtk_window_set_icon(GTK_WINDOW(shell->window),
                        icon_cache_get_pixbuf("logo.png"));
    gtk_window_set_title(GTK_WINDOW(shell->window), "System Information");
    gtk_widget_set_size_request(shell->window, 600, 400);
    g_signal_connect(G_OBJECT(shell->window), "destroy", destroy_me, NULL);

    vbox = gtk_vbox_new(FALSE, 0);
    gtk_widget_show(vbox);
    gtk_container_add(GTK_CONTAINER(shell->window), vbox);
    shell->vbox = vbox;

    menu_init(shell);

    hbox = gtk_hbox_new(FALSE, 5);
    gtk_widget_show(hbox);
    gtk_box_pack_end(GTK_BOX(vbox), hbox, FALSE, FALSE, 3);

    shell->progress = gtk_progress_bar_new();
    gtk_widget_set_size_request(shell->progress, 70, 10);
    gtk_widget_hide(shell->progress);
    gtk_box_pack_end(GTK_BOX(hbox), shell->progress, FALSE, FALSE, 0);

    shell->status = gtk_label_new("");
    gtk_misc_set_alignment(GTK_MISC(shell->status), 0.0, 0.5);
    gtk_widget_show(shell->status);
    gtk_box_pack_start(GTK_BOX(hbox), shell->status, FALSE, FALSE, 0);

    shell->hpaned = gtk_hpaned_new();
    gtk_widget_show(shell->hpaned);
    gtk_box_pack_end(GTK_BOX(vbox), shell->hpaned, TRUE, TRUE, 0);
    gtk_paned_set_position(GTK_PANED(shell->hpaned), 210);

    shell->vpaned = gtk_vpaned_new();
    gtk_widget_show(shell->vpaned);
    gtk_paned_add2(GTK_PANED(shell->hpaned), shell->vpaned);

    shell->notebook = gtk_notebook_new();
    gtk_paned_add2(GTK_PANED(shell->vpaned), shell->notebook);

    gtk_widget_show(shell->window);
    while (gtk_events_pending())
        gtk_main_iteration();
}
Beispiel #14
0
static void main_window_create_panes(void)
{
	main_window.main_vertical_pane = gtk_vpaned_new ();
	gtk_widget_show (main_window.main_vertical_pane);
	gnome_app_set_contents (GNOME_APP (main_window.window), main_window.main_vertical_pane);

	main_window.main_horizontal_pane = gtk_hpaned_new ();
	gtk_widget_show (main_window.main_horizontal_pane);
	gtk_paned_pack1 (GTK_PANED (main_window.main_vertical_pane), main_window.main_horizontal_pane, FALSE, TRUE);

	gtk_signal_connect (GTK_OBJECT (main_window.window), "size_allocate", GTK_SIGNAL_FUNC (classbrowser_accept_size), NULL);
	move_classbrowser_position();
	if (gnome_config_get_int ("gPHPEdit/main_window/classbrowser_hidden=0") == 1)
		classbrowser_hide();
}
Beispiel #15
0
static GtkWidget *build_main_interface(void)
{
	GtkWidget *vbox;
	GtkWidget *hpaned;
	GtkWidget *vpaned;
	GtkWidget *panel;

	hpaned = gtk_hpaned_new();
	gtk_widget_show(hpaned);

	vbox = gtk_vbox_new(FALSE, 3);
	gtk_widget_show(vbox);
	gtk_paned_pack1(GTK_PANED(hpaned), vbox, FALSE, TRUE);

	gtk_box_pack_start(GTK_BOX(vbox),
			   identity_build_panel(), FALSE, TRUE, 0);
	gtk_box_pack_start(GTK_BOX(vbox),
			   resource_build_panel(), FALSE, TRUE, 0);
	gtk_box_pack_start(GTK_BOX(vbox),
			   build_develop_panel(), FALSE, TRUE, 0);
	gtk_box_pack_start(GTK_BOX(vbox),
			   player_build_summary(), TRUE, TRUE, 0);

	main_paned = gtk_hpaned_new();
	gtk_widget_show(main_paned);

	vpaned = gtk_vpaned_new();
	gtk_widget_show(vpaned);

	gtk_paned_pack1(GTK_PANED(main_paned), vpaned, TRUE, TRUE);

	gtk_paned_pack1(GTK_PANED(vpaned), build_map_panel(), TRUE, TRUE);

	chat_panel = gtk_vbox_new(FALSE, 0);
	gui_show_splash_page(TRUE, chat_panel);

	panel = chat_build_panel();
	frontend_gui_register(panel, GUI_DISCONNECT, NULL);
	gtk_box_pack_start(GTK_BOX(chat_panel), panel, FALSE, TRUE, 0);
	gtk_box_pack_start(GTK_BOX(chat_panel),
			   build_messages_panel(), TRUE, TRUE, 0);

	set_16_9_layout(config_get_int_with_default
			("settings/layout_16_9", FALSE));

	gtk_paned_pack2(GTK_PANED(hpaned), main_paned, TRUE, TRUE);
	return hpaned;
}
Beispiel #16
0
int
clip_GTK_VPANEDNEW(ClipMachine * cm)
{
	ClipVar * cv     = _clip_spar(cm, 1);
	GtkWidget *wid = NULL;
	C_widget *cwid;
	CHECKOPT(1,MAP_t);

	wid = gtk_vpaned_new();
	if (!wid) goto err;
	cwid = _register_widget(cm, wid, cv);
	_clip_mclone(cm,RETPTR(cm),&cwid->obj);
	return 0;
err:
	return 1;
}
Beispiel #17
0
static GtkWidget *
mug_query_area (MugData * mugdata)
{
	GtkWidget *queryarea, *paned, *scrolled;

#ifdef HAVE_GTK3
	queryarea = gtk_box_new (GTK_ORIENTATION_VERTICAL, 2);
	paned = gtk_paned_new (GTK_ORIENTATION_VERTICAL);
#else
	queryarea = gtk_vbox_new (FALSE, 2);
	paned = gtk_vpaned_new ();
#endif /*!HAVE_GTK3*/


	mugdata->mlist = mug_msg_list_view_new
		(mu_runtime_path(MU_RUNTIME_PATH_XAPIANDB));
	scrolled = gtk_scrolled_window_new (NULL, NULL);
	gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled),
					GTK_POLICY_AUTOMATIC,
					GTK_POLICY_AUTOMATIC);

	gtk_container_add (GTK_CONTAINER (scrolled), mugdata->mlist);
	gtk_paned_add1 (GTK_PANED (paned), scrolled);

	mugdata->msgview = mug_msg_view_new ();
	mug_msg_view_set_note (MUG_MSG_VIEW(mugdata->msgview),
			       "<h1>Welcome to <i>mug</i>!</h1><hr>"
			       "<tt>mug</tt> is an experimental UI for <tt>mu</tt>, which will "
			       "slowly evolve into something useful.<br><br>Enjoy the ride.");
	g_signal_connect (G_OBJECT (mugdata->mlist), "msg-selected",
			  G_CALLBACK (on_msg_selected), mugdata);
	g_signal_connect (G_OBJECT (mugdata->mlist), "error-occured",
			  G_CALLBACK (on_list_view_error), mugdata);
	gtk_paned_add2 (GTK_PANED (paned), mugdata->msgview);

	mugdata->querybar = mug_querybar ();
	g_signal_connect (G_OBJECT (mugdata->querybar), "query-changed",
			  G_CALLBACK (on_query_changed), mugdata);

	gtk_box_pack_start (GTK_BOX (queryarea),
			    mugdata->querybar, FALSE, FALSE, 2);
	gtk_box_pack_start (GTK_BOX (queryarea), paned, TRUE, TRUE, 2);

	gtk_widget_show_all (queryarea);
	return queryarea;
}
Beispiel #18
0
/**
 * 创建文件接收区域.
 * @return 主窗体
 */
GtkWidget *DialogPeer::CreateFileReceiveArea()
{
    GtkWidget *vpaned;
    gint position;
    vpaned = gtk_vpaned_new();
    g_datalist_set_data(&widset, "file-receive-paned-widget", vpaned);
    g_object_set_data(G_OBJECT(vpaned), "position-name",
                             (gpointer)"file-receive-paned-divide");
    position = GPOINTER_TO_INT(g_datalist_get_data(&dtset,
                             "file-receive-paned-divide"));
    gtk_paned_set_position(GTK_PANED(vpaned), position);
    g_signal_connect(vpaned, "notify::position",
                     G_CALLBACK(PanedDivideChanged), &dtset);
    gtk_paned_pack1(GTK_PANED(vpaned),CreateFileToReceiveArea(),TRUE,FALSE);
    gtk_paned_pack2(GTK_PANED(vpaned),CreateFileReceivedArea(),TRUE,FALSE);
    return vpaned;
}
Beispiel #19
0
static GtkWidget *
mug_query_area (MugData * mugdata)
{
	GtkWidget *queryarea;
	GtkWidget *paned;
	GtkWidget *scrolled;

#ifdef HAVE_GTK3
	queryarea = gtk_box_new (GTK_ORIENTATION_VERTICAL, 2);
	paned = gtk_paned_new (GTK_ORIENTATION_VERTICAL);
#else
	queryarea = gtk_vbox_new (FALSE, 2);
	paned = gtk_vpaned_new ();
#endif /*!HAVE_GTK3 */


	mugdata->mlist = mug_msg_list_view_new
		(mu_runtime_path(MU_RUNTIME_PATH_XAPIANDB));
	scrolled = gtk_scrolled_window_new (NULL, NULL);
	gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled),
					GTK_POLICY_AUTOMATIC,
					GTK_POLICY_AUTOMATIC);

	gtk_container_add (GTK_CONTAINER (scrolled), mugdata->mlist);
	gtk_paned_add1 (GTK_PANED (paned), scrolled);

	mugdata->msgview = mug_msg_view_new ();

	mug_msg_view_set_msg (MUG_MSG_VIEW (mugdata->msgview), NULL);
	g_signal_connect (G_OBJECT (mugdata->mlist), "msg-selected",
			  G_CALLBACK (on_msg_selected), mugdata);
	g_signal_connect (G_OBJECT (mugdata->mlist), "error-occured",
			  G_CALLBACK (on_list_view_error), mugdata);
	gtk_paned_add2 (GTK_PANED (paned), mugdata->msgview);

	mugdata->querybar = mug_querybar ();
	g_signal_connect (G_OBJECT (mugdata->querybar), "query-changed",
			  G_CALLBACK (on_query_changed), mugdata);

	gtk_box_pack_start (GTK_BOX (queryarea),
			    mugdata->querybar, FALSE, FALSE, 2);
	gtk_box_pack_start (GTK_BOX (queryarea), paned, TRUE, TRUE, 2);

	gtk_widget_show_all (queryarea);
	return queryarea;
}
Beispiel #20
0
static void split_view(gboolean horizontal)
{
    GtkWidget *notebook = geany_data->main_widgets->notebook;
    GtkWidget *parent = gtk_widget_get_parent(notebook);
    GtkWidget *pane, *toolbar, *box, *splitwin_notebook;
    GeanyDocument *doc = document_get_current();
    gint width = gtk_widget_get_allocated_width(notebook) / 2;
    gint height = gtk_widget_get_allocated_height(notebook) / 2;

    g_return_if_fail(doc);
    g_return_if_fail(edit_window.editor == NULL);

    set_state(horizontal ? STATE_SPLIT_HORIZONTAL : STATE_SPLIT_VERTICAL);

    g_object_ref(notebook);
    gtk_container_remove(GTK_CONTAINER(parent), notebook);

    pane = horizontal ? gtk_hpaned_new() : gtk_vpaned_new();
    gtk_container_add(GTK_CONTAINER(parent), pane);

    gtk_container_add(GTK_CONTAINER(pane), notebook);
    g_object_unref(notebook);

    box = gtk_vbox_new(FALSE, 0);
    toolbar = create_toolbar();
    gtk_box_pack_start(GTK_BOX(box), toolbar, FALSE, FALSE, 0);
    edit_window.vbox = box;

    /* used just to make the split window look the same as the main editor */
    splitwin_notebook = gtk_notebook_new();
    gtk_notebook_set_show_tabs(GTK_NOTEBOOK(splitwin_notebook), FALSE);
    gtk_notebook_append_page(GTK_NOTEBOOK(splitwin_notebook), box, NULL);
    gtk_container_add(GTK_CONTAINER(pane), splitwin_notebook);

    set_editor(&edit_window, doc->editor);

    if (horizontal)
    {
        gtk_paned_set_position(GTK_PANED(pane), width);
    }
    else
    {
        gtk_paned_set_position(GTK_PANED(pane), height);
    }
    gtk_widget_show_all(pane);
}
Beispiel #21
0
static void split_view(gboolean horizontal)
{
	GtkWidget *notebook = geany_data->main_widgets->notebook;
	GtkWidget *parent = gtk_widget_get_parent(notebook);
	GtkWidget *pane, *toolbar, *box;
	GeanyDocument *doc = document_get_current();
	gint width = notebook->allocation.width / 2;
	gint height = notebook->allocation.height / 2;

	g_return_if_fail(doc);
	g_return_if_fail(edit_window.editor == NULL);

	set_state(horizontal ? STATE_SPLIT_HORIZONTAL : STATE_SPLIT_VERTICAL);

	gtk_widget_ref(notebook);
	gtk_container_remove(GTK_CONTAINER(parent), notebook);

	pane = horizontal ? gtk_hpaned_new() : gtk_vpaned_new();
	gtk_container_add(GTK_CONTAINER(parent), pane);

	gtk_container_add(GTK_CONTAINER(pane), notebook);
	gtk_widget_unref(notebook);

	box = gtk_vbox_new(FALSE, 0);
	toolbar = create_toolbar();
	gtk_box_pack_start(GTK_BOX(box), toolbar, FALSE, FALSE, 0);
	gtk_container_add(GTK_CONTAINER(pane), box);
	edit_window.vbox = box;

	set_editor(&edit_window, doc->editor);

	if (horizontal)
	{
		gtk_paned_set_position(GTK_PANED(pane), width);
	}
	else
	{
		gtk_paned_set_position(GTK_PANED(pane), height);
	}
	gtk_widget_show_all(pane);
}
static void
sunone_invitation_list_init (SunOneInvitationList *object)
{
	SunOneInvitationList *list = SUNONE_INVITATION_LIST (object);
	SunOneInvitationListPrivate *priv;
	GtkWidget *scroll;
	int pos;
	
	list->priv = g_new0 (SunOneInvitationListPrivate, 1);
	priv = list->priv;

	priv->client = gconf_client_get_default ();
	priv->model = NULL;
	priv->treeview = NULL;
	priv->pane = gtk_vpaned_new ();

	gtk_box_set_homogeneous (GTK_BOX (list), FALSE);
	
	scroll = gtk_scrolled_window_new (NULL, NULL);
	gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scroll), 
					GTK_POLICY_AUTOMATIC, 
					GTK_POLICY_AUTOMATIC);
	gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scroll), 
					GTK_SHADOW_IN);
#if USE_ITIP_VIEW
	priv->control = sunone_itip_view_new ();
#else
	priv->control = bonobo_widget_new_control (INVITATION_CONTROL_IID, NULL);
#endif
	gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (scroll),
						priv->control);
	
	gtk_paned_add2 (GTK_PANED (priv->pane), GTK_WIDGET (scroll));

	pos = gconf_client_get_int (priv->client,
			"/apps/evolution/evolution-jescs/invitationList/panePosition",
			NULL);
	gtk_paned_set_position (GTK_PANED (priv->pane), pos);

	gtk_box_pack_start (GTK_BOX (list), priv->pane, TRUE, TRUE, 0);
}
Beispiel #23
0
/**
 * 创建文件接收和发送区域.
 * @return 主窗体
 */
GtkWidget *DialogPeer::CreateFileArea()
{
    GtkWidget *frame, *vpaned;
    gint position;

    frame = gtk_frame_new(_("Enclosure."));
    g_datalist_set_data(&widset, "file-enclosure-frame-widget", frame);
    gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_ETCHED_IN);
    vpaned = gtk_vpaned_new();
    g_object_set_data(G_OBJECT(vpaned), "position-name",
                             (gpointer)"enclosure-paned-divide");
    position = GPOINTER_TO_INT(g_datalist_get_data(&dtset,
                             "enclosure-paned-divide"));
    gtk_paned_set_position(GTK_PANED(vpaned), position);
    g_signal_connect(vpaned, "notify::position",
                     G_CALLBACK(PanedDivideChanged), &dtset);
    gtk_container_add(GTK_CONTAINER(frame), vpaned);
    gtk_paned_pack1(GTK_PANED(vpaned),CreateFileReceiveArea(),TRUE,TRUE);
    gtk_paned_pack2(GTK_PANED(vpaned),CreateFileSendArea(),FALSE,TRUE);
    return frame;
}
Beispiel #24
0
GtkWidget* GetSplitterWidget(wxOrientation orient)
{
    static GtkWidget* widgets[2];
    const GtkOrientation gtkOrient =
        orient == wxHORIZONTAL ? GTK_ORIENTATION_HORIZONTAL : GTK_ORIENTATION_VERTICAL;
    GtkWidget*& widget = widgets[gtkOrient];
    if (widget == NULL)
    {
#ifdef __WXGTK3__
        widget = gtk_paned_new(gtkOrient);
#else
        if (orient == wxHORIZONTAL)
            widget = gtk_hpaned_new();
        else
            widget = gtk_vpaned_new();
#endif
        gtk_container_add(GetContainer(), widget);
        gtk_widget_realize(widget);
    }

    return widget;
}
Beispiel #25
0
Datei: t24.cpp Projekt: ombt/ombt
int main( int   argc,
          char *argv[] )
{
    GtkWidget *window;
    GtkWidget *vpaned;
    GtkWidget *list;
    GtkWidget *text;

    gtk_init (&argc, &argv);
   
    window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
    gtk_window_set_title (GTK_WINDOW (window), "Paned Windows");
    g_signal_connect (window, "destroy",
	              G_CALLBACK (gtk_main_quit), NULL);
    gtk_container_set_border_width (GTK_CONTAINER (window), 10);
    gtk_widget_set_size_request (GTK_WIDGET (window), 450, 400);

    /* create a vpaned widget and add it to our toplevel window */
   
    vpaned = gtk_vpaned_new ();
    gtk_container_add (GTK_CONTAINER (window), vpaned);
    gtk_widget_show (vpaned);
   
    /* Now create the contents of the two halves of the window */
   
    list = create_list ();
    gtk_paned_add1 (GTK_PANED (vpaned), list);
    gtk_widget_show (list);
   
    text = create_text ();
    gtk_paned_add2 (GTK_PANED (vpaned), text);
    gtk_widget_show (text);
    gtk_widget_show (window);

    gtk_main ();

    return 0;
}
Beispiel #26
0
void
pevent_dialog_show ()
{
	GtkWidget *vbox, *hbox, *tbox, *wid, *bh, *th;
	GtkListStore *store, *hstore;
	GtkTreeSelection *sel;

	if (pevent_dialog)
	{
		mg_bring_tofront (pevent_dialog);
		return;
	}

	pevent_dialog =
			  mg_create_generic_tab ("edit events", _("Edit Events"),
											 TRUE, FALSE, pevent_dialog_close, NULL,
											 600, 455, &vbox, 0);

	wid = gtk_vpaned_new ();
	th = gtk_vbox_new (0, 2);
	bh = gtk_vbox_new (0, 2);
	gtk_widget_show (th);
	gtk_widget_show (bh);
	gtk_paned_pack1 (GTK_PANED (wid), th, 1, 1);
	gtk_paned_pack2 (GTK_PANED (wid), bh, 0, 1);
	gtk_box_pack_start (GTK_BOX (vbox), wid, 1, 1, 0);
	gtk_widget_show (wid);

	store = gtk_list_store_new (N_COLUMNS, G_TYPE_STRING,
	                            G_TYPE_STRING, G_TYPE_INT);
	pevent_dialog_list = gtkutil_treeview_new (th, GTK_TREE_MODEL (store), NULL,
															 COL_EVENT_NAME, _("Event"),
															 COL_EVENT_TEXT, _("Text"), -1);
	sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (pevent_dialog_list));
	g_signal_connect (G_OBJECT (sel), "changed",
							G_CALLBACK (pevent_dialog_select), store);

	pevent_dialog_twid = gtk_xtext_new (colors, 0);
	gtk_xtext_set_tint (GTK_XTEXT (pevent_dialog_twid), prefs.tint_red, prefs.tint_green, prefs.tint_blue);
	gtk_xtext_set_background (GTK_XTEXT (pevent_dialog_twid),
									  channelwin_pix, prefs.transparent);

	pevent_dialog_entry = gtk_entry_new_with_max_length (255);
	g_signal_connect (G_OBJECT (pevent_dialog_entry), "activate",
							G_CALLBACK (pevent_dialog_update), pevent_dialog_twid);
	gtk_box_pack_start (GTK_BOX (bh), pevent_dialog_entry, 0, 0, 0);
	gtk_widget_show (pevent_dialog_entry);

	tbox = gtk_hbox_new (0, 0);
	gtk_container_add (GTK_CONTAINER (bh), tbox);
	gtk_widget_show (tbox);

	gtk_widget_set_usize (pevent_dialog_twid, 150, 20);
	gtk_container_add (GTK_CONTAINER (tbox), pevent_dialog_twid);
	gtk_xtext_set_font (GTK_XTEXT (pevent_dialog_twid), prefs.font_normal);

	wid = gtk_vscrollbar_new (GTK_XTEXT (pevent_dialog_twid)->adj);
	gtk_box_pack_start (GTK_BOX (tbox), wid, FALSE, FALSE, 0);
	show_and_unfocus (wid);

	gtk_widget_show (pevent_dialog_twid);

	hstore = gtk_list_store_new (2, G_TYPE_INT, G_TYPE_STRING);
	pevent_dialog_hlist = gtkutil_treeview_new (bh, GTK_TREE_MODEL (hstore),
															  NULL,
															  0, _("$ Number"),
															  1, _("Description"), -1);
	gtk_widget_show (pevent_dialog_hlist);

	pevent_dialog_fill (pevent_dialog_list);
	gtk_widget_show (pevent_dialog_list);

	hbox = gtk_hbutton_box_new ();
	gtk_box_pack_end (GTK_BOX (vbox), hbox, 0, 0, 2);
	/*wid = gtk_button_new_with_label (_("Save"));
	gtk_box_pack_end (GTK_BOX (hbox), wid, 0, 0, 0);
	gtk_signal_connect (GTK_OBJECT (wid), "clicked",
							  GTK_SIGNAL_FUNC (pevent_save_cb), NULL);
	gtk_widget_show (wid);*/
	gtkutil_button (hbox, GTK_STOCK_SAVE_AS, NULL, pevent_save_cb,
						 (void *) 1, _("Save As..."));
	gtkutil_button (hbox, GTK_STOCK_OPEN, NULL, pevent_load_cb,
						 (void *) 0, _("Load From..."));
	wid = gtk_button_new_with_label (_("Test All"));
	gtk_box_pack_end (GTK_BOX (hbox), wid, 0, 0, 0);
	g_signal_connect (G_OBJECT (wid), "clicked",
							G_CALLBACK (pevent_test_cb), pevent_dialog_twid);
	gtk_widget_show (wid);

	wid = gtk_button_new_from_stock (GTK_STOCK_OK);
	gtk_box_pack_start (GTK_BOX (hbox), wid, 0, 0, 0);
	g_signal_connect (G_OBJECT (wid), "clicked",
							G_CALLBACK (pevent_ok_cb), NULL);
	gtk_widget_show (wid);

	gtk_widget_show (hbox);

	gtk_widget_show (pevent_dialog);
}
Beispiel #27
0
int main(int argc,char *argv[])

{
    
    app.connected = FALSE;
    
    app.is_server = FALSE;
    
    app.finish = FALSE;
    
    windowIO = g_slice_new (InputOutput);
    
    
    
    gtk_init(&argc, &argv);
    
    
    
    
    
    //  Main window
    
    app.chat = gtk_window_new(GTK_WINDOW_TOPLEVEL);
    
    gtk_container_set_border_width(GTK_CONTAINER(app.chat), 10);
    
    g_signal_connect(G_OBJECT(app.chat), "delete-event", G_CALLBACK(gtk_main_quit), NULL);
    
    gtk_window_set_default_size(GTK_WINDOW(app.chat), 600, 300);
    
    gtk_window_set_title(GTK_WINDOW(app.chat), "Conversation électronique");
    
    
    
    // GUI
    
    
    
    app.button  = gtk_button_new_with_label ("Terminer Session");
    
    app.button2 = gtk_button_new_with_label ("Demarrer Session");
    
    app.button3 = gtk_button_new_with_label ("Sauvegarde Fichier");
    
    //app.button4 = gtk_button_new_with_label ("Saisir Note");
    
    
    app.scrolled_window   = gtk_scrolled_window_new(NULL, NULL);
    
    
    
    windowIO->textview    = gtk_text_view_new();
    
    windowIO->entry       = gtk_entry_new();
    
    app.chat_right_column = gtk_vbox_new(FALSE, 5);
    
    app.chat_space        = gtk_hpaned_new ();
    
    app.container_option  = gtk_vpaned_new ();
    
    
    
    gtk_text_view_set_editable(GTK_TEXT_VIEW(windowIO->textview), FALSE);
    
    
    
    gtk_paned_set_position (GTK_PANED(app.chat_space), 450);
    
    gtk_paned_set_position (GTK_PANED(app.container_option), 250);
    
    
    
    gtk_paned_add1 (GTK_PANED(app.chat_space), app.container_option);
    
    gtk_paned_add2 (GTK_PANED(app.chat_space), app.chat_right_column);
    
    gtk_paned_add1 (GTK_PANED(app.container_option), app.scrolled_window);
    
    gtk_paned_add2 (GTK_PANED(app.container_option), windowIO->entry);
    
    
    
    gtk_box_pack_start(GTK_BOX(app.chat_right_column), app.button2, FALSE, FALSE,  0);
    
    gtk_box_pack_start(GTK_BOX(app.chat_right_column), app.button3, FALSE, FALSE, 10);
    
    //gtk_box_pack_start(GTK_BOX(app.chat_right_column), app.button4, FALSE, FALSE, 20);
    
    gtk_box_pack_end  (GTK_BOX(app.chat_right_column), app.button,  FALSE, FALSE, 25);
    
    
    
    
    
    gtk_container_add (GTK_CONTAINER(app.scrolled_window), windowIO->textview);
    
    gtk_container_add (GTK_CONTAINER(app.chat), app.chat_space);
    
    
    /*g_signal_connect (G_OBJECT (app.button4), "clicked",
                      G_CALLBACK (save_mark),
                      NULL);*/
    
    
    g_signal_connect (G_OBJECT (app.button3), "clicked",
                      G_CALLBACK (save_file),
                      NULL);
    
    
    g_signal_connect (G_OBJECT (app.button2), "clicked",
                      G_CALLBACK (start_session),
                      NULL);
    
    
    g_signal_connect (G_OBJECT (app.button), "clicked",
                      G_CALLBACK (end_session),
                      NULL);
    
    
    g_signal_connect (windowIO->entry, "activate",
                      G_CALLBACK (enter_text),
                      NULL);
    
    
    gtk_widget_show_all(app.chat);
    gtk_main();
    return 0;
}
Beispiel #28
0
/*
 * display the initial menu to setup global options
 * at startup.
 */
static void gtkui_setup(void)
{
   GtkTextIter iter;
   GtkWidget *item, *vbox, *scroll, *vpaned, *logo;
   GtkItemFactory *item_factory;
   GClosure *closure = NULL;
   GdkModifierType mods;
   gint keyval, width, height, left, top;
   char *path = NULL;

   GtkItemFactoryEntry file_menu[] = {
      { "/_File",         "<shift>F",   NULL,             0, "<Branch>", NULL },
      { "/File/_Open",    "<control>O", gtkui_file_open,  0, "<StockItem>", GTK_STOCK_OPEN },
      { "/File/_Save",    "<control>S", gtkui_file_write, 0, "<StockItem>", GTK_STOCK_SAVE },
      { "/File/sep1",     NULL,         NULL,             0, "<Separator>", NULL },
      { "/File/E_xit",    "<control>x", gtkui_exit,       0, "<StockItem>", GTK_STOCK_QUIT },
      { "/_Sniff",        "<shift>S",   NULL,             0, "<Branch>", NULL },
      { "/Sniff/Unified sniffing...",  "<shift>U", gtkui_unified_sniff, 0, "<StockItem>", GTK_STOCK_DND },
      { "/Sniff/Bridged sniffing...",  "<shift>B", gtkui_bridged_sniff, 0, "<StockItem>", GTK_STOCK_DND_MULTIPLE },
      { "/Sniff/sep2",    NULL,         NULL,             0, "<Separator>", NULL },
      { "/Sniff/Set pcap filter...",    "p",       gtkui_pcap_filter,   0, "<StockItem>", GTK_STOCK_PREFERENCES },
      { "/_Options",                    "<shift>O", NULL, 0, "<Branch>", NULL },
      { "/Options/Unoffensive", NULL, toggle_unoffensive, 0, "<ToggleItem>", NULL },
      { "/Options/Promisc mode", NULL, toggle_nopromisc,  0, "<ToggleItem>", NULL },
      { "/Options/Set netmask", "n", gtkui_set_netmask,   0, "<Item>", NULL}
#ifndef OS_WINDOWS
     ,{"/_?",          NULL,         NULL,             0, "<Branch>", NULL },
      {"/?/Contents", " ",           gtkui_help,       0, "<StockItem>", GTK_STOCK_HELP }
#endif
   };
   gint nmenu_items = sizeof (file_menu) / sizeof (file_menu[0]);

   DEBUG_MSG("gtkui_setup");

   width = gtkui_conf_get("window_width");
   height = gtkui_conf_get("window_height");
   left = gtkui_conf_get("window_left");
   top = gtkui_conf_get("window_top");

   /* create menu window */
   window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
   gtk_window_set_title(GTK_WINDOW (window), EC_PROGRAM" "EC_VERSION);
   gtk_window_set_default_size(GTK_WINDOW (window), width, height);

   if(left > 0 || top > 0)
      gtk_window_move(GTK_WINDOW(window), left, top);

   g_signal_connect (G_OBJECT (window), "delete_event", G_CALLBACK (gtkui_exit), NULL);

   accel_group = gtk_accel_group_new ();
   item_factory = gtk_item_factory_new (GTK_TYPE_MENU_BAR, "<main>", accel_group);
   gtk_item_factory_create_items (item_factory, nmenu_items, file_menu, NULL);

   /* hidden shortcut to start Unified Sniffing with default interface */
   closure = g_cclosure_new(G_CALLBACK(gtkui_unified_sniff_default), NULL, NULL);
   gtk_accelerator_parse ("u", &keyval, &mods);
   gtk_accel_group_connect(accel_group, keyval, mods, 0, closure);

   vbox = gtk_vbox_new(FALSE, 0);
   gtk_container_add(GTK_CONTAINER (window), vbox);
   gtk_widget_show(vbox);

   main_menu = gtk_item_factory_get_widget (item_factory, "<main>");
   gtk_box_pack_start(GTK_BOX(vbox), main_menu, FALSE, FALSE, 0);
   gtk_window_add_accel_group (GTK_WINDOW (window), accel_group);
   gtk_widget_show(main_menu);

   if(GBL_PCAP->promisc) {
      /* setting the menu item active will toggle this setting */
      /* it will be TRUE after the menu is updated */
      GBL_PCAP->promisc = 0;
      item = gtk_item_factory_get_item(item_factory, "/Options/Promisc mode");
      gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM (item), TRUE);
   }

   if(GBL_OPTIONS->unoffensive) {
      GBL_OPTIONS->unoffensive = 0;
      item = gtk_item_factory_get_item(item_factory, "/Options/Unoffensive");
      gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM (item), TRUE);
   }

   vpaned = gtk_vpaned_new();

   /* notebook for MDI pages */
   notebook_frame = gtk_frame_new(NULL);
   gtk_frame_set_shadow_type(GTK_FRAME (notebook_frame), GTK_SHADOW_IN);
   gtk_paned_pack1(GTK_PANED(vpaned), notebook_frame, TRUE, TRUE);
   gtk_widget_show(notebook_frame);

   path = INSTALL_DATADIR "/" EC_PROGRAM "/" LOGO_FILE;
   if(g_file_test(path, G_FILE_TEST_EXISTS))
      logo = gtk_image_new_from_file(path);
   else /* if neither path is valid gtk will use a broken image icon */
      logo = gtk_image_new_from_file("./share/" LOGO_FILE);

   gtk_misc_set_alignment (GTK_MISC (logo), 0.5, 0.5);
   gtk_container_add(GTK_CONTAINER (notebook_frame), logo);
   gtk_widget_show(logo);

   /* messages */
   scroll = gtk_scrolled_window_new(NULL, NULL);
   gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW (scroll),
                                  GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS);
   gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW (scroll), GTK_SHADOW_IN);
   gtk_paned_pack2(GTK_PANED (vpaned), scroll, FALSE, TRUE);
   gtk_widget_show(scroll);

   textview = gtk_text_view_new();
   gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW (textview), GTK_WRAP_WORD_CHAR);
   gtk_text_view_set_editable(GTK_TEXT_VIEW (textview), FALSE);
   gtk_text_view_set_cursor_visible(GTK_TEXT_VIEW (textview), FALSE);
   gtk_widget_set_size_request(textview, -1, 140);
   gtk_container_add(GTK_CONTAINER (scroll), textview);
   gtk_widget_show(textview);

   msgbuffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW (textview));
   gtk_text_buffer_get_end_iter(msgbuffer, &iter);
   endmark = gtk_text_buffer_create_mark(msgbuffer, "end", &iter, FALSE);

   gtk_box_pack_end(GTK_BOX(vbox), vpaned, TRUE, TRUE, 0);
   gtk_widget_show(vpaned);

   gtk_widget_show(window);

   DEBUG_MSG("gtk_setup: end");
}
Beispiel #29
0
/* engineering_init */
static Engineering * _engineering_init(PhonePluginHelper * helper)
{
	Engineering * engineering;
	GtkWidget * vbox;
	GtkWidget * toolbar;
	GtkWidget * paned;
	GtkWidget * frame;
	GtkWidget * scrolled;
	size_t i;
	GtkCellRenderer * renderer;
	GtkTreeViewColumn * column;

	if((engineering = object_new(sizeof(*engineering))) == NULL)
		return NULL;
	engineering->helper = helper;
	engineering->source = 0;
	engineering->enci = 0;
	engineering->enci_cnt = 0;
	/* widgets */
	/* window */
	engineering->window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
	gtk_window_set_default_size(GTK_WINDOW(engineering->window), 200, 300);
#if GTK_CHECK_VERSION(2, 6, 0)
	gtk_window_set_icon_name(GTK_WINDOW(engineering->window),
			"stock_compile");
#endif
	gtk_window_set_title(GTK_WINDOW(engineering->window),
			"Engineering mode");
	g_signal_connect_swapped(engineering->window, "delete-event",
			G_CALLBACK(_on_engineering_closex), engineering);
#if GTK_CHECK_VERSION(3, 0, 0)
	vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
#else
	vbox = gtk_vbox_new(FALSE, 0);
#endif
	/* toolbar */
	toolbar = gtk_toolbar_new();
	engineering->tb_play = gtk_toggle_tool_button_new_from_stock(
			GTK_STOCK_MEDIA_PLAY);
	g_signal_connect_swapped(G_OBJECT(engineering->tb_play), "toggled",
			G_CALLBACK(_on_engineering_play_toggled), engineering);
	gtk_toolbar_insert(GTK_TOOLBAR(toolbar), engineering->tb_play, -1);
	engineering->tb_fullscreen = gtk_toggle_tool_button_new_from_stock(
			GTK_STOCK_FULLSCREEN);
	g_signal_connect_swapped(engineering->tb_fullscreen, "toggled",
			G_CALLBACK(_on_engineering_fullscreen_toggled),
			engineering);
	gtk_toolbar_insert(GTK_TOOLBAR(toolbar), engineering->tb_fullscreen,
			-1);
	gtk_box_pack_start(GTK_BOX(vbox), toolbar, FALSE, TRUE, 0);
	/* serving cell view */
#if GTK_CHECK_VERSION(3, 0, 0)
	paned = gtk_paned_new(GTK_ORIENTATION_VERTICAL);
#else
	paned = gtk_vpaned_new();
#endif
	frame = gtk_frame_new("Serving cell");
	engineering->sc_store = gtk_list_store_new(SC_COL_COUNT,
			G_TYPE_STRING,		/* SC_COL_FREQUENCY */
			G_TYPE_STRING,		/* SC_COL_C1 */
			G_TYPE_STRING,		/* SC_COL_C2 */
			G_TYPE_STRING,		/* SC_COL_RX_LEVEL */
			G_TYPE_STRING,		/* SC_COL_STATION_ID */
			G_TYPE_STRING,		/* SC_COL_CELL_ID */
			G_TYPE_STRING,		/* SC_COL_TX_LEVEL */
			G_TYPE_STRING,		/* SC_COL_TIMESLOT_NUMBER */
			G_TYPE_STRING,		/* SC_COL_LAC */
			G_TYPE_STRING);		/* SC_COL_TMSI */
	scrolled = gtk_scrolled_window_new(NULL, NULL);
	gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled),
			GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
	engineering->sc_view = gtk_tree_view_new_with_model(GTK_TREE_MODEL(
				engineering->sc_store));
	gtk_tree_view_set_rules_hint(GTK_TREE_VIEW(engineering->sc_view), TRUE);
	gtk_tree_selection_set_mode(gtk_tree_view_get_selection(GTK_TREE_VIEW(
					engineering->sc_view)),
			GTK_SELECTION_NONE);
	/* columns */
	for(i = 0; _engineering_sc_columns[i].title != NULL; i++)
	{
		renderer = gtk_cell_renderer_text_new();
		column = gtk_tree_view_column_new_with_attributes(
				_engineering_sc_columns[i].title, renderer,
				"text", _engineering_sc_columns[i].col, NULL);
		gtk_tree_view_append_column(GTK_TREE_VIEW(engineering->sc_view),
				column);
	}
	gtk_container_add(GTK_CONTAINER(scrolled), engineering->sc_view);
	gtk_container_add(GTK_CONTAINER(frame), scrolled);
	gtk_container_set_border_width(GTK_CONTAINER(frame), 4);
	gtk_paned_add1(GTK_PANED(paned), frame);
	/* neighbor cells view */
	frame = gtk_frame_new("Neighbor cells");
	engineering->nc_store = gtk_list_store_new(NC_COL_COUNT,
			G_TYPE_STRING,		/* NC_COL_FREQUENCY */
			G_TYPE_STRING,		/* NC_COL_C1 */
			G_TYPE_STRING,		/* NC_COL_C2 */
			G_TYPE_STRING,		/* NC_COL_RXLEV */
			G_TYPE_STRING,		/* NC_COL_BSIC */
			G_TYPE_STRING,		/* NC_COL_CELL_ID */
			G_TYPE_STRING,		/* NC_COL_LAC */
			G_TYPE_STRING,		/* NC_COL_FRAME_OFFSET */
			G_TYPE_STRING,		/* NC_COL_CBA */
			G_TYPE_STRING,		/* NC_COL_CBQ */
			G_TYPE_STRING,		/* NC_COL_CELL_TYPE_IND */
			G_TYPE_STRING);		/* NC_COL_RAC */
	scrolled = gtk_scrolled_window_new(NULL, NULL);
	gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled),
			GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
	engineering->nc_view = gtk_tree_view_new_with_model(GTK_TREE_MODEL(
				engineering->nc_store));
	gtk_tree_view_set_rules_hint(GTK_TREE_VIEW(engineering->nc_view), TRUE);
	gtk_tree_selection_set_mode(gtk_tree_view_get_selection(GTK_TREE_VIEW(
					engineering->nc_view)),
			GTK_SELECTION_NONE);
	/* columns */
	for(i = 0; _engineering_nc_columns[i].title != NULL; i++)
	{
		renderer = gtk_cell_renderer_text_new();
		column = gtk_tree_view_column_new_with_attributes(
				_engineering_nc_columns[i].title, renderer,
				"text", _engineering_nc_columns[i].col, NULL);
		gtk_tree_view_append_column(GTK_TREE_VIEW(engineering->nc_view),
				column);
	}
	gtk_container_add(GTK_CONTAINER(scrolled), engineering->nc_view);
	gtk_container_add(GTK_CONTAINER(frame), scrolled);
	gtk_container_set_border_width(GTK_CONTAINER(frame), 4);
	gtk_container_add(GTK_CONTAINER(engineering->window), vbox);
	gtk_paned_add2(GTK_PANED(paned), frame);
	gtk_box_pack_start(GTK_BOX(vbox), paned, TRUE, TRUE, 0);
	gtk_widget_show_all(engineering->window);
	/* trigger */
#if 0 /* FIXME reimplement using an extension to the Hayes modem plug-in */
	helper->register_trigger(helper->phone, plugin, "%EM",
			_on_engineering_trigger_em);
#endif
	return engineering;
}
Beispiel #30
0
//=====================================================================
  MemObj GUI_box_paned__ (MemObj *box1, MemObj *box2,
                          MemObj *o_par, int mode, int resi, int siz1) {
//=====================================================================
/// \code
/// GUI_box_paned__          get 2 boxes with movable separation-line
///
/// Input:
///   o_par      parentBox
///   mode       0 = vertical separation-line, returns 2 horizontal boxes
///              1 = horizontal separation-line, returns 2 vertical boxes
///   resi       0 = make box1 fixed, box2 resizable
///              1 = make box1 resizable, box2 fixed.
///   siz1       initial size of box1 in pixels
/// Output:
///   box1
///   box2
/// \endcode


  int         iDir, iTyp, pTyp, border = 4;
  void        *w_par;
  GtkWidget   *w1 , *w2;
  GtkWidget   *hpaned;
  Obj_Unknown *go0, *go1, *go2;


  // printf("GUI_box_paned__ %d %d %d\n",mode,resi,siz1);


  // get gtk-widget for parentBox from MemObj
  w_par = GUI_obj_parent__ (&pTyp, o_par);
  if(!w_par) return (UME_obj_invalid_set (-3));


  // get address & memspc
  GUI_obj_spc ((void**)&go0, sizeof(Obj_Unknown));
  if(!go0) return (UME_obj_invalid_set (-1));


  // get address & memspc
  GUI_obj_spc ((void**)&go1, sizeof(Obj_Unknown));
  if(!go1) return (UME_obj_invalid_set (-1));


  // get address & memspc
  GUI_obj_spc ((void**)&go2, sizeof(Obj_Unknown));
  if(!go2) return (UME_obj_invalid_set (-1));





  if(mode == 0) {
    // 0 = vertical separation-line, 2 horizontal boxes
    hpaned = gtk_hpaned_new ();      // horizontal paned
    gtk_container_add (GTK_CONTAINER(w_par), hpaned);
    // gtk_box_pack_start (GTK_BOX(parent), hpaned, TRUE, TRUE, 0);
    w1 = gtk_hbox_new (FALSE, 0);
    w2 = gtk_hbox_new (FALSE, 0);
    iTyp = TYP_GUI_BoxH;

  } else {
    // 1 = horizontal separation-line, 2 vertical boxes
    hpaned = gtk_vpaned_new ();      // vertical paned
    gtk_container_add (GTK_CONTAINER(w_par), hpaned);
    w1 = gtk_vbox_new (FALSE, 0);
    w2 = gtk_vbox_new (FALSE, 0);
    iTyp = TYP_GUI_BoxV;
  }

/*
  if(resi == 0) {                        //  resize shrink
    gtk_paned_pack1 (GTK_PANED (hpaned), w1, FALSE, TRUE);
    gtk_paned_pack2 (GTK_PANED (hpaned), w2, TRUE, FALSE);

  } else {
    gtk_paned_pack1 (GTK_PANED (hpaned), w1, TRUE, FALSE);
    gtk_paned_pack2 (GTK_PANED (hpaned), w2, FALSE, FALSE);
  }
*/
    gtk_paned_pack1 (GTK_PANED (hpaned), w1, FALSE, TRUE);
    gtk_paned_pack2 (GTK_PANED (hpaned), w2, FALSE, TRUE);


  gtk_paned_set_position (GTK_PANED (hpaned), siz1);

  gtk_widget_show (w1);
  gtk_widget_show (w2);
  gtk_widget_show (hpaned);


  go1->gio_typ  = iTyp;
  go1->widget   = w1;

  go2->gio_typ  = iTyp;
  go2->widget   = w2;

  *box1 = go1->mem_obj;
  *box2 = go2->mem_obj;

  go0->gio_typ  = TYP_GUI_Unknown;
  go0->widget   = hpaned;


  return (((Obj_Unknown*)go0)->mem_obj);


}