static void mpl_application_view_init (MplApplicationView *self) { MplApplicationViewPrivate *priv; ClutterActor *actor = CLUTTER_ACTOR (self); priv = self->priv = APPLICATION_VIEW_PRIVATE (self); /* tile */ clutter_actor_set_reactive (actor, TRUE); mx_stylable_set_style_class (MX_STYLABLE (actor), "switcherTile"); clutter_actor_set_size (actor, TILE_WIDTH, TILE_HEIGHT); g_signal_connect (self, "button-release-event", G_CALLBACK (activate_clicked), NULL); priv->title_box = mx_box_layout_new_with_orientation (MX_ORIENTATION_VERTICAL); clutter_actor_set_parent (priv->title_box, actor); /* title */ priv->title = mx_label_new (); mx_label_set_y_align (MX_LABEL (priv->title), MX_ALIGN_MIDDLE); mx_stylable_set_style_class (MX_STYLABLE (priv->title), "appTitle"); mx_box_layout_add_actor (MX_BOX_LAYOUT (priv->title_box), priv->title, 0); mx_box_layout_child_set_expand (MX_BOX_LAYOUT (priv->title_box), priv->title, TRUE); /* subtitle */ priv->subtitle = mx_label_new (); mx_label_set_y_align (MX_LABEL (priv->subtitle), MX_ALIGN_MIDDLE); mx_stylable_set_style_class (MX_STYLABLE (priv->subtitle), "appSubTitle"); mx_box_layout_add_actor (MX_BOX_LAYOUT (priv->title_box), priv->subtitle, 1); mx_box_layout_child_set_expand (MX_BOX_LAYOUT (priv->title_box), priv->subtitle, FALSE); /* close button */ priv->close_button = mx_button_new (); mx_stylable_set_style_class (MX_STYLABLE (priv->close_button), "appCloseButton"); clutter_actor_set_parent (priv->close_button, actor); g_signal_connect (priv->close_button, "clicked", G_CALLBACK (close_btn_clicked), self); /* frame */ priv->app_frame = mx_frame_new (); clutter_actor_set_size (priv->app_frame, 250, 100); mx_stylable_set_style_class (MX_STYLABLE (priv->app_frame), "appBackground"); clutter_actor_set_parent (priv->app_frame, actor); /* shadow */ priv->shadow = mx_frame_new (); mx_stylable_set_style_class (MX_STYLABLE (priv->shadow), "appShadow"); mx_bin_set_child (MX_BIN (priv->app_frame), priv->shadow); mx_bin_set_fill (MX_BIN (priv->app_frame), FALSE, FALSE); clutter_actor_show_all (actor); }
static void startup_cb (MxApplication *application) { MxWindow *window; ClutterActor *scroll, *child; gint i; window = mx_application_create_window (application, "Test Widgets"); /* Create scroll view */ scroll = mx_kinetic_scroll_view_new (); mx_kinetic_scroll_view_set_use_grab (MX_KINETIC_SCROLL_VIEW (scroll), TRUE); mx_kinetic_scroll_view_set_mouse_button (MX_KINETIC_SCROLL_VIEW (scroll), 3); clutter_actor_set_clip_to_allocation (scroll, TRUE); child = mx_box_layout_new_with_orientation (MX_ORIENTATION_VERTICAL); for (i = 0; i < 10000; i++) { ClutterActor *layout, *label, *icon; gchar *s = g_strdup_printf ("Row %d", i); layout = mx_box_layout_new_with_orientation (MX_ORIENTATION_HORIZONTAL); label = mx_label_new_with_text (s); clutter_actor_add_child (layout, label); g_free (s); icon = mx_icon_new (); mx_icon_set_icon_name (MX_ICON (icon), "object-rotate-left"); mx_icon_set_icon_size (MX_ICON (icon), 32); clutter_actor_add_child (layout, icon); clutter_actor_add_child (child, layout); } clutter_actor_add_child (scroll, child); mx_window_set_child (window, scroll); /* show the window */ mx_window_set_has_toolbar (window, FALSE); mx_window_show (window); }