当前位置: 首页>>代码示例>>C++>>正文


C++ GTK_FIXED函数代码示例

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


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

示例1: new_layer

GtkWidget *
new_layer(GtkWidget *canvas)
{
 gchar label[10];
 GtkRequisition req;
 gint size;

 nlayers++;

 buttons = (GtkWidget **)g_realloc(buttons, nlayers * sizeof(GtkWidget *));
 plots = (GtkWidget **)g_realloc(plots, nlayers * sizeof(GtkWidget *));

 sprintf(label, "%d", nlayers);
 
 buttons[nlayers-1] = gtk_toggle_button_new_with_label(label);
/* gtk_button_set_relief(GTK_BUTTON(buttons[nlayers-1]), GTK_RELIEF_NONE);
*/
 gtk_widget_size_request(buttons[nlayers-1], &req);
 size = MAX(req.width,req.height);
 gtk_widget_set_size_request(buttons[nlayers-1], size, size);
 gtk_fixed_put(GTK_FIXED(canvas), buttons[nlayers-1], (nlayers-1)*20, 0);
 gtk_widget_show(buttons[nlayers-1]);

 g_signal_connect(GTK_OBJECT(buttons[nlayers-1]), "toggled",
                    (void *) activate_plot, canvas);

 plots[nlayers-1] = gtk_plot_new_with_size(NULL, .5, .25);
 gtk_widget_show(plots[nlayers-1]);

 activate_plot(buttons[nlayers-1],canvas);

 return plots[nlayers-1];
}
开发者ID:2tim,项目名称:gtkextra,代码行数:33,代码来源:testcandles.c

示例2: icon_grid_add

/* Add an icon grid element and establish its initial visibility. */
void icon_grid_add(IconGrid * ig, GtkWidget * child, gboolean visible)
{
    /* Create and initialize a structure representing the child. */
    IconGridElement * ige = g_new0(IconGridElement, 1);
    ige->ig = ig;
    ige->widget = child;
    ige->visible = visible;

    /* Insert at the tail of the child list.  This keeps the graphics in the order they were added. */
    if (ig->child_list == NULL)
        ig->child_list = ige;
    else
    {
        IconGridElement * ige_cursor;
        for (ige_cursor = ig->child_list; ige_cursor->flink != NULL; ige_cursor = ige_cursor->flink) ;
        ige_cursor->flink = ige;
    }

    /* Add the widget to the layout container. */
    if (visible)
        gtk_widget_show(ige->widget);
    gtk_fixed_put(GTK_FIXED(ig->widget), ige->widget, 0, 0);
    g_signal_connect(G_OBJECT(child), "size-request", G_CALLBACK(icon_grid_element_size_request), (gpointer) ige);

    /* Do a relayout. */
    icon_grid_demand_resize(ig);
}
开发者ID:hsgg,项目名称:lxpanel,代码行数:28,代码来源:icon-grid.c

示例3: main

int main (int argc, char *argv[]) {
  
  GtkWidget *window;
  GtkWidget *fixed;
  GtkWidget *button;

  gtk_init(&argc, &argv);

  window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
  gtk_window_set_title(GTK_WINDOW(window), "GtkButton");
  gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
  gtk_window_set_default_size(GTK_WINDOW(window), 230, 150);

  fixed = gtk_fixed_new();
  gtk_container_add(GTK_CONTAINER(window), fixed);

  button = gtk_button_new_with_label("Click");
  gtk_fixed_put(GTK_FIXED(fixed), button, 50, 50);
  gtk_widget_set_size_request(button, 80, 35);
  
  // Two signals: clicked and destroy
  g_signal_connect(G_OBJECT(button), "clicked",
		   G_CALLBACK(button_clicked), NULL);

  g_signal_connect(G_OBJECT(window), "destroy",
		   G_CALLBACK(gtk_main_quit), NULL);

  gtk_widget_show_all(window);
  gtk_main();

  return 0;
}
开发者ID:nicksexton,项目名称:gui-tools,代码行数:32,代码来源:4_1_callbacks.c

示例4: button_init

void button_init(void)
{
  play_button=gtk_button_new_with_label("Play!");
  gtk_widget_set_size_request(play_button, button_width, button_height);
  gtk_fixed_put(GTK_FIXED(launcher_container), play_button, (launcher_width/2)-(button_width/2), (launcher_height/2)-(button_height/2));
  g_signal_connect_swapped(play_button, "clicked", G_CALLBACK(exec_gnome_terminal), NULL);
}
开发者ID:bensaward,项目名称:game,代码行数:7,代码来源:launcher_initialise.c

示例5: gtk_progress_bar_new

void ProgressBar::create(Window &parent, unsigned x, unsigned y, unsigned width, unsigned height) {
  object->widget = gtk_progress_bar_new();
  widget->parent = &parent;
  gtk_widget_set_size_request(object->widget, width, height);
  gtk_fixed_put(GTK_FIXED(parent.object->formContainer), object->widget, x, y);
  gtk_widget_show(object->widget);
}
开发者ID:meunierd,项目名称:upset,代码行数:7,代码来源:progressbar.cpp

示例6: glide_window_fixed_embed_size_allocate

static void
glide_window_fixed_embed_size_allocate (GtkWidget *widget,
					GtkAllocation *allocation,
					gpointer user_data)
{
  GlideWindow *w = (GlideWindow *)user_data;
  gint width, height;
  
  if (w->priv->document)
    glide_document_get_size (w->priv->document, &width, &height);
  else
    {
      width = DEFAULT_PRESENTATION_WIDTH;
      height = DEFAULT_PRESENTATION_HEIGHT;
    }

  if (allocation->width != w->priv->lfw ||
      allocation->height != w->priv->lfh)
    {
      gtk_fixed_move (GTK_FIXED (widget), w->priv->embed,
		      (allocation->width-width)/2.0,
		      (allocation->height-height)/2.0);
      w->priv->lfw = allocation->width;
      w->priv->lfh = allocation->height;
    }
}
开发者ID:racarr,项目名称:Glide,代码行数:26,代码来源:glide-window.c

示例7: create_window3

GtkWidget*
create_window3 (void)
{
    GtkWidget *window3;
    GdkPixbuf *window3_icon_pixbuf;
    GtkWidget *fixed3;
    GtkWidget *label5;

    window3 = gtk_window_new (GTK_WINDOW_TOPLEVEL);
    gtk_widget_set_size_request (window3, 236, 122);
    gtk_window_set_title (GTK_WINDOW (window3), _("\346\263\250\345\206\214\350\277\233\350\241\214\344\270\255"));
    gtk_window_set_resizable (GTK_WINDOW (window3), FALSE);
    window3_icon_pixbuf = gdk_pixbuf_new_from_xpm_data((gchar **)connecting_xpm);
    if (window3_icon_pixbuf)
    {
        gtk_window_set_icon (GTK_WINDOW (window3), window3_icon_pixbuf);
        gdk_pixbuf_unref (window3_icon_pixbuf);
    }

    fixed3 = gtk_fixed_new ();
    gtk_widget_show (fixed3);
    gtk_container_add (GTK_CONTAINER (window3), fixed3);

    label5 = gtk_label_new (_("\346\263\250\345\206\214\350\277\233\350\241\214\344\270\255\357\274\214\350\257\267\347\250\215\345\200\231\343\200\202\343\200\202\343\200\202"));
    gtk_widget_show (label5);
    gtk_fixed_put (GTK_FIXED (fixed3), label5, 24, 40);
    gtk_widget_set_size_request (label5, 200, 32);

    /* Store pointers to all widgets, for use by lookup_widget(). */
    GLADE_HOOKUP_OBJECT_NO_REF (window3, window3, "window3");
    GLADE_HOOKUP_OBJECT (window3, fixed3, "fixed3");
    GLADE_HOOKUP_OBJECT (window3, label5, "label5");

    return window3;
}
开发者ID:54chen,项目名称:MyNet,代码行数:35,代码来源:interface.c

示例8: make_cancel_button

void make_cancel_button(GtkWidget *fixed_base)
{
	GtkWidget *fixed;
	GtkWidget *event_box;
	GtkWidget *label;

	fixed = fixed_base;

	label = gtk_label_new(cancel_text);
	gtk_widget_set_size_request(label, cancel_label_width, cancel_label_height);
	gtk_widget_show(label);

	GdkColor white = {0, 65535, 65535, 65535};
	GtkRcStyle *rc_style = gtk_rc_style_new ();
	rc_style->fg[GTK_STATE_NORMAL] = white;
	rc_style->color_flags[GTK_STATE_NORMAL] |= GTK_RC_FG;
	gtk_widget_modify_style(label, rc_style);
	gtk_rc_style_unref(rc_style);

	event_box = gtk_event_box_new();
	gtk_container_add(GTK_CONTAINER(event_box), label);
	gtk_event_box_set_visible_window(GTK_EVENT_BOX(event_box), FALSE);
	gtk_widget_show(event_box);
	g_signal_connect(G_OBJECT(event_box), "enter_notify_event",
						G_CALLBACK(cancel_enter), NULL);
	g_signal_connect(G_OBJECT(event_box), "leave_notify_event",
						G_CALLBACK(cancel_leave), NULL);
	g_signal_connect(G_OBJECT(event_box), "button_press_event",
						G_CALLBACK(cancel_press), NULL);

	gtk_widget_show(event_box);
	gtk_fixed_put(GTK_FIXED(fixed), event_box, cancel_label_pos_x, cancel_label_pos_y);
}
开发者ID:cherry-wb,项目名称:quietheart,代码行数:33,代码来源:main.c

示例9: main

int main (int argc, char *argv[]) {
  
  GtkWidget *window;
  GtkWidget *fixed;
  GtkWidget *button;

  gtk_init(&argc, &argv);

  window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
  gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
  gtk_window_set_default_size(GTK_WINDOW(window), 230, 150);
  gtk_window_set_title(GTK_WINDOW(window), "enter signal");

  fixed = gtk_fixed_new();
  gtk_container_add(GTK_CONTAINER(window), fixed);

  button = gtk_button_new_with_label("Button");
  gtk_widget_set_size_request(button, 80, 35);
  gtk_fixed_put(GTK_FIXED(fixed), button, 50, 50);

  // call the enter_button() user button when the enter signal occurs
  g_signal_connect(G_OBJECT(button), "enter",
		   G_CALLBACK(enter_button), NULL);

  g_signal_connect_swapped(G_OBJECT(window), "destroy",
			   G_CALLBACK(gtk_main_quit), G_OBJECT(window));

  gtk_widget_show_all(window);
  gtk_main();

  return 0;
}
开发者ID:nicksexton,项目名称:gui-tools,代码行数:32,代码来源:4_3_entersignal.c

示例10: GTK_WIDGET

GtkWidget* wxPizza::New(long windowStyle,void* owner)
{
    GtkWidget* widget = GTK_WIDGET(g_object_new(type(), NULL));
    wxPizza* pizza = WX_PIZZA(widget);
    pizza->m_owner = owner;
    pizza->m_backing_window = NULL;
    pizza->m_scroll_x = 0;
    pizza->m_scroll_y = 0;
    pizza->m_is_scrollable = (windowStyle & (wxHSCROLL | wxVSCROLL)) != 0;
    // mask off border styles not useable with wxPizza
    pizza->m_border_style = int(windowStyle & BORDER_STYLES);
    gtk_fixed_set_has_window(GTK_FIXED(widget), true);
    gtk_widget_add_events(widget,
        GDK_EXPOSURE_MASK |
        GDK_SCROLL_MASK |
        GDK_POINTER_MOTION_MASK |
        GDK_POINTER_MOTION_HINT_MASK |
        GDK_BUTTON_MOTION_MASK |
        GDK_BUTTON1_MOTION_MASK |
        GDK_BUTTON2_MOTION_MASK |
        GDK_BUTTON3_MOTION_MASK |
        GDK_BUTTON_PRESS_MASK |
        GDK_BUTTON_RELEASE_MASK |
        GDK_KEY_PRESS_MASK |
        GDK_KEY_RELEASE_MASK |
        GDK_ENTER_NOTIFY_MASK |
        GDK_LEAVE_NOTIFY_MASK |
        GDK_FOCUS_CHANGE_MASK);
    return widget;
}
开发者ID:jonntd,项目名称:dynamica,代码行数:30,代码来源:win_gtk.cpp

示例11: gtk_drawing_area_new

void Viewport::create(Window &parent, unsigned x, unsigned y, unsigned width, unsigned height) {
  object->widget = gtk_drawing_area_new();
  gtk_widget_set_double_buffered(object->widget, false);
  gtk_widget_set_size_request(object->widget, width, height);
  gtk_fixed_put(GTK_FIXED(parent.object->formContainer), object->widget, x, y);
  gtk_widget_show(object->widget);
}
开发者ID:gilligan,项目名称:bsnes,代码行数:7,代码来源:viewport.cpp

示例12: _GuiWindow_child_resizeCallback

	static void _GuiWindow_child_resizeCallback (GtkWidget *childWidget, gpointer data) {
		GtkAllocation *allocation = (GtkAllocation *) data;
		GtkWidget *parentWidget = gtk_widget_get_parent (childWidget);
		Thing_cast (GuiThing, child, _GuiObject_getUserData (childWidget));
		if (child) {
			GuiControl control = NULL;
			if (Thing_isa (child, classGuiControl)) {
				control = static_cast <GuiControl> (child);
			} else if (Thing_isa (child, classGuiMenu)) {
				Thing_cast (GuiMenu, menu, child);
				control = menu -> d_cascadeButton;
			}
			if (control) {
				/*
				 * Move and resize.
				 */
				trace (U"moving child of class ", Thing_className (control));
				int left = control -> d_left, right = control -> d_right, top = control -> d_top, bottom = control -> d_bottom;
				if (left   <  0) left   += allocation -> width;   // this replicates structGuiControl :: v_positionInForm ()
				if (right  <= 0) right  += allocation -> width;
				if (top    <  0) top    += allocation -> height;
				if (bottom <= 0) bottom += allocation -> height;
				trace (U"moving child to (", left, U",", top, U")");
				gtk_fixed_move (GTK_FIXED (parentWidget), GTK_WIDGET (childWidget), left, top);
				gtk_widget_set_size_request (GTK_WIDGET (childWidget), right - left, bottom - top);
				trace (U"moved child of class ", Thing_className (control));
			}
		}
	}
开发者ID:davideberdin,项目名称:praat,代码行数:29,代码来源:GuiWindow.cpp

示例13: gtk_fixed_move

void VLGbutton::moveTo(int nx,int ny) {
    if (parent)	{
        gtk_fixed_move (GTK_FIXED (((VLGform*)parent)->fixed), widget, nx, ny);
        x=nx;
        y=ny;
    }
}
开发者ID:BackupTheBerlios,项目名称:dodona-svn,代码行数:7,代码来源:VLGbutton.cpp

示例14: NSA_GET_PTR

JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_GtkLabelPeer_setNativeBounds
  (JNIEnv *env, jobject obj, jint x, jint y, jint width, jint height)
{
  GtkWidget *widget;
  void *ptr;

  ptr = NSA_GET_PTR (env, obj);

  gdk_threads_enter ();

  widget = GTK_WIDGET (ptr);

  /* We assume that -1 is a width or height and not a request for the
     widget's natural size. */
  width = width < 0 ? 0 : width;
  height = height < 0 ? 0 : height;

  if (!(width == 0 && height == 0))
    {
      /* Set the event box's size request... */
      gtk_widget_set_size_request (widget, width, height);
      /* ...and the label's size request. */
      gtk_widget_set_size_request (gtk_bin_get_child (GTK_BIN (widget)),
                                   width, height);

      if (widget->parent != NULL)
        gtk_fixed_move (GTK_FIXED (widget->parent), widget, x, y);
    }

  gdk_threads_leave ();
}
开发者ID:BackupTheBerlios,项目名称:iphone-binutils-svn,代码行数:32,代码来源:gnu_java_awt_peer_gtk_GtkLabelPeer.c

示例15: main

int main(int argc, char **argv)
{
    GtkWidget *window;
    GtkWidget *fixed;
    GtkWidget *button;
    gint i;

    gtk_init(&argc, &argv);

    window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
    gtk_window_set_title(GTK_WINDOW(window), "Fixed Container");
    g_signal_connect(G_OBJECT(window), "destroy", G_CALLBACK(gtk_main_quit), NULL);
    gtk_container_set_border_width(GTK_CONTAINER(window), 10);

    fixed = gtk_fixed_new();
    gtk_container_add(GTK_CONTAINER(window), fixed);
    gtk_widget_show(fixed);

    for(i=1; i<=3; i++)
    {
        button = gtk_button_new_with_label("Press me");
        g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(move_button), fixed);
        gtk_fixed_put(GTK_FIXED(fixed), button, i*50, i*50);
        gtk_widget_show(button);
    }

    gtk_widget_show(window);
    gtk_main();
    
    return 0;
}
开发者ID:farthought,项目名称:code,代码行数:31,代码来源:fixedcontainer.c


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