• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ GTK_VIEWPORT函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中GTK_VIEWPORT函数的典型用法代码示例。如果您正苦于以下问题:C++ GTK_VIEWPORT函数的具体用法?C++ GTK_VIEWPORT怎么用?C++ GTK_VIEWPORT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了GTK_VIEWPORT函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: wrap_table_child_focus_in

static gboolean
wrap_table_child_focus_in (GtkWidget *widget,
                           GdkEventFocus *event,
                           gpointer data)
{
    gint x, y;
    GtkWidget *container, *viewport;
    GtkAdjustment *hadj, *vadj;

    container = gtk_widget_get_parent (widget);
    if (container)
    {
        viewport = gtk_widget_get_parent (container);
    }
    g_assert (container && viewport);
    g_assert (GTK_IS_VIEWPORT (viewport));
    g_return_val_if_fail (gtk_widget_get_realized (viewport), FALSE);

    if (!wrap_table_child_visible_in (widget, viewport))
    {
        hadj = gtk_viewport_get_hadjustment (GTK_VIEWPORT (viewport));
        vadj = gtk_viewport_get_vadjustment (GTK_VIEWPORT (viewport));

        gtk_widget_translate_coordinates (widget, container, 0, 0, &x, &y);

        gtk_adjustment_set_value (hadj, MIN (x, hadj->upper - hadj->page_size));
        gtk_adjustment_set_value (vadj, MIN (y, vadj->upper - vadj->page_size));
    }

    return FALSE;
}
开发者ID:Lyude,项目名称:mate-file-manager,代码行数:31,代码来源:eel-wrap-table.c


示例2: cv_tabs_sizealloc

static void
cv_tabs_sizealloc (GtkWidget *widget, GtkAllocation *allocation, chanview *cv)
{
    GdkWindow *parent_win;
    GtkAdjustment *adj;
    GtkWidget *inner;
    gint viewport_size;

    inner = ((tabview *)cv)->inner;
    parent_win = gtk_widget_get_window (gtk_widget_get_parent (inner));

    if (cv->vertical)
    {
        adj = gtk_viewport_get_vadjustment (GTK_VIEWPORT (gtk_widget_get_parent (inner)));
        gdk_window_get_geometry (parent_win, 0, 0, 0, &viewport_size, 0);
    } else
    {
        adj = gtk_viewport_get_hadjustment (GTK_VIEWPORT (gtk_widget_get_parent (inner)));
        gdk_window_get_geometry (parent_win, 0, 0, &viewport_size, 0, 0);
    }

    if (gtk_adjustment_get_upper (adj) <= viewport_size)
    {
        gtk_widget_hide (((tabview *)cv)->b1);
        gtk_widget_hide (((tabview *)cv)->b2);
    } else
    {
        gtk_widget_show (((tabview *)cv)->b1);
        gtk_widget_show (((tabview *)cv)->b2);
    }
}
开发者ID:HextorIRC,项目名称:hextor,代码行数:31,代码来源:chanview-tabs.c


示例3: tab_scroll_right_down_clicked

static void
tab_scroll_right_down_clicked (GtkWidget *widget, chanview *cv)
{
    GtkAdjustment *adj;
    gint viewport_size;
    gfloat new_value;
    GtkWidget *inner;
    GdkWindow *parent_win;
    gdouble i;

    inner = ((tabview *)cv)->inner;
    parent_win = gtk_widget_get_window (gtk_widget_get_parent (inner));

    if (cv->vertical)
    {
        adj = gtk_viewport_get_vadjustment (GTK_VIEWPORT (gtk_widget_get_parent(inner)));
        gdk_window_get_geometry (parent_win, 0, 0, 0, &viewport_size, 0);
    } else
    {
        adj = gtk_viewport_get_hadjustment (GTK_VIEWPORT (gtk_widget_get_parent(inner)));
        gdk_window_get_geometry (parent_win, 0, 0, &viewport_size, 0, 0);
    }

    new_value = tab_search_offset (inner, gtk_adjustment_get_value (adj), 1, cv->vertical);

    if (new_value == 0 || new_value + viewport_size > gtk_adjustment_get_upper (adj))
        new_value = gtk_adjustment_get_upper (adj) - viewport_size;

    if (!tab_right_is_moving)
    {
        tab_right_is_moving = 1;

        for (i = gtk_adjustment_get_value (adj); ((i < new_value) && (tab_right_is_moving)); i += 0.1)
        {
            gtk_adjustment_set_value (adj, i);
            while (g_main_context_pending (NULL))
                g_main_context_iteration (NULL, TRUE);
        }

        gtk_adjustment_set_value (adj, new_value);

        tab_right_is_moving = 0;                /* hSP: set to false in case we didnt get stopped (the normal case) */
    }
    else
    {
        tab_right_is_moving = 0;                /* hSP: jump directly to next element if user is clicking faster than we can scroll.. */
    }
}
开发者ID:HextorIRC,项目名称:hextor,代码行数:48,代码来源:chanview-tabs.c


示例4: gimp_container_grid_view_init

static void
gimp_container_grid_view_init (GimpContainerGridView *grid_view)
{
  GimpContainerBox *box = GIMP_CONTAINER_BOX (grid_view);
  GtkWidget        *viewport;

  grid_view->rows          = 1;
  grid_view->columns       = 1;
  grid_view->visible_rows  = 0;
  grid_view->selected_item = NULL;

  gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (box->scrolled_win),
                                       GTK_SHADOW_IN);
  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (box->scrolled_win),
                                  GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);

  gimp_editor_set_show_name (GIMP_EDITOR (grid_view), TRUE);

  grid_view->wrap_box = gtk_hwrap_box_new (FALSE);
  gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (box->scrolled_win),
                                         grid_view->wrap_box);
  viewport = gtk_widget_get_parent (grid_view->wrap_box);
  gtk_viewport_set_shadow_type (GTK_VIEWPORT (viewport), GTK_SHADOW_NONE);
  gtk_widget_show (grid_view->wrap_box);

  g_signal_connect (viewport, "size-allocate",
                    G_CALLBACK (gimp_container_grid_view_viewport_resized),
                    grid_view);
  g_signal_connect (viewport, "button-press-event",
                    G_CALLBACK (gimp_container_grid_view_button_press),
                    grid_view);

  gtk_widget_set_can_focus (GTK_WIDGET (grid_view), TRUE);
}
开发者ID:MichaelMure,项目名称:Gimp-Cage-Tool,代码行数:34,代码来源:gimpcontainergridview.c


示例5: browser_show

void browser_show()
{
	/* Main Window */
	GtkWidget *window, *scroller, *scroller_vp, *header_hbox, *home, *search, *exit_button;
	
	window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
	gtk_window_set_title(GTK_WINDOW(window),"PowerMaths");
	//gtk_window_set_decorated(GTK_WINDOW(window),FALSE);
	//gtk_window_maximize(GTK_WINDOW(window));
	gtk_widget_set_size_request(window,gdk_screen_get_width(gdk_screen_get_default()),gdk_screen_get_height(gdk_screen_get_default()));
	gtk_window_set_resizable(GTK_WINDOW(window),FALSE);
	gtk_window_fullscreen(GTK_WINDOW(window));
	
	scroller = gtk_hbox_new(0,5);
	scroller_vp = gtk_viewport_new(NULL,NULL);
	gtk_viewport_set_shadow_type(GTK_VIEWPORT(scroller_vp),GTK_SHADOW_NONE);
	gtk_container_add(GTK_CONTAINER(scroller_vp),scroller);
	
	browser_viewport = gtk_scrolled_window_new(NULL,NULL);
	gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(browser_viewport),GTK_SHADOW_NONE);
	gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(browser_viewport),GTK_POLICY_NEVER,GTK_POLICY_AUTOMATIC);
	int height = gdk_screen_get_height(gdk_screen_get_default());
	browser_scroll_hbox = gtk_hbox_new(0,5);
	header_hbox = gtk_hbox_new(0,0);
	home = gtk_pmhbutton_new("Home");
	search = gtk_pmhbutton_new("Search");
	gtk_widget_set_size_request(home,height/7,height/7);
	gtk_widget_set_size_request(search,height/7,height/7);
	gtk_widget_set_size_request(browser_scroll_hbox,0,height/7);
	gtk_widget_set_size_request(header_hbox,0,height/7);
	
	gtk_box_pack_start(GTK_BOX(scroller),home,0,0,0);
	gtk_box_pack_start(GTK_BOX(scroller),browser_scroll_hbox,1,1,0);
	gtk_box_pack_start(GTK_BOX(scroller),search,0,0,0);
	
	vbox = gtk_vbox_new(0,0);
	groups_create_table();
	misc_set_background(scroller_vp,42405,0,8481);
	misc_set_background(header_hbox,42405,0,8481);
	
	gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(browser_viewport),browser_table);
	GtkWidget *logo = gtk_vimage_new("pmlogo.svg");
	gtk_widget_set_size_request(logo,height/7,height/7);
	gtk_box_pack_start(GTK_BOX(header_hbox),logo,0,1,0);
	gtk_box_pack_start(GTK_BOX(header_hbox),misc_create_banner("PowerMaths",80),1,1,0);
	exit_button = gtk_pmhbutton_new("X");
	gtk_widget_set_size_request(exit_button,height/7,height/7);
	gtk_box_pack_end(GTK_BOX(header_hbox),exit_button,0,1,0);
	
	
	gtk_box_pack_start(GTK_BOX(vbox),header_hbox,0,0,0);
	gtk_box_pack_start(GTK_BOX(vbox),browser_viewport,TRUE,TRUE,0);
	gtk_box_pack_start(GTK_BOX(vbox),scroller_vp,0,0,0);
	gtk_container_add(GTK_CONTAINER(window),vbox);
	g_signal_connect(G_OBJECT(window),"delete-event",G_CALLBACK(browser_window_close),NULL);	
	g_signal_connect(G_OBJECT(home),"clicked",G_CALLBACK(browser_home_clicked),NULL);
	g_signal_connect(G_OBJECT(search),"clicked",G_CALLBACK(search_create_table),NULL);
	g_signal_connect(G_OBJECT(exit_button),"clicked",G_CALLBACK(gtk_exit),NULL);
	gtk_widget_show_all(window);
}
开发者ID:ElFeesho,项目名称:OldCProjects,代码行数:60,代码来源:browser.c


示例6: add_credits_page

static void add_credits_page(GtkWidget *notebook,
                             const gchar *title, gchar **people)
{
    GtkWidget *label, *sw;
    GString *string;
    gint i;
    gchar *tmp;

    label = gtk_label_new(NULL);
    gtk_label_set_selectable(GTK_LABEL(label), TRUE);
    gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT);
    gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.0);
    gtk_misc_set_padding(GTK_MISC(label), 8, 8);

    sw = gtk_scrolled_window_new(NULL, NULL);
    gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw),
                                   GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
    gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(sw), label);
    gtk_viewport_set_shadow_type(GTK_VIEWPORT(GTK_BIN(sw)->child),
                                 GTK_SHADOW_NONE);
    gtk_notebook_append_page(GTK_NOTEBOOK(notebook),
                             sw, gtk_label_new(title));

    string = g_string_new(NULL);
    for (i = 0; people[i]; i++) {
        tmp = g_markup_escape_text(people[i], -1);
        g_string_append(string, tmp);
        g_free(tmp);
        if (people[i + 1])
            g_string_append_c(string, '\n');
    }

    gtk_label_set_markup(GTK_LABEL(label), string->str);
    g_string_free(string, TRUE);
}
开发者ID:Mathias-Fuchs,项目名称:ngahuru,代码行数:35,代码来源:about.c


示例7: gw_status_bar_create

GtkWidget * gw_status_bar_create ( GtkWindow *w)
{
    GtkWidget *gw_status_bar_box;
    GtkWidget *hbox;
    GtkWidget *status_bar1;
    GtkWidget *status_bar2;


#ifdef GW_DEBUG_GUI_COMPONENT
    g_print ( "*** GW - %s (%d) :: %s()\n", __FILE__, __LINE__, __PRETTY_FUNCTION__);
#endif

    gw_status_bar_box = gtk_viewport_new ( NULL, NULL);
    gtk_viewport_set_shadow_type ( GTK_VIEWPORT ( gw_status_bar_box), GTK_SHADOW_NONE);

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

    /* First status bar */
    status_bar1 = gtk_statusbar_new ( );
    gtk_widget_ref ( status_bar1);
    gtk_object_set_data_full ( GTK_OBJECT ( w), GW_REF_STATUS_BAR_FIRST_STATUS, status_bar1, (GtkDestroyNotify) gtk_widget_unref);
    gtk_box_pack_start ( GTK_BOX ( hbox), status_bar1, FALSE, FALSE, 0);
    gtk_widget_set_usize ( status_bar1, 500, -2);

    /* Second status bar */
    status_bar2 = gtk_statusbar_new ( );
    gtk_widget_ref ( status_bar2);
    gtk_object_set_data_full ( GTK_OBJECT ( w), GW_REF_STATUS_BAR_SECOND_STATUS, status_bar2, (GtkDestroyNotify) gtk_widget_unref);
    gtk_box_pack_start ( GTK_BOX ( hbox), status_bar2, TRUE, TRUE, 0);

    return gw_status_bar_box;
}
开发者ID:dvst,项目名称:gwhere-catalog,代码行数:33,代码来源:gwstatusbar.c


示例8: scroll_callback

static gboolean scroll_callback(GtkWidget * w, GdkEventScroll * evt,
                                gpointer data)
  {
  bg_nle_timeline_t * t = data;
  double new_val;
  GtkAdjustment * adj = gtk_viewport_get_vadjustment(GTK_VIEWPORT(t->preview_window));
  
  //  gtk_scrollbar_get_adjustment(GTK_SCROLLBAR(t->scrollbar));
  
  if(evt->direction == GDK_SCROLL_UP)
    {
    new_val = adj->value - 3 * adj->step_increment;
    gtk_adjustment_set_value(adj, new_val);
    return TRUE;
    }
  else if(evt->direction == GDK_SCROLL_DOWN)
    {
    new_val = adj->value + 3 * adj->step_increment;
    if(new_val > adj->upper - adj->page_size)
      new_val = adj->upper - adj->page_size;
    gtk_adjustment_set_value(adj, new_val);
    return TRUE;
    }
  
  return FALSE;
  }
开发者ID:Distrotech,项目名称:gmerlin,代码行数:26,代码来源:timeline.c


示例9: ensure_scrolled_window_row_visible

void ensure_scrolled_window_row_visible(widget_t list, int row, int num_rows)
{
  /* view files file list */
  /*   called in snd-file.c on vdat->file_list which is a vbox; its parent is a viewport */
  /* also used in slist_moveto below */
  GtkWidget *parent;
  GtkAdjustment *v;
  gdouble maximum, size, new_value, minimum;
  parent = gtk_widget_get_parent(list);
  v = gtk_viewport_get_vadjustment(GTK_VIEWPORT(parent));
  maximum = v->upper;
  minimum = v->lower;
  size = v->page_size;
  maximum -= size;
  if (row == 0)
    new_value = 0.0;
  else
    {
      if (row >= (num_rows - 1))
	new_value = maximum;
      else new_value = ((row + 0.5) * ((maximum - minimum) / (float)(num_rows - 1)));
    }
  if (new_value != v->value)
    gtk_adjustment_set_value(v, new_value);
}
开发者ID:huangjs,项目名称:cl,代码行数:25,代码来源:snd-gutils.c


示例10: gb_viewport_set_properties

/*
 * Sets the properties of the widget. This is used for both applying the
 * properties changed in the property editor, and also for loading.
 */
static void
gb_viewport_set_properties (GtkWidget * widget, GbWidgetSetArgData * data)
{
  gint i;
  gchar *shadow;

  shadow = gb_widget_input_choice (data, Shadow);
  if (data->apply)
    {
      for (i = 0; i < sizeof (GbShadowValues) / sizeof (GbShadowValues[0]); i
	   ++)
	{
	  if (!strcmp (shadow, GbShadowChoices[i])
	      || !strcmp (shadow, GbShadowSymbols[i]))
	    {
	      gtk_viewport_set_shadow_type (GTK_VIEWPORT (widget), GbShadowValues
					    [i]);
	      break;
	    }
	}
    }

  /*
     if (gb_widget_input_adjustment(data, HValues,
     GTK_VIEWPORT(widget)->hadjustment))
     gtk_signal_emit_by_name (GTK_OBJECT (GTK_VIEWPORT(widget)->hadjustment),
     "value_changed");
     if (gb_widget_input_adjustment(data, VValues,
     GTK_VIEWPORT(widget)->vadjustment))
     gtk_signal_emit_by_name (GTK_OBJECT (GTK_VIEWPORT(widget)->vadjustment),
     "value_changed");
   */
}
开发者ID:AriaAsuka,项目名称:deadbeef,代码行数:37,代码来源:gbviewport.c


示例11: scrolledwindow_new

static GtkWidget *
scrolledwindow_new (GladeXML *xml, GladeWidgetInfo *info)
{
	GtkWidget *win = gtk_scrolled_window_new(NULL, NULL);
	GList *tmp;
	GtkPolicyType hpol = GTK_POLICY_ALWAYS, vpol = GTK_POLICY_ALWAYS;

	for (tmp = info->attributes; tmp; tmp = tmp->next) {
		GladeAttribute *attr = tmp->data;

		if (!strcmp(attr->name, "hscrollbar_policy"))
			hpol = glade_enum_from_string(GTK_TYPE_POLICY_TYPE,
						      attr->value);
		else if (!strcmp(attr->name, "hupdate_policy"))
			gtk_range_set_update_policy(
			       GTK_RANGE(GTK_SCROLLED_WINDOW(win)->hscrollbar),
			       glade_enum_from_string(GTK_TYPE_UPDATE_TYPE,
						      attr->value));
		else if (!strcmp(attr->name, "shadow_type"))
			gtk_viewport_set_shadow_type(GTK_VIEWPORT(win),
				glade_enum_from_string(GTK_TYPE_SHADOW_TYPE,
						       attr->value));
		else if (!strcmp(attr->name, "vscrollbar_policy"))
			vpol = glade_enum_from_string(GTK_TYPE_POLICY_TYPE,
						      attr->value);
		else if (!strcmp(attr->name, "vupdate_policy"))
			gtk_range_set_update_policy(
			       GTK_RANGE(GTK_SCROLLED_WINDOW(win)->vscrollbar),
			       glade_enum_from_string(GTK_TYPE_UPDATE_TYPE,
						      attr->value));
	}
	gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(win), hpol, vpol);
	return win;
}
开发者ID:montsuqi,项目名称:libglade-panda2,代码行数:34,代码来源:glade-gtk.c


示例12: dclock_create_calendar

/* Display a window containing the standard calendar widget. */
static GtkWidget * dclock_create_calendar(DClockPlugin * dc)
{
    /* Create a new window. */
    GtkWindow * window = GTK_WINDOW(gtk_window_new(GTK_WINDOW_TOPLEVEL));
    gtk_window_set_skip_taskbar_hint(window, TRUE);
    gtk_window_set_skip_pager_hint(window, TRUE);
    gtk_window_set_default_size(window, 180, 180);
    gtk_window_set_decorated(window, FALSE);
    gtk_window_set_resizable(window, FALSE);
    gtk_window_stick(window);
    gtk_container_set_border_width(GTK_CONTAINER(window), 0);

    GtkWidget * viewport = gtk_viewport_new(NULL, NULL);
    gtk_container_add(GTK_CONTAINER(window), viewport);
    gtk_viewport_set_shadow_type(GTK_VIEWPORT(viewport), GTK_SHADOW_OUT);
    gtk_widget_show(viewport);

    /* Create a vertical box as a child of the window. */
    GtkWidget * box = gtk_vbox_new(FALSE, 0);
    gtk_container_add(GTK_CONTAINER(viewport), GTK_WIDGET(box));

    /* Create a standard calendar widget as a child of the vertical box. */
    GtkWidget * calendar = gtk_calendar_new();
    gtk_calendar_set_display_options(
        GTK_CALENDAR(calendar),
        GTK_CALENDAR_SHOW_WEEK_NUMBERS | GTK_CALENDAR_SHOW_DAY_NAMES | GTK_CALENDAR_SHOW_HEADING);
    gtk_box_pack_start(GTK_BOX(box), calendar, TRUE, TRUE, 0);

    /* Connect signals. */
    g_signal_connect(G_OBJECT(window), "map", G_CALLBACK(dclock_popup_map), dc);

    /* Return the widget. */
    return GTK_WIDGET(window);
}
开发者ID:geekless,项目名称:waterline,代码行数:35,代码来源:dclock.c


示例13: add_row

static void
add_row(GtkWidget *table, gint *row_p,
	const gchar *name, const gchar *value, gboolean multiline,
        gboolean expand)
{
    gchar *bold_name;
    GtkWidget *name_w;

    bold_name = g_strconcat("<b>", name, "</b>", NULL);
    name_w = gtk_label_new(bold_name);
    g_free(bold_name);
    gtk_misc_set_alignment(GTK_MISC(name_w), 0.0, 0.0);
    gtk_label_set_use_markup(GTK_LABEL(name_w), TRUE);

    gtk_table_attach(GTK_TABLE(table), name_w, 0, 1, *row_p, *row_p + 1,
		     GTK_FILL, GTK_FILL, 0, 0);

    if (multiline) {
	GtkWidget *label, *viewport;
	GtkScrolledWindow *swin;
        guint flags;

        label = gtk_label_new (value);
        gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
        gtk_label_set_selectable (GTK_LABEL (label), TRUE);
        gtk_widget_set_size_request (label, 200, -1);
        gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.0);


        swin = GTK_SCROLLED_WINDOW(gtk_scrolled_window_new(NULL, NULL));
        gtk_scrolled_window_set_policy(swin,
                                       GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);

        viewport = gtk_viewport_new (gtk_scrolled_window_get_hadjustment (swin),
                                     gtk_scrolled_window_get_vadjustment (swin));
        gtk_viewport_set_shadow_type (GTK_VIEWPORT (viewport), GTK_SHADOW_NONE);

        gtk_container_add (GTK_CONTAINER(swin), viewport);
        (*row_p)++;
        if (expand)
          flags = GTK_FILL|GTK_EXPAND;
        else
          flags = GTK_FILL;
        gtk_table_attach(GTK_TABLE(table), GTK_WIDGET(swin), 0, 2, *row_p, *row_p + 1,
                         GTK_FILL|GTK_EXPAND, flags, 0, 0);

        gtk_container_add (GTK_CONTAINER (viewport), label);
    } else {
        GtkWidget *label = gtk_label_new(value);
        gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5);
	gtk_label_set_selectable(GTK_LABEL(label), TRUE);
        gtk_table_attach(GTK_TABLE(table), label, 1, 2, *row_p, *row_p + 1,
                         GTK_FILL|GTK_EXPAND, GTK_FILL, 0, 0);
    }


    (*row_p)++;
}
开发者ID:City-busz,项目名称:mate-control-center,代码行数:58,代码来源:font-view.c


示例14: _mixer_scrolled_window_add

/* mixer_scrolled_window_add */
static void _mixer_scrolled_window_add(GtkWidget * window, GtkWidget * widget)
{
	GtkWidget * viewport;

	viewport = gtk_viewport_new(NULL, NULL);
	gtk_viewport_set_shadow_type(GTK_VIEWPORT(viewport), GTK_SHADOW_NONE);
	gtk_container_add(GTK_CONTAINER(viewport), widget);
	gtk_container_add(GTK_CONTAINER(window), viewport);
}
开发者ID:DeforaOS,项目名称:Mixer,代码行数:10,代码来源:mixer.c


示例15: thunar_progress_dialog_add_job

void
thunar_progress_dialog_add_job (ThunarProgressDialog *dialog,
                                ThunarJob            *job,
                                const gchar          *icon_name,
                                const gchar          *title)
{
  GtkWidget *viewport;
  GtkWidget *view;

  _thunar_return_if_fail (THUNAR_IS_PROGRESS_DIALOG (dialog));
  _thunar_return_if_fail (THUNAR_IS_JOB (job));
  _thunar_return_if_fail (g_utf8_validate (title, -1, NULL));

  view = thunar_progress_view_new_with_job (job);
  thunar_progress_view_set_icon_name (THUNAR_PROGRESS_VIEW (view), icon_name);
  thunar_progress_view_set_title (THUNAR_PROGRESS_VIEW (view), title);
  gtk_box_pack_start (GTK_BOX (dialog->content_box), view, FALSE, TRUE, 0);
  gtk_widget_show (view);

  /* use the first job's icon-name for the dialog */
  if (dialog->views == NULL)
    gtk_window_set_icon_name (GTK_WINDOW (dialog), icon_name);

  /* add the view to the list of known views */
  dialog->views = g_list_prepend (dialog->views, view);

  /* check if we need to wrap the views in a scroll window (starting 
   * at SCROLLVIEW_THRESHOLD parallel operations */
  if (g_list_length (dialog->views) == SCROLLVIEW_THRESHOLD)
    {
      /* create a scrolled window and add it to the dialog */
      dialog->scrollwin = gtk_scrolled_window_new (NULL, NULL);
      gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (dialog->scrollwin), 
                                      GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
      gtk_container_add (GTK_CONTAINER (dialog->vbox), dialog->scrollwin);
      gtk_widget_show (dialog->scrollwin);

      /* create a viewport for the content box */
      viewport = gtk_viewport_new (gtk_scrolled_window_get_hadjustment (GTK_SCROLLED_WINDOW (dialog->scrollwin)),
                                   gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (dialog->scrollwin)));
      gtk_viewport_set_shadow_type (GTK_VIEWPORT (viewport), GTK_SHADOW_NONE);
      gtk_container_add (GTK_CONTAINER (dialog->scrollwin), viewport);
      gtk_widget_show (viewport);

      /* move the content box into the viewport */
      gtk_widget_reparent (dialog->content_box, viewport);
    }

  g_signal_connect_swapped (view, "need-attention", 
                            G_CALLBACK (thunar_progress_dialog_view_needs_attention), dialog);

  g_signal_connect_swapped (view, "finished",
                            G_CALLBACK (thunar_progress_dialog_job_finished), dialog);

  if (dialog->status_icon != NULL)
    thunar_progress_dialog_update_status_icon (dialog);
}
开发者ID:Jubei-Mitsuyoshi,项目名称:aaa-thunar,代码行数:57,代码来源:thunar-progress-dialog.c


示例16: clip_GTK_VIEWPORTGETSHADOWTYPE

int
clip_GTK_VIEWPORTGETSHADOWTYPE (ClipMachine *cm)
{
	C_widget *cvp  = _fetch_cw_arg(cm);
        CHECKCWID(cvp,GTK_IS_VIEWPORT);
	_clip_retni(cm,GTK_VIEWPORT(cvp->widget)->shadow_type);
	return 0;
err:
	return 1;
}
开发者ID:amery,项目名称:clip-itk,代码行数:10,代码来源:viewport.c


示例17: error_dialog

GtkWidget *groups_create_viewport()
{
	if(groups_list == NULL)
	{
		error_dialog("Failed to load group list!\n");
	}	
	groups_viewport = gtk_viewport_new(NULL,NULL);
	gtk_viewport_set_shadow_type(GTK_VIEWPORT(groups_viewport),GTK_SHADOW_NONE);
	GtkWidget *details = gtk_text_view_new();
	gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(details),GTK_WRAP_WORD_CHAR);
	gtk_text_view_set_editable(GTK_TEXT_VIEW(details),0);
	
	details_buf = gtk_text_view_get_buffer(GTK_TEXT_VIEW(details));
	
	GtkWidget *text_scroll = gtk_scrolled_window_new(NULL,NULL);
	gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(text_scroll),GTK_POLICY_AUTOMATIC,GTK_POLICY_AUTOMATIC);
	gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(text_scroll),GTK_SHADOW_IN);
	gtk_container_add(GTK_CONTAINER(text_scroll),details);
	
	GtkWidget *table = gtk_table_new(11,8,1);
	
	
	GtkWidget *group[3];
	struct groups_node *temp = groups_list;
	int i = 0;
	while(temp)
	{
		group[i] = gtk_button_new_with_label(temp->name); 
		g_signal_connect(G_OBJECT(group[i]),"enter",G_CALLBACK(groups_button_hover),temp->caption);
		g_signal_connect(G_OBJECT(group[i]),"leave",G_CALLBACK(groups_button_leave),NULL);
		g_signal_connect(G_OBJECT(group[i++]),"clicked",G_CALLBACK(groups_button_click),temp);
		temp = temp->next;
	}
	
	gtk_table_attach(GTK_TABLE(table),misc_create_banner("Select a Category",50),0,8,0,1,GTK_FILL,GTK_FILL,0,0);
	
	gtk_table_attach(GTK_TABLE(table),group[0],1,2,2,4,GTK_FILL,GTK_FILL,0,0);
	gtk_table_attach(GTK_TABLE(table),group[1],1,2,5,7,GTK_FILL,GTK_FILL,0,0);
	if(groups_count==3)
	{
		gtk_table_attach(GTK_TABLE(table),group[2],1,2,8,10,GTK_FILL,GTK_FILL,0,0);
		gtk_table_attach(GTK_TABLE(table),text_scroll,3,7,2,10,GTK_FILL,GTK_FILL|GTK_EXPAND,0,0);
	}
	else
	{
		gtk_table_attach(GTK_TABLE(table),text_scroll,3,7,2,10,GTK_FILL,GTK_FILL|GTK_EXPAND,0,0);
	}
	
	gtk_container_add(GTK_CONTAINER(groups_viewport),table);
	
	g_signal_connect(G_OBJECT(table),"expose-event",G_CALLBACK(browser_viewport_expose),NULL);	
		
	return groups_viewport;
}
开发者ID:ElFeesho,项目名称:OldCProjects,代码行数:54,代码来源:groups.c


示例18: lyric_show_viewport_expose

static gboolean
lyric_show_viewport_expose(GtkWidget    *widget,GdkEventExpose *event)
{
    LyricShowViewport *lsv;
    lsv = LYRIC_SHOW_VIEWPORT(widget);
    GdkWindow   *view = gtk_viewport_get_view_window(GTK_VIEWPORT(widget));

#if 1 ///必须启用否则widget大小变化时view上的东西不会被自动清除,界面混乱
    gint        view_width,view_height;
    view_width = gdk_window_get_width(view);
    view_height = gdk_window_get_height(view);
    
    gtk_paint_flat_box(widget->style,
                       view,
                       GTK_STATE_NORMAL,
                       GTK_SHADOW_NONE,
                       NULL,
                       widget,
                       NULL,
                       0,0,
                       view_width,
                       view_height);
#endif


    GTK_WIDGET_CLASS(lyric_show_viewport_parent_class)->expose_event(widget,event);

///    g_warning("is_pressed:%d",lsv->priv->is_pressed);
    if(lsv->priv->is_pressed)
    {
        gtk_paint_hline(widget->style,
                        gtk_viewport_get_bin_window(GTK_VIEWPORT(widget)),
                        GTK_STATE_NORMAL,
                        NULL,
                        widget,
                        NULL,
                        0,widget->allocation.width,
                        lsv->priv->pos+lsv->priv->pressed_pos+widget->allocation.height/2.0);
    }
    return FALSE;
}
开发者ID:wkt,项目名称:liblyric,代码行数:41,代码来源:lyricshowviewport.c


示例19: clip_GTK_VIEWPORTSETVADJUSTMENT

/* Sets the Adjustment for the vertical scrollbar. */
int
clip_GTK_VIEWPORTSETVADJUSTMENT (ClipMachine *cm)
{
	C_widget *cvp  = _fetch_cw_arg(cm);
	C_widget *cadj = _fetch_cwidget(cm,_clip_spar(cm, 2));
        CHECKCWID(cvp,GTK_IS_VIEWPORT);
	CHECKOPT2(2,MAP_t,NUMERIC_t); CHECKCWIDOPT(cadj,GTK_IS_ADJUSTMENT);
        gtk_viewport_set_vadjustment (GTK_VIEWPORT(cvp->widget),
        	GTK_ADJUSTMENT(cadj->widget));
	return 0;
err:
	return 1;
}
开发者ID:amery,项目名称:clip-itk,代码行数:14,代码来源:viewport.c


示例20: carrick_list_constructor

static GObject *
carrick_list_constructor (GType                  gtype,
                          guint                  n_properties,
                          GObjectConstructParam *properties)
{
  GObject            *obj;
  GObjectClass       *parent_class;
  CarrickListPrivate *priv;
  GtkWidget          *viewport, *box;

  parent_class = G_OBJECT_CLASS (carrick_list_parent_class);
  obj = parent_class->constructor (gtype, n_properties, properties);

  priv = LIST_PRIVATE (obj);

  priv->adjustment = gtk_scrolled_window_get_vadjustment
                (GTK_SCROLLED_WINDOW (obj));
  g_signal_connect (priv->adjustment, "value-changed",
                    G_CALLBACK (_adjustment_value_changed_cb), obj);
  viewport = gtk_viewport_new (gtk_scrolled_window_get_hadjustment
                                           (GTK_SCROLLED_WINDOW (obj)),
                               gtk_scrolled_window_get_vadjustment
                                           (GTK_SCROLLED_WINDOW (obj)));
  gtk_viewport_set_shadow_type (GTK_VIEWPORT (viewport),
                                GTK_SHADOW_NONE);
  gtk_widget_show (viewport);
  gtk_container_add (GTK_CONTAINER (obj), viewport);


  box = gtk_vbox_new (FALSE, 0);
  gtk_widget_show (box);
  gtk_container_add (GTK_CONTAINER (viewport),
                     box);

  gtk_label_set_line_wrap (GTK_LABEL (priv->fallback),
                           TRUE);
  gtk_widget_set_size_request (priv->fallback,
                               550,
                               -1);
  gtk_widget_show (priv->fallback);
  gtk_misc_set_padding (GTK_MISC (priv->fallback), 0, 12);
  gtk_box_pack_start (GTK_BOX (box), priv->fallback,
                      FALSE, FALSE, 2);

  priv->box = gtk_vbox_new (FALSE, 0);
  gtk_container_add (GTK_CONTAINER (box),
                     priv->box);

  return obj;
}
开发者ID:dudochkin-victor,项目名称:gogoo-panel-networks,代码行数:50,代码来源:carrick-list.c



注:本文中的GTK_VIEWPORT函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ GTK_WIDGET函数代码示例发布时间:2022-05-30
下一篇:
C++ GTK_UI_MANAGER函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap