コード例 #1
0
ファイル: gtkbuttonaccessible.c プロジェクト: GNOME/gtk
static const gchar *
gtk_button_accessible_get_name (AtkObject *obj)
{
  const gchar *name = NULL;
  GtkWidget *widget;
  GtkWidget *child;

  widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj));
  if (widget == NULL)
    return NULL;

  name = ATK_OBJECT_CLASS (gtk_button_accessible_parent_class)->get_name (obj);
  if (name != NULL)
    return name;

  child = get_label_from_button (widget);
  if (GTK_IS_LABEL (child))
    name = gtk_label_get_text (GTK_LABEL (child));
  else
    {
      GtkWidget *image;

      image = get_image_from_button (widget);
      if (GTK_IS_IMAGE (image))
        {
          AtkObject *atk_obj;

          atk_obj = gtk_widget_get_accessible (image);
          name = atk_object_get_name (atk_obj);
        }
    }

  return name;
}
コード例 #2
0
ファイル: gailnotebookpage.c プロジェクト: coapp-packages/gtk
static gint 
gail_notebook_page_get_offset_at_point (AtkText      *text,
                                        gint         x,
                                        gint         y,
	          		        AtkCoordType coords)
{ 
  GtkWidget *label;
  GailNotebookPage *notebook_page;
  gint index, x_layout, y_layout;
  const gchar *label_text;

  notebook_page = GAIL_NOTEBOOK_PAGE (text);
  label = get_label_from_notebook_page (notebook_page);

  if (!GTK_IS_LABEL(label))
    return -1;
  
  gtk_label_get_layout_offsets (GTK_LABEL (label), &x_layout, &y_layout);
  
  index = gail_misc_get_index_at_point_in_layout (label, 
                                              gtk_label_get_layout (GTK_LABEL (label)), 
                                              x_layout, y_layout, x, y, coords);
  label_text = gtk_label_get_text (GTK_LABEL (label));
  if (index == -1)
    {
      if (coords == ATK_XY_WINDOW || coords == ATK_XY_SCREEN)
        return g_utf8_strlen (label_text, -1);

      return index;  
    }
  else
    return g_utf8_pointer_to_offset (label_text, label_text + index);  
}
コード例 #3
0
ファイル: gailexpander.c プロジェクト: Aridna/gtk2
static gunichar 
gail_expander_get_character_at_offset (AtkText *text,
                                       gint    offset)
{
  GtkWidget *widget;
  GtkWidget *label;
  const gchar *string;
  gchar *index;

  widget = GTK_ACCESSIBLE (text)->widget;
  if (widget == NULL)
    /* State is defunct */
    return '\0';

  label = gtk_expander_get_label_widget (GTK_EXPANDER (widget));

  if (!GTK_IS_LABEL(label))
    return '\0';
  string = gtk_label_get_text (GTK_LABEL (label));
  if (offset >= g_utf8_strlen (string, -1))
    return '\0';
  index = g_utf8_offset_to_pointer (string, offset);

  return g_utf8_get_char (index);
}
コード例 #4
0
ファイル: combobox.cpp プロジェクト: czxxjtu/wxPython-1
wxString wxComboBox::GetStringSelection() const
{
    wxCHECK_MSG( m_widget != NULL, wxEmptyString, wxT("invalid combobox") );

#ifdef __WXGTK24__
    if (!gtk_check_version(2,4,0))
    {
        GtkComboBox* combobox = GTK_COMBO_BOX( m_widget );
        int sel = gtk_combo_box_get_active( combobox );
        if (sel == -1)
            return wxEmptyString;
        return GetString(sel);
    }
    else
#endif
    {
        GtkWidget *list = GTK_COMBO(m_widget)->list;

        GList *selection = GTK_LIST(list)->selection;
        if (selection)
        {
            GtkBin *bin = GTK_BIN( selection->data );
            GtkLabel *label = GTK_LABEL( bin->child );
            wxString tmp( wxGTK_CONV_BACK( gtk_label_get_text(label) ) );
            return tmp;
        }

        wxFAIL_MSG( wxT("wxComboBox: no selection") );
    }

    return wxEmptyString;
}
コード例 #5
0
ファイル: gailnotebookpage.c プロジェクト: coapp-packages/gtk
static gchar*
gail_notebook_page_get_text (AtkText *text,
                             gint    start_pos,
                             gint    end_pos)
{
  GtkWidget *label;
  GailNotebookPage *notebook_page;
  const gchar *label_text;

  notebook_page = GAIL_NOTEBOOK_PAGE (text);
  label = get_label_from_notebook_page (notebook_page);

  if (!GTK_IS_LABEL (label))
    return NULL;

  if (!notebook_page->textutil) 
    gail_notebook_page_init_textutil (notebook_page, label);

  label_text = gtk_label_get_text (GTK_LABEL (label));

  if (label_text == NULL)
    return NULL;
  else
  {
    return gail_text_util_get_substring (notebook_page->textutil, 
                                         start_pos, end_pos);
  }
}
コード例 #6
0
/* Hack to make the plugin-provided editor widget fit in better with
 * the control center by changing
 *
 *     Foo:     [__________]
 *     Bar baz: [__________]
 *
 * to
 *
 *          Foo [__________]
 *      Bar baz [__________]
 */
static void
vpn_gnome3ify_editor (GtkWidget *widget)
{
        if (GTK_IS_CONTAINER (widget)) {
                GList *children, *iter;

                children = gtk_container_get_children (GTK_CONTAINER (widget));
                for (iter = children; iter; iter = iter->next)
                        vpn_gnome3ify_editor (iter->data);
                g_list_free (children);
        } else if (GTK_IS_LABEL (widget)) {
                const char *text;
                gfloat xalign;
                char *newtext;
                int len;

                xalign = gtk_label_get_xalign (GTK_LABEL (widget));
                if (xalign != 0.0)
                        return;
                text = gtk_label_get_text (GTK_LABEL (widget));
                len = strlen (text);
                if (len < 2 || text[len - 1] != ':')
                        return;

                newtext = g_strndup (text, len - 1);
                gtk_label_set_text (GTK_LABEL (widget), newtext);
                g_free (newtext);
                gtk_label_set_xalign (GTK_LABEL (widget), 1.0);
        }
}
コード例 #7
0
/*! \brief Get the label text
 *
 *  \param [in] widget This GschemTranslateWidget
 *  \return The label text
 */
const char*
gschem_translate_widget_get_label_text (GschemTranslateWidget *widget)
{
  g_return_val_if_fail (widget != NULL, NULL);

  return gtk_label_get_text (GTK_LABEL (widget->label));
}
コード例 #8
0
static void
plugin_recreate_gui (gpointer data)
{
    gui *plugin = data;
    if (plugin->label != NULL && (strlen (plugin->label) > 0)) {
        if (plugin->lab == NULL) {
            plugin->lab = gtk_label_new (plugin->label);
            gtk_widget_show (plugin->lab);
            gtk_box_pack_start (GTK_BOX(plugin->hbox), plugin->lab, FALSE, FALSE, 1);
            gtk_box_reorder_child (GTK_BOX(plugin->hbox), plugin->lab, 0);
        } else {
            if (gtk_label_get_text (GTK_LABEL(plugin->lab)) != plugin->label) {
                gtk_label_set_text (GTK_LABEL(plugin->lab), plugin->label);
            }
        }
    } else {
        if (GTK_IS_WIDGET (plugin->lab)) {
            gtk_widget_destroy (plugin->lab);
            plugin->lab = NULL;
        }
    }
    if (plugin->orientation == VERTICAL) {
        gtk_widget_reparent (plugin->fs, plugin->vbox);
        gtk_widget_reparent (plugin->lab, plugin->vbox);
    } else {
        gtk_widget_reparent (plugin->fs, plugin->hbox);
        gtk_widget_reparent (plugin->lab, plugin->hbox);
    }
}
コード例 #9
0
ファイル: gaillabel.c プロジェクト: coapp-packages/gtk
static const gchar*
gail_label_get_name (AtkObject *accessible)
{
  const gchar *name;

  g_return_val_if_fail (GAIL_IS_LABEL (accessible), NULL);

  name = ATK_OBJECT_CLASS (gail_label_parent_class)->get_name (accessible);
  if (name != NULL)
    return name;
  else
    {
      /*
       * Get the text on the label
       */
      GtkWidget *widget;

      widget = GTK_ACCESSIBLE (accessible)->widget;
      if (widget == NULL)
        /*
         * State is defunct
         */
        return NULL;

      g_return_val_if_fail (GTK_IS_LABEL (widget), NULL);

      return gtk_label_get_text (GTK_LABEL (widget));
    }
}
コード例 #10
0
ファイル: gailbutton.c プロジェクト: BYC/gtk
static void
gail_button_notify_label_gtk (GObject           *obj,
                              GParamSpec        *pspec,
                              gpointer           data)
{
  AtkObject* atk_obj = ATK_OBJECT (data);
  GtkLabel *label;
  GailButton *gail_button;

  if (strcmp (pspec->name, "label") == 0)
    {
      const gchar* label_text;

      label = GTK_LABEL (obj);

      label_text = gtk_label_get_text (label);

      gail_button = GAIL_BUTTON (atk_obj);
      gail_text_util_text_setup (gail_button->textutil, label_text);

      if (atk_obj->name == NULL)
      {
        /*
         * The label has changed so notify a change in accessible-name
         */
        g_object_notify (G_OBJECT (atk_obj), "accessible-name");
      }
      /*
       * The label is the only property which can be changed
       */
      g_signal_emit_by_name (atk_obj, "visible_data_changed");
    }
}
コード例 #11
0
ファイル: gailbutton.c プロジェクト: BYC/gtk
static gint
gail_button_real_add_gtk (GtkContainer *container,
                          GtkWidget    *widget,
                          gpointer     data)
{
  GtkLabel *label;
  GailButton *button;

  if (GTK_IS_LABEL (widget))
    {
      const gchar* label_text;

      label = GTK_LABEL (widget);


      button = GAIL_BUTTON (data);
      if (!button->textutil)
        gail_button_init_textutil (button, widget);
      else
        {
          label_text = gtk_label_get_text (label);
          gail_text_util_text_setup (button->textutil, label_text);
        }
    }

  return 1;
}
コード例 #12
0
ファイル: gailbutton.c プロジェクト: BYC/gtk
static gunichar 
gail_button_get_character_at_offset (AtkText	         *text,
                                     gint	         offset)
{
  GtkWidget *widget;
  GtkWidget *label;
  const gchar *string;
  gchar *index;

  widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text));

  if (widget == NULL)
    /* State is defunct */
    return '\0';

  label = get_label_from_button (widget, 0, FALSE);

  if (!GTK_IS_LABEL(label))
    return '\0';
  string = gtk_label_get_text (GTK_LABEL (label));
  if (offset >= g_utf8_strlen (string, -1))
    return '\0';
  index = g_utf8_offset_to_pointer (string, offset);

  return g_utf8_get_char (index);
}
コード例 #13
0
ファイル: gailbutton.c プロジェクト: BYC/gtk
static gchar*
gail_button_get_text (AtkText *text,
                      gint    start_pos,
                      gint    end_pos)
{
  GtkWidget *widget;
  GtkWidget  *label;
  GailButton *button;
  const gchar *label_text;

  widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text));

  if (widget == NULL)
    /* State is defunct */
    return NULL;

  label = get_label_from_button (widget, 0, FALSE);

  if (!GTK_IS_LABEL (label))
    return NULL;

  button = GAIL_BUTTON (text);
  if (!button->textutil) 
    gail_button_init_textutil (button, label);

  label_text = gtk_label_get_text (GTK_LABEL (label));

  if (label_text == NULL)
    return NULL;
  else
  {
    return gail_text_util_get_substring (button->textutil, 
                                         start_pos, end_pos);
  }
}
コード例 #14
0
ファイル: tab-page.c プロジェクト: Mic92/stuurman
const char* fm_tab_page_get_title(FmTabPage* page)
{
    g_return_val_if_fail(page, NULL);

    FmTabLabel* label = page->tab_label;
    return gtk_label_get_text(label->label);
}
コード例 #15
0
ファイル: tabwin.c プロジェクト: aylusltd/gretl
void tabwin_tab_set_status (windata_t *vwin)
{
    gboolean unsaved = (vwin->flags & VWIN_CONTENT_CHANGED);
    tabwin_t *tabwin = vwin_get_tabwin(vwin);
    GtkWidget *tab, *label;
    const gchar *text, *p;
    gchar *modtext = NULL;

    tab = gtk_notebook_get_tab_label(GTK_NOTEBOOK(tabwin->tabs), 
				     vwin->main);
    label = g_object_get_data(G_OBJECT(tab), "label");

    if (label != NULL) {
	text = gtk_label_get_text(GTK_LABEL(label));
	p = strstr(text, " *");
	if (unsaved && p == NULL) {
	    modtext = g_strdup_printf("%s *", text);
	} else if (!unsaved && p != NULL) {
	    modtext = g_strndup(text, strlen(text) - 2);
	}
    }

    if (modtext != NULL) {
	gtk_label_set_text(GTK_LABEL(label), modtext);
	label = g_object_get_data(G_OBJECT(tab), "mlabel");
	if (label != NULL) {
	    gtk_label_set_text(GTK_LABEL(label), modtext);
	}
	g_free(modtext);
    }
}
コード例 #16
0
ファイル: gaillabel.c プロジェクト: coapp-packages/gtk
static gchar*
gail_label_get_text (AtkText *text,
                     gint    start_pos,
                     gint    end_pos)
{
  GtkWidget *widget;
  GtkLabel  *label;

  const gchar *label_text;

  widget = GTK_ACCESSIBLE (text)->widget;
  if (widget == NULL)
    /* State is defunct */
    return NULL;

  label = GTK_LABEL (widget);

  label_text = gtk_label_get_text (label);
 
  if (label_text == NULL)
    return NULL;
  else
  {
    if (GAIL_LABEL (text)->textutil == NULL) 
      gail_label_init_text_util (GAIL_LABEL (text), widget);
    return gail_text_util_get_substring (GAIL_LABEL(text)->textutil, 
                                         start_pos, end_pos);
  }
}
コード例 #17
0
ファイル: p18.1.c プロジェクト: 1023xp/training
int main(int argc,char *argv[])
{
	GtkWidget *label;
	GtkWidget *wnd;
	char *label_text;

	gtk_init (&argc, &argv);
        wnd= gtk_window_new (GTK_WINDOW_TOPLEVEL);
	
        gtk_window_set_title(GTK_WINDOW(wnd),"p18.1 label");
        gtk_window_set_default_size(GTK_WINDOW(wnd),200,100);
        gtk_container_set_border_width(GTK_CONTAINER(wnd),15);

	label=gtk_label_new("label text");
	gtk_container_add(GTK_CONTAINER(wnd),label);
	
	label_text=gtk_label_get_text(GTK_LABEL(label));
	g_print("label : %s\n",label_text);

	gtk_label_set_text(GTK_LABEL(label),"set label text");

        g_signal_connect(G_OBJECT(wnd),"delete_event",G_CALLBACK(release_resource),NULL);

        gtk_widget_show_all(wnd);

	gtk_main();
	
	return 0;
}
コード例 #18
0
ファイル: gaillabel.c プロジェクト: coapp-packages/gtk
static gchar*
gail_label_get_selection (AtkText *text,
			  gint    selection_num,
                          gint    *start_pos,
                          gint    *end_pos)
{
  GtkWidget *widget;
  GtkLabel  *label;

  widget = GTK_ACCESSIBLE (text)->widget;
  if (widget == NULL)
    /* State is defunct */
    return NULL;

  label = GTK_LABEL (widget);

 /* Only let the user get the selection if one is set, and if the
  * selection_num is 0.
  */
  if (!gtk_label_get_selectable( label) || selection_num != 0)
     return NULL;

  if (gtk_label_get_selection_bounds (label, start_pos, end_pos))
    {
      const gchar* label_text = gtk_label_get_text (label);
    
      if (label_text == NULL)
        return 0;
      else
        return gail_text_util_get_substring (GAIL_LABEL (text)->textutil, 
                                             *start_pos, *end_pos);
    }
  else 
    return NULL;
}
コード例 #19
0
ファイル: ui_tabcomp.c プロジェクト: BestImageViewer/geeqie
void tab_completion_iter_menu_items(GtkWidget *widget, gpointer data)
{
	TabCompData *td = data;
	GtkWidget *child;

	if (!gtk_widget_get_visible(widget)) return;

	child = gtk_bin_get_child(GTK_BIN(widget));
	if (GTK_IS_LABEL(child)) {
		const gchar *text = gtk_label_get_text(GTK_LABEL(child));
		const gchar *entry_text = gtk_entry_get_text(GTK_ENTRY(td->entry));
		const gchar *prefix = filename_from_path(entry_text);
		guint prefix_len = strlen(prefix);

		if (strlen(text) < prefix_len || strncmp(text, prefix, prefix_len))
			{
			/* Hide menu items not matching */
			gtk_widget_hide(widget);
			}
		else
			{
			/* Count how many choices are left in the menu */
			td->choices++;
			}
	}
}
コード例 #20
0
/*! \brief Get the status text
 *
 *  \param [in] widget This GschemBottomWidget
 *  \return The status text
 */
const char*
gschem_bottom_widget_get_status_text (GschemBottomWidget *widget)
{
  g_return_val_if_fail (widget != NULL, NULL);

  return gtk_label_get_text (GTK_LABEL (widget->status_label));
}
コード例 #21
0
ファイル: stattext.cpp プロジェクト: EdgarTx/wx
wxString wxStaticText::GetLabel() const
{
    GtkLabel *label = GTK_LABEL(m_widget);
    wxString str = wxGTK_CONV_BACK( gtk_label_get_text( label ) );

    return wxString(str);
}
コード例 #22
0
void NodelistGtk::activate_mod_india_ok( GtkWidget *w, gpointer data)
{
  Nodelist *nodelist = (Nodelist *)data;
  char *text, *text2, *text3, *textutf8;

  textutf8 = (char *)gtk_label_get_text( GTK_LABEL(((NodelistGtk *)nodelist)->mod_india_text));
  text = g_convert( textutf8, -1, "ISO8859-1", "UTF-8", NULL, NULL, NULL);
  g_free( textutf8);

  textutf8 = gtk_editable_get_chars( GTK_EDITABLE(((NodelistGtk *)nodelist)->mod_india_text2), 
				 0, -1);
  text2 = g_convert( textutf8, -1, "ISO8859-1", "UTF-8", NULL, NULL, NULL);
  g_free( textutf8);

  textutf8 = gtk_editable_get_chars( GTK_EDITABLE(((NodelistGtk *)nodelist)->mod_india_text3), 
				 0, -1);
  text3 = g_convert( textutf8, -1, "ISO8859-1", "UTF-8", NULL, NULL, NULL);
  g_free( textutf8);

  g_object_set( ((NodelistGtk *)nodelist)->mod_india_widget, "visible", FALSE, NULL);

  (nodelist->mod_india_ok_cb)( nodelist, text, text2, text3);
  g_free( text);
  g_free( text2);
  g_free( text3);
}
コード例 #23
0
ファイル: gailnotebookpage.c プロジェクト: coapp-packages/gtk
static gint
gail_notebook_page_notify (GObject    *obj, 
                           GParamSpec *pspec,
                           gpointer   user_data)
{
  AtkObject *atk_obj = ATK_OBJECT (user_data);
  GtkLabel *label;
  GailNotebookPage *page;

  if (strcmp (pspec->name, "label") == 0)
    {
      const gchar* label_text;

      label = GTK_LABEL (obj);

      label_text = gtk_label_get_text (label);

      page = GAIL_NOTEBOOK_PAGE (atk_obj);
      gail_text_util_text_setup (page->textutil, label_text);

      if (atk_obj->name == NULL)
      {
        /*
         * The label has changed so notify a change in accessible-name
         */
        g_object_notify (G_OBJECT (atk_obj), "accessible-name");
      }
      /*
       * The label is the only property which can be changed
       */
      g_signal_emit_by_name (atk_obj, "visible_data_changed");
    }
  return 1;
}
コード例 #24
0
ファイル: nemo-location-bar.c プロジェクト: AlbertoPeon/nemo
static gboolean
label_button_pressed_callback (GtkWidget             *widget,
			       GdkEventButton        *event)
{
	NemoWindow *window;
	NemoWindowSlot *slot;
	NemoView *view;
	GtkWidget *label;

	if (event->button != 3) {
		return FALSE;
	}

	window = nemo_location_bar_get_window (gtk_widget_get_parent (widget));
	slot = nemo_window_get_active_slot (window);
	view = slot->content_view;
	label = gtk_bin_get_child (GTK_BIN (widget));
	/* only pop-up if the URI in the entry matches the displayed location */
	if (view == NULL ||
	    strcmp (gtk_label_get_text (GTK_LABEL (label)), LOCATION_LABEL)) {
		return FALSE;
	}

	nemo_view_pop_up_location_context_menu (view, event, NULL);

	return FALSE;
}
コード例 #25
0
ファイル: gailnotebookpage.c プロジェクト: coapp-packages/gtk
static void
gail_notebook_page_get_character_extents (AtkText      *text,
				          gint         offset,
		                          gint         *x,
                    		          gint         *y,
                                          gint 	       *width,
                                          gint 	       *height,
			                  AtkCoordType coords)
{
  GtkWidget *label;
  GailNotebookPage *notebook_page;
  PangoRectangle char_rect;
  gint index, x_layout, y_layout;
  const gchar *label_text;
 
  notebook_page = GAIL_NOTEBOOK_PAGE (text);
  label = get_label_from_notebook_page (notebook_page);

  if (!GTK_IS_LABEL(label))
    return;
  
  gtk_label_get_layout_offsets (GTK_LABEL (label), &x_layout, &y_layout);
  label_text = gtk_label_get_text (GTK_LABEL (label));
  index = g_utf8_offset_to_pointer (label_text, offset) - label_text;
  pango_layout_index_to_pos (gtk_label_get_layout (GTK_LABEL (label)), index, &char_rect);
  
  gail_misc_get_extents_from_pango_rectangle (label, &char_rect, 
                    x_layout, y_layout, x, y, width, height, coords);
} 
コード例 #26
0
ファイル: bestelakoak.c プロジェクト: enbata/on-egin
static void btmAdos()
{
	GtkTreeModel *model;
	GtkTreeIter iter;
	int index;
	char *kopurua;

	model = gtk_tree_view_get_model(GTK_TREE_VIEW(lista));
	if (gtk_tree_model_get_iter_first(model, &iter))
	{
		vKanpokoak = (kanp *) malloc (sizeof(kanp));
		index=1;
		while (gtk_tree_model_get_iter_first(model, &iter))
		{
			vKanpokoak = realloc(vKanpokoak, (index+1)*sizeof(kanp));
			gtk_tree_model_get (model, &iter, 0, &kopurua, -1);
			vKanpokoak[index].kopurua = atof(kopurua);
			gtk_tree_store_remove(GTK_TREE_STORE(model), &iter);
			index++;
		}
		vKanpokoak[0].kopurua = index;
	}
	kanpokoakZenbat = atoi(gtk_label_get_text(GTK_LABEL(lblZenbat)));
	gtk_main_quit();
	gtk_widget_destroy(frmBestelakoak);
}
コード例 #27
0
ファイル: gailexpander.c プロジェクト: Aridna/gtk2
static void
gail_expander_get_character_extents (AtkText      *text,
				     gint         offset,
		                     gint         *x,
                    		     gint 	*y,
                                     gint 	*width,
                                     gint 	*height,
			             AtkCoordType coords)
{
  GtkWidget *widget;
  GtkWidget *label;
  PangoRectangle char_rect;
  gint index, x_layout, y_layout;
  const gchar *label_text;
 
  widget = GTK_ACCESSIBLE (text)->widget;

  if (widget == NULL)
    /* State is defunct */
    return;

  label = gtk_expander_get_label_widget (GTK_EXPANDER (widget));
  if (!GTK_IS_LABEL(label))
    return;
  
  gtk_label_get_layout_offsets (GTK_LABEL (label), &x_layout, &y_layout);
  label_text = gtk_label_get_text (GTK_LABEL (label));
  index = g_utf8_offset_to_pointer (label_text, offset) - label_text;
  pango_layout_index_to_pos (gtk_label_get_layout (GTK_LABEL (label)), index, &char_rect);
  
  gail_misc_get_extents_from_pango_rectangle (label, &char_rect, 
                    x_layout, y_layout, x, y, width, height, coords);
} 
コード例 #28
0
ファイル: notebook.cpp プロジェクト: AaronDP/wxWidgets
wxString wxNotebook::GetPageText( size_t page ) const
{
    wxCHECK_MSG(page < GetPageCount(), wxEmptyString, "invalid notebook index");

    GtkLabel* label = GTK_LABEL(GetNotebookPage(page)->m_label);
    return wxGTK_CONV_BACK(gtk_label_get_text(label));
}
コード例 #29
0
ファイル: menu.c プロジェクト: arinity/gchat2
static GtkMenuItem *
menu_find_item (GtkWidget *menu, char *name)
{
	GList *items = ((GtkMenuShell *) menu)->children;
	GtkMenuItem *item;
	GtkWidget *child;
	const char *labeltext;

	while (items)
	{
		item = items->data;
		child = GTK_BIN (item)->child;
		if (child)	/* separators arn't labels, skip them */
		{
			labeltext = g_object_get_data (G_OBJECT (item), "name");
			if (!labeltext)
				labeltext = gtk_label_get_text (GTK_LABEL (child));
			if (!menu_streq (labeltext, name, 1))
				return item;
		} else if (name == NULL)
		{
			return item;
		}
		items = items->next;
	}

	return NULL;
}
コード例 #30
0
ファイル: gtktestutils.c プロジェクト: 3v1n0/gtk
/**
 * gtk_test_find_label:
 * @widget:        Valid label or container widget.
 * @label_pattern: Shell-glob pattern to match a label string.
 *
 * This function will search @widget and all its descendants for a GtkLabel
 * widget with a text string matching @label_pattern.
 * The @label_pattern may contain asterisks “*” and question marks “?” as
 * placeholders, g_pattern_match() is used for the matching.
 * Note that locales other than "C“ tend to alter (translate” label strings,
 * so this function is genrally only useful in test programs with
 * predetermined locales, see gtk_test_init() for more details.
 *
 * Returns: (transfer none): a GtkLabel widget if any is found.
 *
 * Since: 2.14
 **/
GtkWidget*
gtk_test_find_label (GtkWidget    *widget,
                     const gchar  *label_pattern)
{
  GtkWidget *label = NULL;

  if (GTK_IS_LABEL (widget))
    {
      const gchar *text = gtk_label_get_text (GTK_LABEL (widget));
      if (g_pattern_match_simple (label_pattern, text))
        return widget;
    }

  if (GTK_IS_CONTAINER (widget))
    {
      GList *node, *list;

      list = gtk_container_get_children (GTK_CONTAINER (widget));
      for (node = list; node; node = node->next)
        {
          label = gtk_test_find_label (node->data, label_pattern);
          if (label)
            break;
        }
      g_list_free (list);
    }
  return label;
}