这篇教程C++ CLUTTER_ACTOR函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中CLUTTER_ACTOR函数的典型用法代码示例。如果您正苦于以下问题:C++ CLUTTER_ACTOR函数的具体用法?C++ CLUTTER_ACTOR怎么用?C++ CLUTTER_ACTOR使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了CLUTTER_ACTOR函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: setup_windowstatic voidsetup_window (void){ GtkWidget *vbox; GtkWidget *packing; GtkWidget *menubar; GtkUIManager *ui_manager; GtkAccelGroup *accel_group; ClutterColor stage_color = {0x00,0x00,0x00,0xff}; window = gtk_window_new (GTK_WINDOW_TOPLEVEL); clutter_widget = gtk_clutter_embed_new (); stage = gtk_clutter_embed_get_stage (GTK_CLUTTER_EMBED (clutter_widget)); clutter_stage_set_color (CLUTTER_STAGE(stage), &stage_color); clutter_actor_set_size (CLUTTER_ACTOR (stage), properties->tilesize * BOARDWIDTH, properties->tilesize * BOARDHEIGHT); clutter_stage_set_user_resizable (CLUTTER_STAGE (stage), FALSE); board = gnibbles_board_new (); gtk_window_set_title (GTK_WINDOW (window), _("Nibbles")); gtk_window_set_default_size (GTK_WINDOW (window), DEFAULT_WIDTH, DEFAULT_HEIGHT); games_conf_add_window (GTK_WINDOW (window), KEY_PREFERENCES_GROUP); g_signal_connect (G_OBJECT (window), "destroy", G_CALLBACK (gtk_main_quit), NULL); g_signal_connect (G_OBJECT (window), "delete_event", G_CALLBACK (delete_cb), NULL); g_signal_connect (G_OBJECT (window), "window_state_event", G_CALLBACK (window_state_cb), NULL); gtk_widget_realize (window); vbox = gtk_vbox_new (FALSE, 0); games_stock_init (); ui_manager = gtk_ui_manager_new (); create_menus (ui_manager); set_fullscreen_actions (FALSE); notebook = gtk_notebook_new (); gtk_notebook_set_show_tabs (GTK_NOTEBOOK (notebook), FALSE); accel_group = gtk_ui_manager_get_accel_group (ui_manager); gtk_window_add_accel_group (GTK_WINDOW (window), accel_group); menubar = gtk_ui_manager_get_widget (ui_manager, "/MainMenu"); gtk_box_pack_start (GTK_BOX (vbox), menubar, FALSE, FALSE, 0); packing = games_grid_frame_new (BOARDWIDTH, BOARDHEIGHT); gtk_widget_show (packing); gtk_container_add (GTK_CONTAINER (packing), clutter_widget);#ifdef GGZ_CLIENT chat = create_chat_widget (); gtk_box_pack_start (GTK_BOX (vbox), chat, FALSE, TRUE, 0);#endif g_signal_connect (G_OBJECT (clutter_widget), "configure_event", G_CALLBACK (configure_event_cb), NULL); g_signal_connect (G_OBJECT (window), "focus_out_event", G_CALLBACK (show_cursor_cb), NULL); gtk_box_pack_start (GTK_BOX (vbox), notebook, TRUE, TRUE, 0); gtk_notebook_append_page (GTK_NOTEBOOK (notebook), packing, NULL); gtk_notebook_set_current_page (GTK_NOTEBOOK (notebook), MAIN_PAGE); statusbar = gtk_statusbar_new (); gtk_box_pack_start (GTK_BOX (vbox), statusbar, FALSE, FALSE, 0); gtk_container_add (GTK_CONTAINER (window), vbox); gtk_widget_show_all (window);#ifdef GGZ_CLIENT gtk_widget_hide (chat);#endif scoreboard = gnibbles_scoreboard_new (statusbar);}
开发者ID:gfunkmonk2,项目名称:mate-games,代码行数:87,
示例2: _xfdashboard_application_quit/* Quit application depending on daemon mode and force parameter */static void _xfdashboard_application_quit(XfdashboardApplication *self, gboolean inForceQuit){ XfdashboardApplicationPrivate *priv; gboolean shouldQuit; GSList *stages, *entry; g_return_if_fail(XFDASHBOARD_IS_APPLICATION(self)); priv=self->priv; shouldQuit=FALSE; /* Check if we should really quit this instance */ if(inForceQuit==TRUE || priv->isDaemon==FALSE) shouldQuit=TRUE; /* Do nothing if application is already quitting. This can happen if * application is running in daemon mode (primary instance) and another * instance was called with "quit" or "restart" parameter which would * cause this function to be called twice. */ if(priv->isQuitting) return; /* If application is not in daemon mode or if forced is set to TRUE * destroy all stage windows ... */ if(shouldQuit==TRUE) { /* Set flag that application is going to quit */ priv->isQuitting=TRUE; /* If application is told to quit, set the restart style to something * where it won't restart itself. */ if(priv->sessionManagementClient && XFCE_IS_SM_CLIENT(priv->sessionManagementClient)) { xfce_sm_client_set_restart_style(priv->sessionManagementClient, XFCE_SM_CLIENT_RESTART_NORMAL); } /* Destroy stages */ stages=clutter_stage_manager_list_stages(clutter_stage_manager_get_default()); for(entry=stages; entry!=NULL; entry=g_slist_next(entry)) clutter_actor_destroy(CLUTTER_ACTOR(entry->data)); g_slist_free(stages); /* Emit "quit" signal */ g_signal_emit(self, XfdashboardApplicationSignals[SIGNAL_QUIT], 0); /* Really quit application here and now */ if(priv->inited) clutter_main_quit(); } /* ... otherwise emit "suspend" signal */ else { /* Only send signal if not suspended already */ if(!priv->isSuspended) { /* Send signal */ g_signal_emit(self, XfdashboardApplicationSignals[SIGNAL_SUSPEND], 0); /* Set flag for suspension */ priv->isSuspended=TRUE; g_object_notify_by_pspec(G_OBJECT(self), XfdashboardApplicationProperties[PROP_SUSPENDED]); } }}
开发者ID:Zeioth,项目名称:xfdashboard,代码行数:65,
示例3: clutter_flow_layout_get_preferred_heightstatic voidclutter_flow_layout_get_preferred_height (ClutterLayoutManager *manager, ClutterContainer *container, gfloat for_width, gfloat *min_height_p, gfloat *nat_height_p){ ClutterFlowLayoutPrivate *priv = CLUTTER_FLOW_LAYOUT (manager)->priv; gint n_columns, line_item_count, line_count; gfloat total_min_height, total_natural_height; gfloat line_min_height, line_natural_height; gfloat max_min_height, max_natural_height; ClutterActor *actor, *child; ClutterActorIter iter; gfloat item_x; n_columns = get_columns (CLUTTER_FLOW_LAYOUT (manager), for_width); total_min_height = 0; total_natural_height = 0; line_min_height = 0; line_natural_height = 0; line_item_count = 0; line_count = 0; item_x = 0; actor = CLUTTER_ACTOR (container); /* clear the line height arrays */ if (priv->line_min != NULL) g_array_free (priv->line_min, TRUE); if (priv->line_natural != NULL) g_array_free (priv->line_natural, TRUE); priv->line_min = g_array_sized_new (FALSE, FALSE, sizeof (gfloat), 16); priv->line_natural = g_array_sized_new (FALSE, FALSE, sizeof (gfloat), 16); if (clutter_actor_get_n_children (actor) != 0) line_count = 1; max_min_height = max_natural_height = 0; clutter_actor_iter_init (&iter, actor); while (clutter_actor_iter_next (&iter, &child)) { gfloat child_min, child_natural; gfloat new_x, item_width; if (!CLUTTER_ACTOR_IS_VISIBLE (child)) continue; if (priv->orientation == CLUTTER_FLOW_HORIZONTAL && for_width > 0) { clutter_actor_get_preferred_width (child, -1, &child_min, &child_natural); if ((priv->snap_to_grid && line_item_count == n_columns) || (!priv->snap_to_grid && item_x + child_natural > for_width)) { total_min_height += line_min_height; total_natural_height += line_natural_height; g_array_append_val (priv->line_min, line_min_height); g_array_append_val (priv->line_natural, line_natural_height); line_min_height = line_natural_height = 0; line_item_count = 0; line_count += 1; item_x = 0; } if (priv->snap_to_grid) { new_x = ((line_item_count + 1) * (for_width + priv->col_spacing)) / n_columns; item_width = new_x - item_x - priv->col_spacing; } else { new_x = item_x + child_natural + priv->col_spacing; item_width = child_natural; } clutter_actor_get_preferred_height (child, item_width, &child_min, &child_natural); line_min_height = MAX (line_min_height, child_min);//.........这里部分代码省略.........
开发者ID:ebassi,项目名称:clutter,代码行数:101,
示例4: mx_button_style_changedstatic voidmx_button_style_changed (MxWidget *widget){ MxButton *button = MX_BUTTON (widget); MxButtonPrivate *priv = button->priv; MxBorderImage *content_image = NULL; /* update the label styling */ mx_button_update_label_style (button); g_free (priv->style_icon_name); mx_stylable_get (MX_STYLABLE (widget), "x-mx-content-image", &content_image, "x-mx-icon-name", &priv->style_icon_name, "x-mx-icon-size", &priv->style_icon_size, NULL); if (content_image && content_image->uri) { if (priv->content_image) { clutter_actor_remove_child (CLUTTER_ACTOR (widget), priv->content_image); } priv->content_image = (ClutterActor*) mx_texture_cache_get_texture (mx_texture_cache_get_default (), content_image->uri); if (priv->content_image) clutter_actor_add_child (CLUTTER_ACTOR (widget), priv->content_image); else g_warning ("Could not load content image /"%s/"", content_image->uri); g_boxed_free (MX_TYPE_BORDER_IMAGE, content_image); return; } else { /* remove any previous content image */ if (priv->content_image) { clutter_actor_remove_child (CLUTTER_ACTOR (widget), priv->content_image); priv->content_image = NULL; } if (content_image) g_boxed_free (MX_TYPE_BORDER_IMAGE, content_image); } if (priv->icon_size == 0) mx_icon_set_icon_size (MX_ICON (priv->icon), priv->style_icon_size); if (priv->style_icon_name && !priv->icon_name) { mx_icon_set_icon_name (MX_ICON (priv->icon), priv->style_icon_name); mx_button_update_contents (button); }}
开发者ID:danni,项目名称:mx,代码行数:61,
示例5: mex_telepathy_channel_on_src_pad_addedstatic voidmex_telepathy_channel_on_src_pad_added (TfContent *content, TpHandle handle, FsStream *stream, GstPad *pad, FsCodec *codec, gpointer user_data){ MexTelepathyChannel *self = MEX_TELEPATHY_CHANNEL (user_data); MexTelepathyChannelPrivate *priv = self->priv; gchar *cstr = fs_codec_to_string (codec); FsMediaType mtype; GstPad *sinkpad; GstElement *element; GstStateChangeReturn ret; /* Upon pad added, clear the "in progress" box+padding */ clutter_actor_hide (CLUTTER_ACTOR (priv->busy_box)); clutter_actor_show (CLUTTER_ACTOR (priv->full_frame) ); MEX_DEBUG ("New src pad: %s", cstr); g_object_get (content, "media-type", &mtype, NULL); switch (mtype) { case FS_MEDIA_TYPE_AUDIO: element = gst_parse_bin_from_description ( "audioconvert ! audioresample ! audioconvert ! autoaudiosink", TRUE, NULL); break; case FS_MEDIA_TYPE_VIDEO: element = priv->incoming_sink; break; default: MEX_WARNING ("Unknown media type"); return; } if (!gst_bin_add (GST_BIN (priv->pipeline), element)) { MEX_WARNING ("Failed to add sink element to pipeline"); } sinkpad = gst_element_get_pad (element, "sink"); ret = gst_element_set_state (element, GST_STATE_PLAYING); if (ret == GST_STATE_CHANGE_FAILURE) { tp_channel_close_async (TP_CHANNEL (priv->channel), NULL, NULL); MEX_WARNING ("Failed to start tee sink pipeline !?"); return; } if (GST_PAD_LINK_FAILED (gst_pad_link (pad, sinkpad))) { tp_channel_close_async (TP_CHANNEL (priv->channel), NULL, NULL); MEX_WARNING ("Couldn't link sink pipeline !?"); return; } g_object_unref (sinkpad); /* Start in FULL mode */ mex_telepathy_channel_set_tool_mode (self, TOOL_MODE_FULL, 100);}
开发者ID:Cyrene,项目名称:media-explorer,代码行数:64,
示例6: mnb_zones_preview_change_workspacevoidmnb_zones_preview_change_workspace (MnbZonesPreview *preview, gint workspace){ gboolean reset_anim; MnbZonesPreviewPrivate *priv = preview->priv; /* If we're already going towards this workspace, ignore */ if ((priv->dest_workspace == workspace) && priv->anim_phase) return; /* Figure out what we need to be doing with this animation */ switch (priv->anim_phase) { default: case MNB_ZP_STATIC: /* We weren't animating, start a new one */ reset_anim = TRUE; break; case MNB_ZP_ZOOM_OUT: /* If we're on the right workspace, zoom in and finish, otherwise * continue the animation like normal. */ if (priv->dest_workspace == workspace) { priv->anim_phase = MNB_ZP_PAN; reset_anim = TRUE; } else reset_anim = FALSE; break; case MNB_ZP_PAN: /* If we're heading towards the right workspace, continue the * animation, otherwise change direction. */ if (priv->dest_workspace != workspace) { priv->anim_phase = MNB_ZP_ZOOM_OUT; reset_anim = TRUE; } else reset_anim = FALSE; break; case MNB_ZP_ZOOM_IN: /* Restart the animation if we're not heading towards the right * workspace. */ if (priv->dest_workspace != workspace) { priv->anim_phase = MNB_ZP_STATIC; reset_anim = TRUE; } else reset_anim = FALSE; break; } priv->dest_workspace = workspace; if (reset_anim) { ClutterAnimation *animation = clutter_actor_get_animation (CLUTTER_ACTOR (preview)); if (animation) g_signal_handlers_disconnect_by_func (animation, mnb_zones_preview_completed_cb, preview); mnb_zones_preview_completed_cb (animation, preview); }}
开发者ID:dudochkin-victor,项目名称:mutter-netbook,代码行数:74,
示例7: st_texture_cache_load_gicon//.........这里部分代码省略......... * This method returns a new #ClutterActor for a given #GIcon. If the * icon isn't loaded already, the texture will be filled * asynchronously. * * Return Value: (transfer none): A new #ClutterActor for the icon, or %NULL if not found */ClutterActor *st_texture_cache_load_gicon (StTextureCache *cache, StThemeNode *theme_node, GIcon *icon, gint size, gint scale){ AsyncTextureLoadData *request; ClutterActor *texture; char *gicon_string; char *key; GtkIconTheme *theme; GtkIconInfo *info; StTextureCachePolicy policy; StIconColors *colors = NULL; StIconStyle icon_style = ST_ICON_STYLE_REQUESTED; GtkIconLookupFlags lookup_flags; if (theme_node) { colors = st_theme_node_get_icon_colors (theme_node); icon_style = st_theme_node_get_icon_style (theme_node); } /* Do theme lookups in the main thread to avoid thread-unsafety */ theme = cache->priv->icon_theme; lookup_flags = GTK_ICON_LOOKUP_USE_BUILTIN; if (icon_style == ST_ICON_STYLE_REGULAR) lookup_flags |= GTK_ICON_LOOKUP_FORCE_REGULAR; else if (icon_style == ST_ICON_STYLE_SYMBOLIC) lookup_flags |= GTK_ICON_LOOKUP_FORCE_SYMBOLIC; if (clutter_get_default_text_direction () == CLUTTER_TEXT_DIRECTION_RTL) lookup_flags |= GTK_ICON_LOOKUP_DIR_RTL; else lookup_flags |= GTK_ICON_LOOKUP_DIR_LTR; info = gtk_icon_theme_lookup_by_gicon_for_scale (theme, icon, size, scale, lookup_flags); if (info == NULL) return NULL; gicon_string = g_icon_to_string (icon); /* A return value of NULL indicates that the icon can not be serialized, * so don't have a unique identifier for it as a cache key, and thus can't * be cached. If it is cachable, we hardcode a policy of FOREVER here for * now; we should actually blow this away on icon theme changes probably */ policy = gicon_string != NULL ? ST_TEXTURE_CACHE_POLICY_FOREVER : ST_TEXTURE_CACHE_POLICY_NONE; if (colors) { /* This raises some doubts about the practice of using string keys */ key = g_strdup_printf (CACHE_PREFIX_ICON "%s,size=%d,scale=%d,style=%d,colors=%2x%2x%2x%2x,%2x%2x%2x%2x,%2x%2x%2x%2x,%2x%2x%2x%2x", gicon_string, size, scale, icon_style, colors->foreground.red, colors->foreground.blue, colors->foreground.green, colors->foreground.alpha, colors->warning.red, colors->warning.blue, colors->warning.green, colors->warning.alpha, colors->error.red, colors->error.blue, colors->error.green, colors->error.alpha, colors->success.red, colors->success.blue, colors->success.green, colors->success.alpha); } else { key = g_strdup_printf (CACHE_PREFIX_ICON "%s,size=%d,scale=%d,style=%d", gicon_string, size, scale, icon_style); } g_free (gicon_string); texture = (ClutterActor *) create_default_texture (); clutter_actor_set_size (texture, size * scale, size * scale); if (ensure_request (cache, key, policy, &request, texture)) { /* If there's an outstanding request, we've just added ourselves to it */ g_object_unref (info); g_free (key); } else { /* Else, make a new request */ request->cache = cache; /* Transfer ownership of key */ request->key = key; request->policy = policy; request->colors = colors ? st_icon_colors_ref (colors) : NULL; request->icon_info = info; request->width = request->height = size; request->scale = scale; load_texture_async (cache, request); } return CLUTTER_ACTOR (texture);}
开发者ID:kenvandine,项目名称:gnome-shell,代码行数:101,
示例8: gnibbles_board_load_levelstatic voidgnibbles_board_load_level (GnibblesBoard *board){ gint i,j; gint x_pos, y_pos; ClutterActor *tmp; gboolean is_wall = TRUE; if (board->level) { clutter_group_remove_all (CLUTTER_GROUP (board->level)); clutter_container_remove_actor (CLUTTER_CONTAINER (stage), board->level); } board->level = clutter_group_new (); /* Load wall_pixmaps onto the surface*/ for (i = 0; i < BOARDHEIGHT; i++) { y_pos = i * properties->tilesize; for (j = 0; j < BOARDWIDTH; j++) { is_wall = TRUE; switch (board->walls[j][i]) { case 'a': // empty space is_wall = FALSE; break; // break right away case 'b': // straight up tmp = gtk_clutter_texture_new_from_pixbuf (wall_pixmaps[0]); break; case 'c': // straight side tmp = gtk_clutter_texture_new_from_pixbuf (wall_pixmaps[1]); break; case 'd': // corner bottom left tmp = gtk_clutter_texture_new_from_pixbuf (wall_pixmaps[2]); break; case 'e': // corner bottom right tmp = gtk_clutter_texture_new_from_pixbuf (wall_pixmaps[3]); break; case 'f': // corner up left tmp = gtk_clutter_texture_new_from_pixbuf (wall_pixmaps[4]); break; case 'g': // corner up right tmp = gtk_clutter_texture_new_from_pixbuf (wall_pixmaps[5]); break; case 'h': // tee up tmp = gtk_clutter_texture_new_from_pixbuf (wall_pixmaps[6]); break; case 'i': // tee right tmp = gtk_clutter_texture_new_from_pixbuf (wall_pixmaps[7]); break; case 'j': // tee left tmp = gtk_clutter_texture_new_from_pixbuf (wall_pixmaps[8]); break; case 'k': // tee down tmp = gtk_clutter_texture_new_from_pixbuf (wall_pixmaps[9]); break; case 'l': // cross tmp = gtk_clutter_texture_new_from_pixbuf (wall_pixmaps[10]); break; default: is_wall = FALSE; break; } if (is_wall) { x_pos = j * properties->tilesize; clutter_actor_set_size (CLUTTER_ACTOR(tmp), properties->tilesize, properties->tilesize); clutter_actor_set_position (CLUTTER_ACTOR (tmp), x_pos, y_pos); clutter_actor_show (CLUTTER_ACTOR (tmp)); clutter_container_add_actor (CLUTTER_CONTAINER (board->level), CLUTTER_ACTOR (tmp)); } } } clutter_container_add_actor (CLUTTER_CONTAINER (stage), board->level); clutter_actor_raise (board->level, board->surface); clutter_actor_set_opacity (board->level, 0); clutter_actor_set_scale (CLUTTER_ACTOR (board->level), 0.2, 0.2); clutter_actor_animate (board->level, CLUTTER_EASE_OUT_BOUNCE, 1210, "opacity", 0xff, "fixed::scale-gravity", CLUTTER_GRAVITY_CENTER, "scale-x", 1.0, "scale-y", 1.0, NULL);}
开发者ID:gfunkmonk2,项目名称:mate-games,代码行数:89,
示例9: mex_music_player_initstatic voidmex_music_player_init (MexMusicPlayer *self){ GError *error = NULL; ClutterActor *box; MexMusicPlayerPrivate *priv; ClutterActor *button; priv = self->priv = MUSIC_PLAYER_PRIVATE (self); priv->script = clutter_script_new (); clutter_script_load_from_resource (priv->script, "/org/media-explorer/MediaExplorer/json/" "music-player.json", &error); if (error) { g_error (G_STRLOC " %s", error->message); g_clear_error (&error); } box = mex_script_get_actor (priv->script, "box"); g_assert (box); clutter_actor_add_child (CLUTTER_ACTOR (self), box); /* labels */ priv->title_label = mex_script_get_actor (priv->script, "title-label"); priv->subtitle_label = mex_script_get_actor (priv->script, "subtitle-label"); /* play */ priv->play_button = mex_script_get_actor (priv->script, "play-button"); g_signal_connect_swapped (priv->play_button, "clicked", G_CALLBACK (mex_music_player_play_toggle), self); /* next */ button = mex_script_get_actor (priv->script, "next-button"); g_signal_connect_swapped (button, "clicked", G_CALLBACK (mex_music_player_next), self); /* previous */ button = mex_script_get_actor (priv->script, "previous-button"); g_signal_connect_swapped (button, "clicked", G_CALLBACK (mex_music_player_previous), self); /* stop */ button = mex_script_get_actor (priv->script, "stop-button"); g_signal_connect_swapped (button, "clicked", G_CALLBACK (mex_music_player_quit), self); /* repeat */ button = mex_script_get_actor (priv->script, "repeat-button"); g_signal_connect_swapped (button, "notify::toggled", G_CALLBACK (mex_music_player_repeat_toggled), self); button = mex_script_get_actor (priv->script, "shuffle-button"); g_signal_connect_swapped (button, "notify::toggled", G_CALLBACK (mex_music_player_shuffle_toggled), self); /* player */ priv->player = (ClutterMedia *) clutter_gst_video_texture_new (); g_signal_connect (priv->player, "notify", G_CALLBACK (mex_music_player_notify_cb), self); g_signal_connect (priv->player, "eos", G_CALLBACK (mex_music_player_eos_cb), self); /* slider */ priv->slider = mex_script_get_actor (priv->script, "progress-slider"); priv->slider_notify_id = g_signal_connect (priv->slider, "notify::value", G_CALLBACK (mex_music_player_slider_notify), self); g_signal_connect (self, "captured-event", G_CALLBACK (mex_music_player_captured_event), NULL);}
开发者ID:frankopt,项目名称:media-explorer,代码行数:79,
示例10: clone_source_queue_relayout_cbstatic voidclone_source_queue_relayout_cb (ClutterActor *source, ClutterClone *self){ clutter_actor_queue_relayout (CLUTTER_ACTOR (self));}
开发者ID:ChrisCummins,项目名称:clutter,代码行数:6,
示例11: clutter_flow_layout_get_preferred_widthstatic voidclutter_flow_layout_get_preferred_width (ClutterLayoutManager *manager, ClutterContainer *container, gfloat for_height, gfloat *min_width_p, gfloat *nat_width_p){ ClutterFlowLayoutPrivate *priv = CLUTTER_FLOW_LAYOUT (manager)->priv; gint n_rows, line_item_count, line_count; gfloat total_min_width, total_natural_width; gfloat line_min_width, line_natural_width; gfloat max_min_width, max_natural_width; ClutterActor *actor, *child; ClutterActorIter iter; gfloat item_y; n_rows = get_rows (CLUTTER_FLOW_LAYOUT (manager), for_height); total_min_width = 0; total_natural_width = 0; line_min_width = 0; line_natural_width = 0; line_item_count = 0; line_count = 0; item_y = 0; actor = CLUTTER_ACTOR (container); /* clear the line width arrays */ if (priv->line_min != NULL) g_array_free (priv->line_min, TRUE); if (priv->line_natural != NULL) g_array_free (priv->line_natural, TRUE); priv->line_min = g_array_sized_new (FALSE, FALSE, sizeof (gfloat), 16); priv->line_natural = g_array_sized_new (FALSE, FALSE, sizeof (gfloat), 16); if (clutter_actor_get_n_children (actor) != 0) line_count = 1; max_min_width = max_natural_width = 0; clutter_actor_iter_init (&iter, actor); while (clutter_actor_iter_next (&iter, &child)) { gfloat child_min, child_natural; gfloat new_y, item_height; if (!CLUTTER_ACTOR_IS_VISIBLE (child)) continue; if (priv->orientation == CLUTTER_FLOW_VERTICAL && for_height > 0) { if (line_item_count == n_rows) { total_min_width += line_min_width; total_natural_width += line_natural_width; g_array_append_val (priv->line_min, line_min_width); g_array_append_val (priv->line_natural, line_natural_width); line_min_width = line_natural_width = 0; line_item_count = 0; line_count += 1; item_y = 0; } new_y = ((line_item_count + 1) * (for_height + priv->row_spacing)) / n_rows; item_height = new_y - item_y - priv->row_spacing; clutter_actor_get_preferred_width (child, item_height, &child_min, &child_natural); line_min_width = MAX (line_min_width, child_min); line_natural_width = MAX (line_natural_width, child_natural); item_y = new_y; line_item_count += 1; max_min_width = MAX (max_min_width, line_min_width); max_natural_width = MAX (max_natural_width, line_natural_width); } else { clutter_actor_get_preferred_width (child, for_height, &child_min, &child_natural);//.........这里部分代码省略.........
开发者ID:ChrisCummins,项目名称:clutter,代码行数:101,
示例12: st_container_navigate_focusstatic gbooleanst_container_navigate_focus (StWidget *widget, ClutterActor *from, GtkDirectionType direction){ StContainer *container = ST_CONTAINER (widget); ClutterActor *container_actor, *focus_child; GList *children, *l; container_actor = CLUTTER_ACTOR (widget); if (from == container_actor) return FALSE; /* Figure out if @from is a descendant of @container, and if so, * set @focus_child to the immediate child of @container that * contains (or *is*) @from. */ focus_child = from; while (focus_child && clutter_actor_get_parent (focus_child) != container_actor) focus_child = clutter_actor_get_parent (focus_child); if (st_widget_get_can_focus (widget)) { if (!focus_child) { /* Accept focus from outside */ clutter_actor_grab_key_focus (container_actor); return TRUE; } else { /* Yield focus from within: since @container itself is * focusable we don't allow the focus to be navigated * within @container. */ return FALSE; } } /* See if we can navigate within @focus_child */ if (focus_child && ST_IS_WIDGET (focus_child)) { if (st_widget_navigate_focus (ST_WIDGET (focus_child), from, direction, FALSE)) return TRUE; } /* At this point we know that we want to navigate focus to one of * @container's immediate children; the next one after @focus_child, * or the first one if @focus_child is %NULL. (With "next" and * "first" being determined by @direction.) */ children = st_container_get_focus_chain (container); if (direction == GTK_DIR_TAB_FORWARD || direction == GTK_DIR_TAB_BACKWARD) { if (direction == GTK_DIR_TAB_BACKWARD) children = g_list_reverse (children); if (focus_child) { /* Remove focus_child and any earlier children */ while (children && children->data != focus_child) children = g_list_delete_link (children, children); if (children) children = g_list_delete_link (children, children); } } else /* direction is an arrow key, not tab */ { StContainerChildSortData sort_data; /* Compute the allocation box of the previous focused actor, in * @container's coordinate space. If there was no previous focus, * use the coordinates of the appropriate edge of @container. * * Note that all of this code assumes the actors are not * transformed (or at most, they are all scaled by the same * amount). If @container or any of its children is rotated, or * any child is inconsistently scaled, then the focus chain will * probably be unpredictable. */ if (focus_child) { clutter_actor_get_allocation_box (focus_child, &sort_data.box); } else { clutter_actor_get_allocation_box (CLUTTER_ACTOR (container), &sort_data.box); switch (direction) { case GTK_DIR_UP: sort_data.box.y1 = sort_data.box.y2; break; case GTK_DIR_DOWN: sort_data.box.y2 = sort_data.box.y1; break; case GTK_DIR_LEFT: sort_data.box.x1 = sort_data.box.x2; break;//.........这里部分代码省略.........
开发者ID:hosttor,项目名称:Cinnamon,代码行数:101,
示例13: render_logostatic voidrender_logo (void){ ClutterActor *image; ClutterActor *text, *text_shadow; ClutterActor *desc, *desc_shadow; ClutterColor actor_color = {0xff,0xff,0xff,0xff}; ClutterColor shadow_color = {0x00, 0x00, 0x00, 0x88}; ClutterActor *text_group; static gint width, height; gint size; gfloat stage_w, stage_h; PangoFontDescription *pfd; PangoLayout *layout; PangoContext *context; gchar *nibbles = _("Nibbles"); /* Translators: This string will be included in the intro screen, so don't make sure it fits! */ gchar *description = _("A worm game for MATE."); logo = clutter_group_new (); text_group = clutter_group_new (); if (!logo_pixmap) gnibbles_load_logo (properties->tilesize); image = gtk_clutter_texture_new_from_pixbuf (logo_pixmap); stage_w = board->width * properties->tilesize; stage_h = board->height * properties->tilesize; clutter_actor_set_size (CLUTTER_ACTOR (image), stage_w, stage_h); clutter_actor_set_position (CLUTTER_ACTOR (image), 0, 0); clutter_actor_show (image); text = clutter_text_new (); clutter_text_set_color (CLUTTER_TEXT (text), &actor_color); context = gdk_pango_context_get (); layout = clutter_text_get_layout (CLUTTER_TEXT (text)); pfd = pango_context_get_font_description (context); size = pango_font_description_get_size (pfd); pango_font_description_set_size (pfd, (size * stage_w) / 100); pango_font_description_set_family (pfd, "Sans"); pango_font_description_set_weight(pfd, PANGO_WEIGHT_BOLD); pango_layout_set_font_description (layout, pfd); pango_layout_set_text (layout, nibbles, -1); pango_layout_get_pixel_size (layout, &width, &height); text_shadow = clutter_text_new (); clutter_text_set_color (CLUTTER_TEXT (text_shadow), &shadow_color); layout = clutter_text_get_layout (CLUTTER_TEXT (text_shadow)); pango_layout_set_font_description (layout, pfd); pango_layout_set_text (layout, nibbles, -1); clutter_actor_set_position (CLUTTER_ACTOR (text), (stage_w - width) * 0.5 , stage_h * .72); clutter_actor_set_position (CLUTTER_ACTOR (text_shadow), (stage_w - width) * 0.5 + 5, stage_h * .72 + 5); desc = clutter_text_new (); layout = clutter_text_get_layout (CLUTTER_TEXT (desc)); clutter_text_set_color (CLUTTER_TEXT (desc), &actor_color); pango_font_description_set_size (pfd, (size * stage_w) / 400); pango_layout_set_font_description (layout, pfd); pango_layout_set_text (layout, description, -1); pango_layout_get_pixel_size(layout, &width, &height); desc_shadow = clutter_text_new (); layout = clutter_text_get_layout (CLUTTER_TEXT (desc_shadow)); clutter_text_set_color (CLUTTER_TEXT (desc_shadow), &shadow_color); pango_font_description_set_size (pfd, (size * stage_w) / 400); pango_layout_set_font_description (layout, pfd); pango_layout_set_text (layout, description, -1); clutter_actor_set_position (CLUTTER_ACTOR (desc), (stage_w - width) * 0.5, stage_h* .93); clutter_actor_set_position (CLUTTER_ACTOR (desc_shadow), (stage_w - width) * 0.5 + 3, stage_h * .93 + 3); clutter_container_add (CLUTTER_CONTAINER (text_group), CLUTTER_ACTOR (text_shadow), CLUTTER_ACTOR (text), CLUTTER_ACTOR (desc_shadow), CLUTTER_ACTOR (desc), NULL); clutter_container_add (CLUTTER_CONTAINER (logo), CLUTTER_ACTOR (image), CLUTTER_ACTOR (text_group), NULL);//.........这里部分代码省略.........
开发者ID:gfunkmonk2,项目名称:mate-games,代码行数:101,
示例14: _xfdashboard_text_box_get_preferred_widthstatic void _xfdashboard_text_box_get_preferred_width(ClutterActor *self, gfloat inForHeight, gfloat *outMinWidth, gfloat *outNaturalWidth){ XfdashboardTextBoxPrivate *priv=XFDASHBOARD_TEXT_BOX(self)->priv; gfloat minWidth, naturalWidth; gfloat childMinWidth, childNaturalWidth; gint numberChildren=0; minWidth=naturalWidth=0.0f; /* Determine size of primary icon if visible */ if(CLUTTER_ACTOR_IS_VISIBLE(priv->actorPrimaryIcon)) { clutter_actor_get_preferred_width(CLUTTER_ACTOR(priv->actorPrimaryIcon), inForHeight, &childMinWidth, &childNaturalWidth); minWidth+=childMinWidth; naturalWidth+=childNaturalWidth; numberChildren++; } /* Determine size of editable text box if visible */ if(CLUTTER_ACTOR_IS_VISIBLE(priv->actorTextBox)) { clutter_actor_get_preferred_width(CLUTTER_ACTOR(priv->actorTextBox), inForHeight, &childMinWidth, &childNaturalWidth); minWidth+=childMinWidth; naturalWidth+=childNaturalWidth; numberChildren++; } /* Determine size of hint label if visible */ if(CLUTTER_ACTOR_IS_VISIBLE(priv->actorHintLabel)) { clutter_actor_get_preferred_width(CLUTTER_ACTOR(priv->actorHintLabel), inForHeight, &childMinWidth, &childNaturalWidth); minWidth+=childMinWidth; naturalWidth+=childNaturalWidth; numberChildren++; } /* Determine size of secondary icon if visible */ if(CLUTTER_ACTOR_IS_VISIBLE(priv->actorSecondaryIcon)) { clutter_actor_get_preferred_width(CLUTTER_ACTOR(priv->actorSecondaryIcon), inForHeight, &childMinWidth, &childNaturalWidth); minWidth+=childMinWidth; naturalWidth+=childNaturalWidth; } /* Add spacing for each child except the last one */ if(numberChildren>1) { numberChildren--; minWidth+=(numberChildren*priv->spacing); naturalWidth+=(numberChildren*priv->spacing); } // Add padding minWidth+=2*priv->padding; naturalWidth+=2*priv->padding; /* Store sizes computed */ if(outMinWidth) *outMinWidth=minWidth; if(outNaturalWidth) *outNaturalWidth=naturalWidth;}
开发者ID:tydaikho,项目名称:xfdashboard,代码行数:75,
示例15: create_map_windowstatic voidcreate_map_window (GourmapUi *ui){ GourmapUiPrivate *priv; GtkWidget *hbox; GtkWidget *vbox1, *vbox2; GtkWidget *toolbar; GtkWidget *addr_label; GtkToolItem *item; GtkCellRenderer *renderer; GtkTreeViewColumn *column; GtkTreeSelection *select; priv = GET_PRIVATE (ui); hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); vbox1 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); vbox2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); /* map */ priv->map = gtk_champlain_embed_new (); priv->champ_view = gtk_champlain_embed_get_view (GTK_CHAMPLAIN_EMBED (priv->map)); clutter_actor_set_reactive (CLUTTER_ACTOR (priv->champ_view), TRUE); g_object_set (G_OBJECT (priv->champ_view), "kinetic-mode", TRUE, NULL); priv->marker_layer = champlain_marker_layer_new_full (CHAMPLAIN_SELECTION_SINGLE); champlain_view_add_layer (priv->champ_view, CHAMPLAIN_LAYER (priv->marker_layer)); /* sidebar */ vbox2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); /* restaurant list */ priv->store = gtk_tree_store_new (N_COLUMNS, G_TYPE_STRING, G_TYPE_UINT); priv->treeview = gtk_tree_view_new_with_model (GTK_TREE_MODEL (priv->store)); renderer = gtk_cell_renderer_text_new (); column = gtk_tree_view_column_new_with_attributes (_("Restaurant List"), renderer, "text", NAME_COLUMN, NULL); select = gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->treeview)); gtk_tree_selection_set_mode (select, GTK_SELECTION_SINGLE); g_signal_connect (G_OBJECT (select), "changed", G_CALLBACK (tree_selection_changed_cb), (gpointer) ui); gtk_tree_view_append_column (GTK_TREE_VIEW (priv->treeview), column); gtk_box_pack_start (GTK_BOX (vbox2), priv->treeview, TRUE, TRUE, 0); /* random button */ priv->rand_button = gtk_button_new_with_label (_("Random Selection!")); g_signal_connect (G_OBJECT (priv->rand_button), "clicked", G_CALLBACK (random_button_cb), (gpointer) ui); gtk_box_pack_start (GTK_BOX (vbox2), priv->rand_button, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (hbox), priv->map, TRUE, TRUE, 0); gtk_box_pack_start (GTK_BOX (hbox), vbox2, FALSE, FALSE, 0); /* address */ toolbar = gtk_toolbar_new (); item = gtk_tool_item_new (); addr_label = gtk_label_new (_("Address")); gtk_container_add (GTK_CONTAINER (item), addr_label); gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1); item = gtk_tool_item_new (); gtk_tool_item_set_expand (item, TRUE); priv->addr_entry = gtk_entry_new (); gtk_container_add (GTK_CONTAINER (item), priv->addr_entry); g_signal_connect (G_OBJECT (priv->addr_entry), "activate", G_CALLBACK (activate_addr_entry_cb), (gpointer) ui); gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1); item = gtk_tool_button_new_from_stock (GTK_STOCK_OK); g_signal_connect (G_OBJECT (item), "clicked", G_CALLBACK (activate_addr_entry_cb), (gpointer) ui); gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1); gtk_box_pack_start (GTK_BOX (vbox1), hbox, TRUE, TRUE, 0); gtk_box_pack_start (GTK_BOX (vbox1), toolbar, FALSE, FALSE, 0); /* main window */ priv->main_window = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_window_set_default_size (GTK_WINDOW (priv->main_window), 1024, 768); gtk_widget_set_name (priv->main_window, _("Gourmap")); g_signal_connect (G_OBJECT (priv->main_window), "destroy", G_CALLBACK (destroy_cb), NULL); gtk_container_add (GTK_CONTAINER (priv->main_window), vbox1);}
开发者ID:lcp,项目名称:gourmap,代码行数:97,
示例16: _xfdashboard_text_box_allocate/* Allocate position and size of actor and its children */static void _xfdashboard_text_box_allocate(ClutterActor *self, const ClutterActorBox *inBox, ClutterAllocationFlags inFlags){ XfdashboardTextBoxPrivate *priv=XFDASHBOARD_TEXT_BOX(self)->priv; ClutterActorBox *box=NULL; gfloat left, right, top, bottom; gfloat iconWidth, iconHeight; /* Chain up to store the allocation of the actor */ CLUTTER_ACTOR_CLASS(xfdashboard_text_box_parent_class)->allocate(self, inBox, inFlags); /* Initialize bounding box of allocation used in actors */ left=top=priv->padding; right=clutter_actor_box_get_width(inBox)-priv->padding; bottom=clutter_actor_box_get_height(inBox)-priv->padding; /* Set allocation of primary icon if visible */ if(CLUTTER_ACTOR_IS_VISIBLE(priv->actorPrimaryIcon)) { gfloat childRight; /* Get scale size of primary icon */ iconWidth=iconHeight=0.0f; clutter_actor_get_size(priv->actorPrimaryIcon, &iconWidth, &iconHeight); if(iconHeight>0.0f) iconWidth=(bottom-top)*(iconWidth/iconHeight); /* Set allocation */ childRight=left+iconWidth; box=clutter_actor_box_new(floor(left), floor(top), floor(childRight), floor(bottom)); clutter_actor_allocate(CLUTTER_ACTOR(priv->actorPrimaryIcon), box, inFlags); clutter_actor_box_free(box); /* Adjust bounding box for next actor */ left=childRight+priv->spacing; } /* Set allocation of secondary icon if visible */ if(CLUTTER_ACTOR_IS_VISIBLE(priv->actorSecondaryIcon)) { gfloat childLeft; /* Get scale size of secondary icon */ iconWidth=0.0f; clutter_actor_get_size(priv->actorSecondaryIcon, &iconWidth, &iconHeight); if(iconHeight>0.0f) iconWidth=(bottom-top)*(iconWidth/iconHeight); /* Set allocation */ childLeft=right-iconWidth; box=clutter_actor_box_new(floor(childLeft), floor(top), floor(right), floor(bottom)); clutter_actor_allocate(CLUTTER_ACTOR(priv->actorSecondaryIcon), box, inFlags); clutter_actor_box_free(box); /* Adjust bounding box for next actor */ right=childLeft-priv->spacing; } /* Set allocation of editable text box if visible */ if(CLUTTER_ACTOR_IS_VISIBLE(priv->actorTextBox)) { gfloat textHeight; /* Get height of text */ clutter_actor_get_preferred_size(CLUTTER_ACTOR(priv->actorTextBox), NULL, NULL, NULL, &textHeight); /* Set allocation */ box=clutter_actor_box_new(floor(left), floor(bottom-textHeight), floor(right), floor(bottom)); clutter_actor_allocate(CLUTTER_ACTOR(priv->actorTextBox), box, inFlags); clutter_actor_box_free(box); } /* Set allocation of hint label if visible */ if(CLUTTER_ACTOR_IS_VISIBLE(priv->actorHintLabel)) { gfloat textHeight; /* Get height of label */ clutter_actor_get_preferred_size(CLUTTER_ACTOR(priv->actorHintLabel), NULL, NULL, NULL, &textHeight); /* Set allocation */ box=clutter_actor_box_new(floor(left), floor(bottom-textHeight), floor(right), floor(bottom)); clutter_actor_allocate(CLUTTER_ACTOR(priv->actorHintLabel), box, inFlags); clutter_actor_box_free(box); }}
开发者ID:tydaikho,项目名称:xfdashboard,代码行数:92,
示例17: on_stage_capturestatic gbooleanon_stage_capture (ClutterActor *actor, ClutterEvent *event, DropContext *context){ MxDroppable *droppable; MxDraggable *draggable; ClutterActor *target; gfloat event_x, event_y; gboolean draggable_reactive; if (!(event->type == CLUTTER_MOTION || event->type == CLUTTER_BUTTON_RELEASE)) return FALSE; draggable = g_object_get_data (G_OBJECT (actor), "mx-drag-actor"); if (G_UNLIKELY (draggable == NULL)) return FALSE; /* get the actor currently under the cursor; we set the draggable * unreactive so that it does not intefere with get_actor_at_pos(); * the paint that get_actor_at_pos() performs is in the back buffer * so the hide/show cycle will not be visible on screen */ clutter_event_get_coords (event, &event_x, &event_y); draggable_reactive = clutter_actor_get_reactive (CLUTTER_ACTOR (draggable)); clutter_actor_set_reactive (CLUTTER_ACTOR (draggable), FALSE); target = clutter_stage_get_actor_at_pos (CLUTTER_STAGE (actor), CLUTTER_PICK_REACTIVE, event_x, event_y); clutter_actor_set_reactive (CLUTTER_ACTOR (draggable), draggable_reactive); if (G_UNLIKELY (target == NULL)) return FALSE; droppable = NULL; if (!MX_IS_DROPPABLE (target)) { ClutterActor *parent = target; /* check if we're not on a child of a droppable */ while (parent != NULL) { parent = clutter_actor_get_parent (parent); if (parent != NULL && MX_IS_DROPPABLE (parent) && mx_droppable_accept_drop (MX_DROPPABLE (parent), draggable)) { droppable = MX_DROPPABLE (parent); break; } } } else { if (mx_droppable_accept_drop (MX_DROPPABLE (target), draggable)) droppable = MX_DROPPABLE (target); } /* we are on a new target, so emit ::over-out and unset the last target */ if (context->last_target && droppable != context->last_target) { g_signal_emit (context->last_target, droppable_signals[OVER_OUT], 0, draggable); context->last_target = NULL; return FALSE; } if (droppable == NULL) return FALSE; if (event->type == CLUTTER_MOTION) { if (context->last_target == NULL) { context->last_target = droppable; g_signal_emit (context->last_target, droppable_signals[OVER_IN], 0, draggable); } } else if (event->type == CLUTTER_BUTTON_RELEASE && context->last_target) { gfloat drop_x, drop_y; gboolean res; ClutterActor *last_target = CLUTTER_ACTOR (context->last_target); drop_x = drop_y = 0; res = clutter_actor_transform_stage_point (last_target, event_x, event_y, &drop_x, &drop_y); if (!res) return FALSE;//.........这里部分代码省略.........
开发者ID:3v1n0,项目名称:mx,代码行数:101,
示例18: mnb_zones_preview_completed_cbstatic voidmnb_zones_preview_completed_cb (ClutterAnimation *animation, MnbZonesPreview *preview){ MnbZonesPreviewPrivate *priv = preview->priv; switch (priv->anim_phase) { case MNB_ZP_STATIC: /* Start zooming out */ priv->anim_phase = MNB_ZP_ZOOM_OUT; mnb_zones_preview_enable_fanciness (preview, TRUE); clutter_actor_save_easing_state (CLUTTER_ACTOR(preview)); clutter_actor_set_easing_duration (CLUTTER_ACTOR(preview), 220); clutter_actor_set_easing_mode(CLUTTER_ACTOR(preview), CLUTTER_EASE_IN_SINE); clutter_actor_set_scale(CLUTTER_ACTOR(preview), 0.3f, 0.3f); clutter_actor_restore_easing_state (CLUTTER_ACTOR(preview)); break; case MNB_ZP_ZOOM_OUT: /* Start panning */ { guint duration = 175 * abs (priv->dest_workspace - priv->workspace); if (duration) { priv->anim_phase = MNB_ZP_PAN; clutter_actor_save_easing_state (CLUTTER_ACTOR(preview)); clutter_actor_set_easing_duration (CLUTTER_ACTOR(preview), duration); clutter_actor_set_easing_mode(CLUTTER_ACTOR(preview), CLUTTER_LINEAR); clutter_actor_set_scale(CLUTTER_ACTOR(preview), (gdouble)priv->dest_workspace, (gdouble)priv->dest_workspace); clutter_actor_restore_easing_state (CLUTTER_ACTOR(preview)); break; } /* If duration == 0, fall through here to the next phase*/ } case MNB_ZP_PAN: /* Start zooming in */ mnb_zones_preview_enable_fanciness (preview, FALSE); priv->anim_phase = MNB_ZP_ZOOM_IN; clutter_actor_save_easing_state (CLUTTER_ACTOR(preview)); clutter_actor_set_easing_duration (CLUTTER_ACTOR(preview), 250); clutter_actor_set_easing_mode(CLUTTER_ACTOR(preview), CLUTTER_EASE_OUT_CUBIC); clutter_actor_set_scale(CLUTTER_ACTOR(preview), 1.0f, 1.0f); clutter_actor_restore_easing_state (CLUTTER_ACTOR(preview)); break; case MNB_ZP_ZOOM_IN: /* Complete the animation */ priv->anim_phase = MNB_ZP_STATIC; g_signal_emit (preview, signals[SWITCH_COMPLETED], 0); return; default: g_warning (G_STRLOC ": This shouldn't happen"); return; } animation = clutter_actor_get_animation (CLUTTER_ACTOR (preview)); g_signal_connect_after (animation, "completed", G_CALLBACK (mnb_zones_preview_completed_cb), preview);}
开发者ID:dudochkin-victor,项目名称:mutter-netbook,代码行数:66,
示例19: data_device_start_dragstatic voiddata_device_start_drag (struct wl_client *client, struct wl_resource *resource, struct wl_resource *source_resource, struct wl_resource *origin_resource, struct wl_resource *icon_resource, guint32 serial){ MetaWaylandDataDevice *data_device = wl_resource_get_user_data (resource); MetaWaylandSeat *seat = wl_container_of (data_device, seat, data_device); MetaWaylandSurface *surface = NULL; MetaWaylandDragGrab *drag_grab; ClutterPoint pos; if (origin_resource) surface = wl_resource_get_user_data (origin_resource); if (!surface) return; if (seat->pointer.button_count == 0 || seat->pointer.grab_serial != serial || !seat->pointer.focus_surface || seat->pointer.focus_surface != surface) return; /* FIXME: Check that the data source type array isn't empty. */ if (data_device->current_grab || seat->pointer.grab != &seat->pointer.default_grab) return; data_device->current_grab = drag_grab = g_slice_new0 (MetaWaylandDragGrab); drag_grab->generic.interface = &drag_grab_interface; drag_grab->generic.pointer = &seat->pointer; drag_grab->drag_client = client; drag_grab->seat = seat; drag_grab->drag_origin = surface; drag_grab->drag_origin_listener.notify = destroy_data_device_origin; wl_resource_add_destroy_listener (origin_resource, &drag_grab->drag_origin_listener); clutter_input_device_get_coords (seat->pointer.device, NULL, &pos); clutter_actor_transform_stage_point (CLUTTER_ACTOR (meta_surface_actor_get_texture (surface->surface_actor)), pos.x, pos.y, &pos.x, &pos.y); drag_grab->drag_start_x = pos.x; drag_grab->drag_start_y = pos.y; if (source_resource) { drag_grab->drag_data_source = wl_resource_get_user_data (source_resource); drag_grab->drag_data_source_listener.notify = destroy_data_device_source; wl_resource_add_destroy_listener (source_resource, &drag_grab->drag_data_source_listener); } if (icon_resource) { drag_grab->drag_surface = wl_resource_get_user_data (icon_resource); drag_grab->drag_icon_listener.notify = destroy_data_device_icon; wl_resource_add_destroy_listener (icon_resource, &drag_grab->drag_icon_listener); drag_grab->feedback_actor = meta_dnd_actor_new (CLUTTER_ACTOR (drag_grab->drag_origin->surface_actor), drag_grab->drag_start_x, drag_grab->drag_start_y); meta_feedback_actor_set_anchor (META_FEEDBACK_ACTOR (drag_grab->feedback_actor), -drag_grab->drag_surface->offset_x, -drag_grab->drag_surface->offset_y); clutter_actor_add_child (drag_grab->feedback_actor, CLUTTER_ACTOR (drag_grab->drag_surface->surface_actor)); clutter_input_device_get_coords (seat->pointer.device, NULL, &pos); meta_feedback_actor_set_position (META_FEEDBACK_ACTOR (drag_grab->feedback_actor), pos.x, pos.y); } meta_wayland_pointer_set_focus (&seat->pointer, NULL); meta_wayland_pointer_start_grab (&seat->pointer, (MetaWaylandPointerGrab*)drag_grab);}
开发者ID:mvollmer,项目名称:mutter,代码行数:82,
示例20: _zeitgeist_log_find_received//.........这里部分代码省略......... g_hash_table_insert (priv->pointer_to_actor, sw_item, actor); /* Needed to remove from hash when we kill the actor */ g_object_set_data (G_OBJECT (actor), "data-pointer", sw_item); } sw_items_count -= _sw_item_weight (sw_item); clutter_container_child_set (CLUTTER_CONTAINER (pane), actor, "col-span", _sw_item_weight (sw_item), NULL); sw_items = g_list_remove (sw_items, sw_item); show_welcome_tile = FALSE; } else { /* Recent file item is newer */ actor = g_hash_table_lookup (priv->pointer_to_actor, recent_file_event); if (!actor) { const gchar *uri = NULL; gchar *thumbnail_path = NULL; ZeitgeistSubject *subj; /* FIXME we assume there is only one subject */ subj = zeitgeist_event_get_subject (recent_file_event, 0); uri = zeitgeist_subject_get_uri (subj); thumbnail_path = mpl_utils_get_thumbnail_path (uri); actor = _add_from_recent_file_event (pane, recent_file_event, thumbnail_path); g_free (thumbnail_path); g_hash_table_insert (priv->pointer_to_actor, recent_file_event, actor); /* Needed to remove from hash when we kill the actor */ g_object_set_data (G_OBJECT (actor), "data-pointer", recent_file_event); show_welcome_tile = FALSE; } recent_files_count--; g_object_unref (recent_file_event); recent_file_items = g_list_remove (recent_file_items, recent_file_event); } clutter_container_lower_child (CLUTTER_CONTAINER (pane), actor, NULL); old_actors = g_list_remove (old_actors, actor); } for (l = old_actors; l; l = l->next) { gpointer p; p = g_object_get_data (G_OBJECT (l->data), "data-pointer"); if (p) { clutter_container_remove_actor (CLUTTER_CONTAINER (pane), CLUTTER_ACTOR (l->data)); g_hash_table_remove (priv->pointer_to_actor, p); } } g_list_free (old_actors); if (show_welcome_tile && !priv->welcome_tile) { priv->welcome_tile = penge_welcome_tile_new (); clutter_container_add_actor (CLUTTER_CONTAINER (pane), priv->welcome_tile); clutter_container_child_set (CLUTTER_CONTAINER (pane), priv->welcome_tile, "col-span", 3, NULL); } g_list_free (sw_items); for (l = recent_file_items; l; l = l->next) { ZeitgeistEvent *recent_file_event = l->data; g_object_unref (recent_file_event); } g_list_free (recent_file_items);}
开发者ID:phmccarty,项目名称:dawati-shell,代码行数:101,
示例21: switch_workspacestatic voidswitch_workspace (MetaPlugin *plugin, gint from, gint to, MetaMotionDirection direction){ MetaScreen *screen; MetaDefaultPluginPrivate *priv = META_DEFAULT_PLUGIN (plugin)->priv; GList *l; ClutterActor *workspace0 = clutter_group_new (); ClutterActor *workspace1 = clutter_group_new (); ClutterActor *stage; int screen_width, screen_height; ClutterAnimation *animation; screen = meta_plugin_get_screen (plugin); stage = meta_get_stage_for_screen (screen); meta_screen_get_size (screen, &screen_width, &screen_height); clutter_actor_set_anchor_point (workspace1, screen_width, screen_height); clutter_actor_set_position (workspace1, screen_width, screen_height); clutter_actor_set_scale (workspace1, 0.0, 0.0); clutter_container_add_actor (CLUTTER_CONTAINER (stage), workspace1); clutter_container_add_actor (CLUTTER_CONTAINER (stage), workspace0); if (from == to) { meta_plugin_switch_workspace_completed (plugin); return; } l = g_list_last (meta_get_window_actors (screen)); while (l) { MetaWindowActor *window_actor = l->data; MetaWindow *window = meta_window_actor_get_meta_window (window_actor); MetaWorkspace *workspace; ActorPrivate *apriv = get_actor_private (window_actor); ClutterActor *actor = CLUTTER_ACTOR (window_actor); gint win_workspace; workspace = meta_window_get_workspace (window); win_workspace = meta_workspace_index (workspace); if (win_workspace == to || win_workspace == from) { apriv->orig_parent = clutter_actor_get_parent (actor); clutter_actor_reparent (actor, win_workspace == to ? workspace1 : workspace0); clutter_actor_show_all (actor); clutter_actor_raise_top (actor); } else if (win_workspace < 0) { /* Sticky window */ apriv->orig_parent = NULL; } else { /* Window on some other desktop */ clutter_actor_hide (actor); apriv->orig_parent = NULL; } l = l->prev; } priv->desktop1 = workspace0; priv->desktop2 = workspace1; animation = clutter_actor_animate (workspace0, CLUTTER_EASE_IN_SINE, SWITCH_TIMEOUT, "scale-x", 1.0, "scale-y", 1.0, NULL); priv->tml_switch_workspace1 = clutter_animation_get_timeline (animation); g_signal_connect (priv->tml_switch_workspace1, "completed", G_CALLBACK (on_switch_workspace_effect_complete), plugin); animation = clutter_actor_animate (workspace1, CLUTTER_EASE_IN_SINE, SWITCH_TIMEOUT, "scale-x", 0.0, "scale-y", 0.0, NULL); priv->tml_switch_workspace2 = clutter_animation_get_timeline (animation);}
开发者ID:bighead85,项目名称:budgie-desktop,代码行数:98,
示例22: clutter_flow_layout_allocatestatic voidclutter_flow_layout_allocate (ClutterLayoutManager *manager, ClutterContainer *container, const ClutterActorBox *allocation, ClutterAllocationFlags flags){ ClutterFlowLayoutPrivate *priv = CLUTTER_FLOW_LAYOUT (manager)->priv; ClutterActor *actor, *child; ClutterActorIter iter; gfloat x_off, y_off; gfloat avail_width, avail_height; gfloat item_x, item_y; gint line_item_count; gint items_per_line; gint line_index; actor = CLUTTER_ACTOR (container); if (clutter_actor_get_n_children (actor) == 0) return; clutter_actor_box_get_origin (allocation, &x_off, &y_off); clutter_actor_box_get_size (allocation, &avail_width, &avail_height); /* blow the cached preferred size and re-compute with the given * available size in case the FlowLayout wasn't given the exact * size it requested */ if ((priv->req_width >= 0 && avail_width != priv->req_width) || (priv->req_height >= 0 && avail_height != priv->req_height)) { clutter_flow_layout_get_preferred_width (manager, container, avail_height, NULL, NULL); clutter_flow_layout_get_preferred_height (manager, container, avail_width, NULL, NULL); } items_per_line = compute_lines (CLUTTER_FLOW_LAYOUT (manager), avail_width, avail_height); item_x = x_off; item_y = y_off; line_item_count = 0; line_index = 0; clutter_actor_iter_init (&iter, actor); while (clutter_actor_iter_next (&iter, &child)) { ClutterActorBox child_alloc; gfloat item_width, item_height; gfloat new_x, new_y; gfloat child_min, child_natural; if (!CLUTTER_ACTOR_IS_VISIBLE (child)) continue; new_x = new_y = 0; if (!priv->snap_to_grid) clutter_actor_get_preferred_size (child, NULL, NULL, &item_width, &item_height); if (priv->orientation == CLUTTER_FLOW_HORIZONTAL) { if ((priv->snap_to_grid && line_item_count == items_per_line && line_item_count > 0) || (!priv->snap_to_grid && item_x + item_width > avail_width)) { item_y += g_array_index (priv->line_natural, gfloat, line_index); if (line_index >= 0) item_y += priv->row_spacing; line_item_count = 0; line_index += 1; item_x = x_off; } if (priv->snap_to_grid) { new_x = x_off + ((line_item_count + 1) * (avail_width + priv->col_spacing)) / items_per_line; item_width = new_x - item_x - priv->col_spacing; } else { new_x = item_x + item_width + priv->col_spacing; } item_height = g_array_index (priv->line_natural, gfloat, line_index);//.........这里部分代码省略.........
开发者ID:ebassi,项目名称:clutter,代码行数:101,
示例23: map/* * Simple map handler: it applies a scale effect which must be reversed on * completion). */static voidmap (MetaPlugin *plugin, MetaWindowActor *window_actor){ MetaWindowType type; ClutterActor *actor = CLUTTER_ACTOR (window_actor); MetaWindow *meta_window = meta_window_actor_get_meta_window (window_actor); type = meta_window_get_window_type (meta_window); if (type == META_WINDOW_NORMAL || type == META_WINDOW_DIALOG || type == META_WINDOW_MODAL_DIALOG) { ClutterAnimation *animation; EffectCompleteData *data = g_new0 (EffectCompleteData, 1); ActorPrivate *apriv = get_actor_private (window_actor); clutter_actor_move_anchor_point_from_gravity (actor, CLUTTER_GRAVITY_CENTER); clutter_actor_set_scale (actor, MAP_SCALE, MAP_SCALE); clutter_actor_set_opacity (actor, 0); clutter_actor_show (actor); animation = clutter_actor_animate (actor, CLUTTER_EASE_IN_SINE, MAP_TIMEOUT, "scale-x", 1.0, "scale-y", 1.0, "opacity", 255, NULL); apriv->tml_map = clutter_animation_get_timeline (animation); data->actor = actor; data->plugin = plugin; g_signal_connect (apriv->tml_map, "completed", G_CALLBACK (on_map_effect_complete), data); apriv->is_minimized = FALSE; } else if (type == META_WINDOW_DOCK) { /* For context menus (popup/dropdown) we fade the menu in */ ClutterAnimation *animation; EffectCompleteData *data = g_new0 (EffectCompleteData, 1); ActorPrivate *apriv = get_actor_private (window_actor); clutter_actor_set_opacity (actor, 0); clutter_actor_show (actor); animation = clutter_actor_animate (actor, CLUTTER_EASE_IN_SINE, MAP_TIMEOUT, "opacity", 255, NULL); apriv->tml_map = clutter_animation_get_timeline (animation); data->actor = actor; data->plugin = plugin; g_signal_connect (apriv->tml_map, "completed", G_CALLBACK (on_map_effect_complete), data); apriv->is_minimized = FALSE; } else meta_plugin_map_completed (plugin, window_actor);}
开发者ID:bighead85,项目名称:budgie-desktop,代码行数:68,
示例24: container_real_removestatic voidcontainer_real_remove (ClutterContainer *container, ClutterActor *actor){ clutter_actor_remove_child (CLUTTER_ACTOR (container), actor);}
开发者ID:jigpu,项目名称:clutter,代码行数:6,
示例25: meta_window_group_paintstatic voidmeta_window_group_paint (ClutterActor *actor){ cairo_region_t *visible_region; ClutterActor *stage; cairo_rectangle_int_t visible_rect; GList *children, *l; int paint_x_origin, paint_y_origin; int actor_x_origin, actor_y_origin; int paint_x_offset, paint_y_offset; MetaWindowGroup *window_group = META_WINDOW_GROUP (actor); MetaCompScreen *info = meta_screen_get_compositor_data (window_group->screen); /* Normally we expect an actor to be drawn at it's position on the screen. * However, if we're inside the paint of a ClutterClone, that won't be the * case and we need to compensate. We look at the position of the window * group under the current model-view matrix and the position of the actor. * If they are both simply integer translations, then we can compensate * easily, otherwise we give up. * * Possible cleanup: work entirely in paint space - we can compute the * combination of the model-view matrix with the local matrix for each child * actor and get a total transformation for that actor for how we are * painting currently, and never worry about how actors are positioned * on the stage. */ if (!painting_untransformed (window_group, &paint_x_origin, &paint_y_origin) || !meta_actor_is_untransformed (actor, &actor_x_origin, &actor_y_origin)) { CLUTTER_ACTOR_CLASS (meta_window_group_parent_class)->paint (actor); return; } paint_x_offset = paint_x_origin - actor_x_origin; paint_y_offset = paint_y_origin - actor_y_origin; /* We walk the list from top to bottom (opposite of painting order), * and subtract the opaque area of each window out of the visible * region that we pass to the windows below. */ children = clutter_actor_get_children (actor); children = g_list_reverse (children); /* Get the clipped redraw bounds from Clutter so that we can avoid * painting shadows on windows that don't need to be painted in this * frame. In the case of a multihead setup with mismatched monitor * sizes, we could intersect this with an accurate union of the * monitors to avoid painting shadows that are visible only in the * holes. */ stage = clutter_actor_get_stage (actor); clutter_stage_get_redraw_clip_bounds (CLUTTER_STAGE (stage), &visible_rect); visible_region = cairo_region_create_rectangle (&visible_rect); if (info->unredirected_window != NULL) { cairo_rectangle_int_t unredirected_rect; MetaWindow *window = meta_window_actor_get_meta_window (info->unredirected_window); meta_window_get_outer_rect (window, (MetaRectangle *)&unredirected_rect); cairo_region_subtract_rectangle (visible_region, &unredirected_rect); } for (l = children; l; l = l->next) { if (!CLUTTER_ACTOR_IS_VISIBLE (l->data)) continue; if (l->data == info->unredirected_window) continue; /* If an actor has effects applied, then that can change the area * it paints and the opacity, so we no longer can figure out what * portion of the actor is obscured and what portion of the screen * it obscures, so we skip the actor. * * This has a secondary beneficial effect: if a ClutterOffscreenEffect * is applied to an actor, then our clipped redraws interfere with the * caching of the FBO - even if we only need to draw a small portion * of the window right now, ClutterOffscreenEffect may use other portions * of the FBO later. So, skipping actors with effects applied also * prevents these bugs. * * Theoretically, we should check clutter_actor_get_offscreen_redirect() * as well for the same reason, but omitted for simplicity in the * hopes that no-one will do that. */ if (clutter_actor_has_effects (l->data)) continue; if (META_IS_WINDOW_ACTOR (l->data)) { MetaWindowActor *window_actor = l->data; int x, y; if (!meta_actor_is_untransformed (CLUTTER_ACTOR (window_actor), &x, &y)) continue;//.........这里部分代码省略.........
开发者ID:CSRedRat,项目名称:mutter,代码行数:101,
示例26: _xfdashboard_application_command_line//.........这里部分代码省略......... } /* Handle options: quit */ if(optionQuit) { /* Quit existing instance */ g_debug("Quitting running instance!"); _xfdashboard_application_quit(self, TRUE); /* Release allocated resources */ if(optionSwitchToView) g_free(optionSwitchToView); return(XFDASHBOARD_APPLICATION_ERROR_QUIT); } /* Handle options: toggle * - If application was not inited yet, perform normal start-up as usual * with command-line options given * - If running in daemon mode, resume if suspended otherwise suspend * - If not running in daemon mode, quit application */ if(priv->inited && optionToggle) { /* If application is running in daemon mode, toggle between suspend/resume ... */ if(priv->isDaemon) { if(priv->isSuspended) { /* Switch to view if requested */ _xfdashboard_application_switch_to_view(self, optionSwitchToView); /* Show application again */ _xfdashboard_application_activate(inApplication); } else { /* Hide application */ _xfdashboard_application_quit(self, FALSE); } } /* ... otherwise if not running in daemon mode, just quit */ else { /* Hide application */ _xfdashboard_application_quit(self, FALSE); } /* Release allocated resources */ if(optionSwitchToView) g_free(optionSwitchToView); /* Stop here because option was handled and application does not get initialized */ return(XFDASHBOARD_APPLICATION_ERROR_NONE); } /* Handle options: daemonize */ if(!priv->inited) { priv->isDaemon=optionDaemonize; g_object_notify_by_pspec(G_OBJECT(self), XfdashboardApplicationProperties[PROP_DAEMONIZED]); if(priv->isDaemon) { priv->isSuspended=TRUE; g_object_notify_by_pspec(G_OBJECT(self), XfdashboardApplicationProperties[PROP_SUSPENDED]); } } /* Check if this instance needs to be initialized fully */ if(!priv->inited) { /* Perform full initialization of this application instance */ result=_xfdashboard_application_initialize_full(self, &stage); if(result==FALSE) return(XFDASHBOARD_APPLICATION_ERROR_FAILED); /* Switch to view if requested */ _xfdashboard_application_switch_to_view(self, optionSwitchToView); /* Show application if not started daemonized */ if(!priv->isDaemon) clutter_actor_show(CLUTTER_ACTOR(stage)); } /* Check if this instance need to be activated. Is should only be done * if instance is initialized */ if(priv->inited) { /* Switch to view if requested */ _xfdashboard_application_switch_to_view(self, optionSwitchToView); /* Show application */ _xfdashboard_application_activate(inApplication); } /* Release allocated resources */ if(optionSwitchToView) g_free(optionSwitchToView); /* All done successfully so return status code 0 for success */ priv->inited=TRUE; return(XFDASHBOARD_APPLICATION_ERROR_NONE);}
开发者ID:Zeioth,项目名称:xfdashboard,代码行数:101,
示例27: xfdashboard_text_box_set_selection_background_colorvoid xfdashboard_text_box_set_selection_background_color(XfdashboardTextBox *self, const ClutterColor *inColor){ XfdashboardTextBoxPrivate *priv; ClutterColor selectionColor; g_return_if_fail(XFDASHBOARD_IS_TEXT_BOX(self)); priv=self->priv; /* Set value if changed */ if(priv->selectionBackgroundColor!=inColor || (priv->selectionBackgroundColor && inColor && !clutter_color_equal(inColor, priv->selectionBackgroundColor))) { /* Freeze notifications and collect them */ g_object_freeze_notify(G_OBJECT(self)); /* Release old color */ if(priv->selectionBackgroundColor) { clutter_color_free(priv->selectionBackgroundColor); priv->selectionBackgroundColor=NULL; /* Check if any selection color is set */ priv->selectionColorSet=((priv->selectionTextColor && priv->selectionBackgroundColor) ? TRUE : FALSE); /* Notify about property change */ g_object_notify_by_pspec(G_OBJECT(self), XfdashboardTextBoxProperties[PROP_SELECTION_BACKGROUND_COLOR]); } /* Set new color if available */ if(inColor) { priv->selectionBackgroundColor=clutter_color_copy(inColor); clutter_text_set_selection_color(CLUTTER_TEXT(priv->actorTextBox), priv->selectionBackgroundColor); /* Any selection color was set */ priv->selectionColorSet=TRUE; /* Notify about property change */ g_object_notify_by_pspec(G_OBJECT(self), XfdashboardTextBoxProperties[PROP_SELECTION_BACKGROUND_COLOR]); } /* Selection text and background color is inverted text color if not set */ if(!priv->selectionColorSet) { selectionColor.red=0xff-priv->textColor->red; selectionColor.green=0xff-priv->textColor->green; selectionColor.blue=0xff-priv->textColor->blue; selectionColor.alpha=priv->textColor->alpha; clutter_text_set_selected_text_color(CLUTTER_TEXT(priv->actorTextBox), &selectionColor); /* Selection color is the same as text color */ clutter_text_set_selection_color(CLUTTER_TEXT(priv->actorTextBox), priv->textColor); } /* Redraw actor in new color */ clutter_actor_queue_redraw(CLUTTER_ACTOR(self)); /* Thaw notifications and send them now */ g_object_thaw_notify(G_OBJECT(self)); }}
开发者ID:tydaikho,项目名称:xfdashboard,代码行数:64,
示例28: st_scroll_bar_initstatic voidst_scroll_bar_init (StScrollBar *self){ self->priv = ST_SCROLL_BAR_GET_PRIVATE (self); self->priv->bw_stepper = (ClutterActor *) st_button_new (); clutter_actor_set_name (CLUTTER_ACTOR (self->priv->bw_stepper), "backward-stepper"); clutter_actor_set_parent (CLUTTER_ACTOR (self->priv->bw_stepper), CLUTTER_ACTOR (self)); g_signal_connect (self->priv->bw_stepper, "button-press-event", G_CALLBACK (stepper_button_press_event_cb), self); g_signal_connect (self->priv->bw_stepper, "button-release-event", G_CALLBACK (stepper_button_release_cb), self); self->priv->fw_stepper = (ClutterActor *) st_button_new (); clutter_actor_set_name (CLUTTER_ACTOR (self->priv->fw_stepper), "forward-stepper"); clutter_actor_set_parent (CLUTTER_ACTOR (self->priv->fw_stepper), CLUTTER_ACTOR (self)); g_signal_connect (self->priv->fw_stepper, "button-press-event", G_CALLBACK (stepper_button_press_event_cb), self); g_signal_connect (self->priv->fw_stepper, "button-release-event", G_CALLBACK (stepper_button_release_cb), self); self->priv->trough = (ClutterActor *) st_bin_new (); clutter_actor_set_reactive ((ClutterActor *) self->priv->trough, TRUE); clutter_actor_set_name (CLUTTER_ACTOR (self->priv->trough), "trough"); clutter_actor_set_parent (CLUTTER_ACTOR (self->priv->trough), CLUTTER_ACTOR (self)); g_signal_connect (self->priv->trough, "button-press-event", G_CALLBACK (trough_button_press_event_cb), self); g_signal_connect (self->priv->trough, "button-release-event", G_CALLBACK (trough_button_release_event_cb), self); g_signal_connect (self->priv->trough, "leave-event", G_CALLBACK (trough_leave_event_cb), self); self->priv->handle = (ClutterActor *) st_button_new (); clutter_actor_set_name (CLUTTER_ACTOR (self->priv->handle), "hhandle"); clutter_actor_set_parent (CLUTTER_ACTOR (self->priv->handle), self->priv->trough); g_signal_connect (self->priv->handle, "button-press-event", G_CALLBACK (handle_button_press_event_cb), self); clutter_actor_set_reactive (CLUTTER_ACTOR (self), TRUE); g_signal_connect (self, "notify::reactive", G_CALLBACK (st_scroll_bar_notify_reactive), NULL);}
开发者ID:Jem777,项目名称:Cinnamon,代码行数:49,
示例29: mainintmain (int argc, char **argv){ ClutterActor *stage; MxBoxLayout *vbox; MxBoxLayout *hbox; ClutterActor *button; ClutterActor *label; ObjectStoreTest app = { 0, }; clutter_init (&argc, &argv); stage = clutter_stage_get_default (); clutter_actor_set_size (stage, 320.0, 240.0); vbox = (MxBoxLayout *) mx_box_layout_new (); clutter_actor_set_size (CLUTTER_ACTOR (vbox), 320.0, 240.0); mx_box_layout_set_orientation (vbox, MX_ORIENTATION_VERTICAL); clutter_container_add_actor (CLUTTER_CONTAINER (stage), CLUTTER_ACTOR (vbox)); /* Create model */ app.store = foo_object_store_new (2, FOO_TYPE_TEST_OBJECT, "foo", /* column #0 */ G_TYPE_STRING, "text"); /* column #1 */ /* * Create view */ app.view = mx_list_view_new (); /* Use MxButton to render the model's items */ mx_list_view_set_item_type (MX_LIST_VIEW (app.view), MX_TYPE_BUTTON); /* Map column #1 to attribute "label" of view's GtkButton */ mx_list_view_add_attribute (MX_LIST_VIEW (app.view), "label", 1); /* Connect to model */ mx_list_view_set_model (MX_LIST_VIEW (app.view), app.store); mx_box_layout_add_actor_with_properties (vbox, app.view, -1, "expand", true, "x-fill", true, "y-fill", true, NULL); hbox = (MxBoxLayout *) mx_box_layout_new (); mx_box_layout_set_orientation (hbox, MX_ORIENTATION_HORIZONTAL); mx_box_layout_add_actor_with_properties (vbox, CLUTTER_ACTOR (hbox), -1, "expand", false, "x-fill", true, NULL); app.entry = (MxEntry *) mx_entry_new (); mx_box_layout_add_actor_with_properties (hbox, CLUTTER_ACTOR (app.entry), -1, "expand", true, "x-fill", true, NULL); button = mx_button_new_with_label ("Update"); g_signal_connect (button, "clicked", G_CALLBACK (_update_clicked), &app); clutter_container_add_actor (CLUTTER_CONTAINER (hbox), button); button = mx_button_new_with_label ("Dump"); g_signal_connect (button, "clicked", G_CALLBACK (_dump_clicked), &app); clutter_container_add_actor (CLUTTER_CONTAINER (hbox), button); label = mx_label_new_with_text ("Enter text and update to add item/n" "Enter <number>:<text> to change item <number>/n" "Enter -<number> to delete item <number>"); clutter_container_add_actor (CLUTTER_CONTAINER (vbox), label); clutter_actor_show_all (stage); clutter_main (); return EXIT_SUCCESS;}
开发者ID:UIKit0,项目名称:toys,代码行数:79,
注:本文中的CLUTTER_ACTOR函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ CLUTTER_ACTOR_CLASS函数代码示例 C++ CLStatus函数代码示例 |