static ClutterActor * mex_menu_create_layout (MexMenu *menu, gboolean lower) { ClutterActor *layout, *scroll; MexMenuPrivate *priv = menu->priv; layout = mx_box_layout_new (); if (priv->min_width >= 0) g_object_set (G_OBJECT (layout), "min-width", priv->min_width, NULL); mx_box_layout_set_orientation (MX_BOX_LAYOUT (layout), MX_ORIENTATION_VERTICAL); mx_stylable_set_style_class (MX_STYLABLE (layout), "Menu"); clutter_container_add_actor (CLUTTER_CONTAINER (menu), layout); priv->action_layout = mx_box_layout_new (); mx_box_layout_set_orientation (MX_BOX_LAYOUT (priv->action_layout), MX_ORIENTATION_VERTICAL); scroll = mex_scroll_view_new (); clutter_container_add_actor (CLUTTER_CONTAINER (scroll), priv->action_layout); clutter_container_add_actor (CLUTTER_CONTAINER (layout), scroll); g_object_set_data (G_OBJECT (layout), "action-layout", priv->action_layout); return layout; }
static void mex_column_view_init (MexColumnView *self) { MexColumnViewPrivate *priv = self->priv = COLUMN_VIEW_PRIVATE (self); /* Begin private children */ clutter_actor_push_internal (CLUTTER_ACTOR (self)); /* Create the header */ priv->header = mx_box_layout_new (); mx_box_layout_set_orientation ((MxBoxLayout *) priv->header, MX_ORIENTATION_HORIZONTAL); clutter_actor_push_internal (CLUTTER_ACTOR (self)); clutter_actor_set_parent (priv->header, CLUTTER_ACTOR (self)); clutter_actor_pop_internal (CLUTTER_ACTOR (self)); priv->button = mx_button_new (); mx_stylable_set_style_class (MX_STYLABLE (priv->button), "Header"); priv->label = mx_label_new (); g_object_set (priv->label, "clip-to-allocation", TRUE, "fade-out", TRUE, NULL); clutter_actor_add_child (CLUTTER_ACTOR (priv->button), priv->label); clutter_actor_add_child (priv->header, priv->button); clutter_container_child_set (CLUTTER_CONTAINER (priv->header), priv->button, "expand", TRUE, "x-fill", TRUE, "x-align", MX_ALIGN_START, "y-fill", TRUE, NULL); g_signal_connect (priv->button, "clicked", G_CALLBACK (mex_column_header_clicked_cb), self); priv->scroll = mex_scroll_view_new (); mx_kinetic_scroll_view_set_scroll_policy (MX_KINETIC_SCROLL_VIEW (priv->scroll), MX_SCROLL_POLICY_VERTICAL); mex_scroll_view_set_indicators_hidden (MEX_SCROLL_VIEW (priv->scroll), TRUE); clutter_actor_set_parent (priv->scroll, CLUTTER_ACTOR (self)); priv->column = mex_column_new (); clutter_actor_add_child (CLUTTER_ACTOR (priv->scroll), priv->column); g_signal_connect (priv->column, "notify::opened", G_CALLBACK (mex_column_view_opened_cb), self); /* End of private children */ clutter_actor_pop_internal (CLUTTER_ACTOR (self)); /* Set the column as reactive and enable collapsing */ clutter_actor_set_reactive (CLUTTER_ACTOR (self), TRUE); }
static void mex_grid_view_init (MexGridView *self) { MexGridViewPrivate *priv = self->priv = GRID_VIEW_PRIVATE (self); ClutterActor *scroll_view; priv->state = STATE_CLOSED; /* Create the menu */ priv->menu_layout = mex_menu_new (); mex_resizing_hbox_set_max_depth (MEX_RESIZING_HBOX (priv->menu_layout), 1); /* Add a title/icon */ priv->menu_title = mx_label_new (); mx_stylable_set_style_class (MX_STYLABLE (priv->menu_title), "Header"); clutter_actor_set_name (priv->menu_title, "menu-header"); priv->menu = (ClutterActor*) mex_menu_get_layout (MEX_MENU (priv->menu_layout)); clutter_actor_set_width (priv->menu, MENU_MIN_WIDTH); clutter_actor_insert_child_at_index (priv->menu, priv->menu_title, 0); /* Add the grid */ priv->grid_layout = mx_box_layout_new (); mx_box_layout_set_orientation (MX_BOX_LAYOUT (priv->grid_layout), MX_ORIENTATION_VERTICAL); /* header */ priv->grid_title = mx_label_new (); mx_stylable_set_style_class (MX_STYLABLE (priv->grid_title), "Header"); clutter_actor_add_child (priv->grid_layout, priv->grid_title); /* scroll view */ scroll_view = mex_scroll_view_new (); mx_kinetic_scroll_view_set_scroll_policy (MX_KINETIC_SCROLL_VIEW (scroll_view), MX_SCROLL_POLICY_VERTICAL); mx_stylable_set_style_class (MX_STYLABLE (scroll_view), "Grid"); mx_box_layout_insert_actor_with_properties (MX_BOX_LAYOUT (priv->grid_layout), scroll_view, 1, "expand", TRUE, NULL); /* grid */ priv->grid = mex_grid_new (); mx_bin_set_child (MX_BIN (scroll_view), priv->grid); clutter_actor_set_opacity (priv->grid, 0); /* Name actors so we can style */ clutter_actor_set_name (CLUTTER_ACTOR (self), "grid-page"); clutter_actor_set_name (priv->grid_layout, "content"); clutter_actor_push_internal (CLUTTER_ACTOR (self)); clutter_actor_set_parent (priv->menu_layout, CLUTTER_ACTOR (self)); clutter_actor_set_parent (priv->grid_layout, CLUTTER_ACTOR (self)); clutter_actor_pop_internal (CLUTTER_ACTOR (self)); /* timeline for animations */ priv->timeline = clutter_timeline_new (ANIMATION_DURATION); priv->alpha = clutter_alpha_new_full (priv->timeline, CLUTTER_EASE_IN_OUT_CUBIC); g_signal_connect (priv->timeline, "new-frame", G_CALLBACK (mex_grid_view_timeline_cb), self); g_signal_connect (priv->timeline, "completed", G_CALLBACK (mex_grid_view_timeline_complete_cb), self); }