Пример #1
0
GtkWidget*		ly_3shr_create			()
{
	GtkWidget *widget;
	ClutterActor *stage;
	widget=gtk_clutter_embed_new();
	stage=gtk_clutter_embed_get_stage(GTK_CLUTTER_EMBED(widget));

	ClutterActor *list;
	list=mx_list_view_new();


}
Пример #2
0
int
main (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;
}
Пример #3
0
static void
construct_completion (MnpWorldClock *world_clock)
{
    const ClutterColor transparent = { 0x00, 0x00, 0x00, 0x00 };

    ClutterActor *frame, *scroll, *view, *stage;
    MnpWorldClockPrivate *priv = GET_PRIVATE (world_clock);
    ClutterModel *model;
    MnpButtonItem *button_item;

    stage = priv->stage;

    /* Create an event-box to capture input when the completion list
     * displays.
     */
    priv->event_box = clutter_rectangle_new_with_color (&transparent);
    clutter_actor_set_size (priv->event_box,
                            clutter_actor_get_width (stage),
                            clutter_actor_get_height (stage));
    clutter_container_add_actor (CLUTTER_CONTAINER (stage),
                                 priv->event_box);
    clutter_actor_set_reactive (priv->event_box, TRUE);
    clutter_actor_hide (priv->event_box);
    g_signal_connect (priv->event_box, "button-press-event",
                      G_CALLBACK (event_box_clicked_cb), world_clock);

    if (!priv->zones_model) {
        model = mnp_get_world_timezones ();
        priv->zones_model = model;
    } else
        model = priv->zones_model;

    clutter_model_set_filter (model, filter_zone, world_clock, NULL);
    priv->search_text = "asd";

    frame = mx_frame_new ();
    clutter_actor_set_name (frame, "CompletionFrame");
    mx_bin_set_fill (MX_BIN (frame), TRUE, TRUE);

    scroll = mx_scroll_view_new ();
    clutter_actor_set_name (scroll, "CompletionScrollView");
    g_object_set (G_OBJECT (scroll), "clip-to-allocation", TRUE, NULL);
    clutter_actor_set_size (scroll, -1, 300);
    mx_bin_set_child (MX_BIN (frame), scroll);
    clutter_container_add_actor ((ClutterContainer *)stage, frame);
    clutter_actor_raise_top((ClutterActor *) frame);
    clutter_actor_set_position (frame, 14, 167);
    clutter_actor_hide (frame);

    priv->completion = frame;
    g_signal_connect (priv->completion, "show",
                      G_CALLBACK (completion_show_cb), world_clock);
    g_signal_connect (priv->completion, "hide",
                      G_CALLBACK (completion_hide_cb), world_clock);

    view = mx_list_view_new ();
    clutter_actor_set_name (view, "CompletionListView");
    priv->zones_list = (MxListView *)view;

    clutter_container_add_actor (CLUTTER_CONTAINER (scroll), view);
    mx_list_view_set_model (MX_LIST_VIEW (view), model);

    button_item = mnp_button_item_new ((gpointer)world_clock, mnp_completion_done);
    mx_list_view_set_factory (MX_LIST_VIEW (view), (MxItemFactory *)button_item);
    mx_list_view_add_attribute (MX_LIST_VIEW (view), "label", 0);
}