Exemplo n.º 1
0
void new_song_dialog(void)
{
	struct dialog *dialog;

	/* only create everything if it hasn't been set up already */
	if (new_song_widgets[0].width == 0) {
		create_togglebutton(new_song_widgets + 0, 35, 24, 6, 0, 2, 1, 1, 1, NULL, "Keep",
				    2, new_song_groups[0]);
		create_togglebutton(new_song_widgets + 1, 45, 24, 7, 1, 3, 0, 0, 0, NULL, "Clear",
				    2, new_song_groups[0]);
		create_togglebutton(new_song_widgets + 2, 35, 27, 6, 0, 4, 3, 3, 3, NULL, "Keep",
				    2, new_song_groups[1]);
		create_togglebutton(new_song_widgets + 3, 45, 27, 7, 1, 5, 2, 2, 2, NULL, "Clear",
				    2, new_song_groups[1]);
		create_togglebutton(new_song_widgets + 4, 35, 30, 6, 2, 6, 5, 5, 5, NULL, "Keep",
				    2, new_song_groups[2]);
		create_togglebutton(new_song_widgets + 5, 45, 30, 7, 3, 7, 4, 4, 4, NULL, "Clear",
				    2, new_song_groups[2]);
		create_togglebutton(new_song_widgets + 6, 35, 33, 6, 4, 8, 7, 7, 7, NULL, "Keep",
				    2, new_song_groups[3]);
		create_togglebutton(new_song_widgets + 7, 45, 33, 7, 5, 9, 6, 6, 6, NULL, "Clear",
				    2, new_song_groups[3]);
		create_button(new_song_widgets + 8, 28, 36, 8, 6, 8, 9, 9, 9, dialog_yes_NULL, "OK", 4);
		create_button(new_song_widgets + 9, 41, 36, 8, 6, 9, 8, 8, 8, dialog_cancel_NULL, "Cancel", 2);
		togglebutton_set(new_song_widgets, 1, 0);
		togglebutton_set(new_song_widgets, 3, 0);
		togglebutton_set(new_song_widgets, 5, 0);
		togglebutton_set(new_song_widgets, 7, 0);
	}

	dialog = dialog_create_custom(21, 20, 38, 19, new_song_widgets, 10, 8, new_song_draw_const, NULL);
	dialog->action_yes = new_song_ok;
}
Exemplo n.º 2
0
void 
shelm_clock_dialog(const char *window_title, const char *window_text, int window_width, int window_height, const char *window_background, Eina_Bool show_seconds, Eina_Bool show_am_pm, const char *time, Eina_Bool is_editable)
{
  Evas_Object *window, *background, *frame, *box, *clock, *buttonbar, *button_cancel, *button_ok;
  char buf[PATH_MAX];

  if (window_title)
    window = create_window("shellementary-clockdialog", window_title, cancel_callback);
  else
    window = create_window("shellementary-clockdialog", _("Set the time"), cancel_callback);

  background = create_background(window, window_background, EINA_TRUE);
  elm_win_resize_object_add(window, background);
  evas_object_show(background);

  frame = create_frame(window, EINA_TRUE);
  elm_win_resize_object_add(window, frame);
  evas_object_show(frame);

  box = create_box(window, EINA_FALSE);
  elm_object_content_set(frame, box);
  evas_object_show(box);

  if (window_text)
    {
      Evas_Object *label;
      label = create_label(window, window_text);
      elm_box_pack_end(box, label);
      evas_object_show(label);
    }

  clock = create_clock(window, show_seconds, show_am_pm, time, is_editable);
  elm_box_pack_end(box, clock);
  evas_object_show(clock);

  buttonbar = create_box(window, EINA_TRUE);
  elm_box_pack_end(box, buttonbar);
  evas_object_show(buttonbar);

  snprintf(buf, sizeof(buf), "%s/icon-cancel.png", PACKAGE_DATA_DIR);
  button_cancel = create_button(window, buf, _("Cancel"));
  evas_object_smart_callback_add(button_cancel, "clicked", cancel_callback, NULL);
  elm_box_pack_start(buttonbar, button_cancel);
  evas_object_show(button_cancel);

  snprintf(buf, sizeof(buf), "%s/icon-ok.png", PACKAGE_DATA_DIR);
  button_ok = create_button(window, buf, _("OK"));
  evas_object_smart_callback_add(button_ok, "clicked", clock_callback, clock);
  elm_box_pack_end(buttonbar, button_ok);
  evas_object_show(button_ok);

  if (!window_width)
    evas_object_geometry_get(window, NULL, NULL, &window_width, NULL);
  if (!window_height)
    evas_object_geometry_get(window, NULL, NULL, NULL, &window_height);

  evas_object_resize(window, window_width, window_height);

  evas_object_show(window);
}
Exemplo n.º 3
0
int main(int argc, char *argv[])
{
	if (argc >= 2) {
		window_t *main_window = window_open(argv[1], NULL,
		    WINDOW_MAIN | WINDOW_DECORATED | WINDOW_RESIZEABLE, "vdemo");
		if (!main_window) {
			printf("Cannot open main window.\n");
			return 1;
		}

		pixel_t grd_bg = PIXEL(255, 240, 240, 240);
		
		pixel_t btn_bg = PIXEL(255, 240, 240, 240);
		pixel_t btn_fg = PIXEL(255, 186, 186, 186);
		pixel_t btn_text = PIXEL(255, 0, 0, 0);
		
		pixel_t lbl_bg = PIXEL(255, 240, 240, 240);
		pixel_t lbl_text = PIXEL(255, 0, 0, 0);

		my_label_t *lbl_action = create_my_label(NULL, "Hello there!", 16,
		    lbl_bg, lbl_text);
		button_t *btn_confirm = create_button(NULL, NULL, "Confirm", 16,
		    btn_bg, btn_fg, btn_text);
		button_t *btn_cancel = create_button(NULL, NULL, "Cancel", 16,
		    btn_bg, btn_fg, btn_text);
		grid_t *grid = create_grid(window_root(main_window), NULL, 2, 2,
		    grd_bg);
		if (!lbl_action || !btn_confirm || !btn_cancel || !grid) {
			window_close(main_window);
			printf("Cannot create widgets.\n");
			return 1;
		}

		sig_connect(
		    &btn_confirm->clicked,
		    &lbl_action->label.widget,
		    lbl_action->confirm);
		sig_connect(
		    &btn_cancel->clicked,
		    &lbl_action->label.widget,
		    lbl_action->cancel);

		grid->add(grid, &lbl_action->label.widget, 0, 0, 2, 1);
		grid->add(grid, &btn_confirm->widget, 0, 1, 1, 1);
		grid->add(grid, &btn_cancel->widget, 1, 1, 1, 1);
		window_resize(main_window, 0, 0, 200, 76,
		    WINDOW_PLACEMENT_CENTER);

		window_exec(main_window);
		task_retval(0);
		async_manager();
		return 1;
	} else {
		printf("Compositor server not specified.\n");
		return 1;
	}
}
Exemplo n.º 4
0
//Действие при создании окна
void Screen_OnInit()
{
    Button *b = create_button(&ExitButton, 1, L"Exit", 128, 350, 80, 30, DrawButton, PressedButton, ReleasedButton, DestroyButton);
    bqueue_top = add_button_to_queue(bqueue_top, b);

    b = create_button(NULL, 2, L"Shoot", 30, 350, 80, 30, DrawButton, PressedButton, ReleasedButton, DestroyButton);
    bqueue_top = add_button_to_queue(bqueue_top, b);

    Draw();
}
Exemplo n.º 5
0
Arquivo: IHM.c Projeto: MIDMX/RaVisual
void password_screen(){

	//fond d'écran, header, footer
	create_rectangle(0,0,320,240,0x632C);
	header(5,TRUE,TRUE);

	//initialisatioin des variables
	char * temp[20],hidden[20]={};
	uint32_t i,j,len = strlen(password);
	uint32_t plus = 0, offsetY = 85, offsetX = 10;

	//création de la barre de texte
	LCD_DrawFullRect(10,40,300,32,0x39C7,0xD6BA);
	LCD_DrawFullRect(279,41,30,30,0xD6BA,0x153F);
	create_button(button,41,279,41,30,30);

	//on affiche le mot de passe en masuqnat les caractères
	for(i = 0; i<len;i++){
		strcpy(temp,hidden);
		sprintf(hidden,"%s-",(uint8_t *)temp);
	}
	LCD_DisplayStringLine(52,15,(uint8_t *)hidden,0x39C7,0xD6BA,LCD_NO_DISPLAY_ON_UART);

	//on choisit la police du texte à afficher
	LCD_SetFont(&Bebasn);

	//affichage des icônes dans le menu
	for(i=0;i<4;i++){
		for(j=0;j<10;j++){

			//bufferisation de la position des boutons
			create_button(button,plus,(30*j)+offsetX,(31*i)+offsetY,30,30);

			//drawing separators
			LCD_DrawRect((30*j)+offsetX,(31*i)+offsetY,30,30,0x39C7);
			LCD_DrawFullRect((30*j)+offsetX,(31*i)+offsetY,29,29,0x738E,0x5ACB);
			LCD_DisplayStringLine((31*i)+offsetY+11,(30*j)+offsetX+11,(uint8_t *)string[plus],0xD6BA,0x5ACB,LCD_NO_DISPLAY_ON_UART);
			plus++;

			// on sort de la boucle pour ne pas afficher les deux dernières touches du clavier
			// (choix graphique, on aurait pu faire sans)
			if (plus > 37){
				j = 10;
				i = 4;
			}

		}
	}

	//affichage du footer, puis lecture de l'écran tactile
	footer(PASSWORD);
	read_screen(button,PASSWORD,40);

}
Exemplo n.º 6
0
void update_screen (int priority, char *msg, enum pic_type 
            pic_on_screen_val, boolean crit_path_button_enabled) {

/* Updates the screen if the user has requested graphics.  The priority  *
 * value controls whether or not the Proceed button must be clicked to   *
 * continue.  Saves the pic_on_screen_val to allow pan and zoom redraws. */

 if (!show_graphics)         /* Graphics turned off */
    return;  


/* If it's the type of picture displayed has changed, set up the proper  *
 * buttons.                                                              */

 if (pic_on_screen != pic_on_screen_val) {
    if (pic_on_screen_val == PLACEMENT && pic_on_screen == NO_PICTURE) {
       create_button ("Window", "Toggle Nets", toggle_nets);
    }

    else if (pic_on_screen_val == ROUTING && pic_on_screen == PLACEMENT) {
       create_button ("Toggle Nets", "Toggle RR", toggle_rr);
       create_button ("Toggle RR", "Congestion", toggle_congestion);

       if (crit_path_button_enabled) 
          create_button ("Congestion", "Crit. Path", highlight_crit_path);
    }

    else if (pic_on_screen_val == PLACEMENT && pic_on_screen == ROUTING) {
       destroy_button ("Toggle RR");
       destroy_button ("Congestion");

       if (crit_path_button_enabled) 
          destroy_button ("Crit. Path");
    }
 }

/* Save the main message. */

 strncpy (default_message, msg, BUFSIZE);

 pic_on_screen = pic_on_screen_val;
 update_message (msg); 
 drawscreen();
 if (priority >= gr_automode) {

    event_loop(highlight_blocks, drawscreen);
 }

 else {
    flushinput();
 }
}
Exemplo n.º 7
0
/*************************************************************************
 *
 *N  yes_no
 *
 *::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
 *
 *   Purpose:
 *P
 *     This function displays a panel asking the user a yes or no
 *     question and returns the response.  Must be in graphics mode to call
 *     this function.
 *E
 *::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
 *
 *   Parameters:
 *A
 *    text     <input>==(char *) question string.
 *    return  <output>==(int) yes (TRUE) or no (FALSE).
 *E
 *::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
 *
 *   History:
 *H
 *    Barry Michaels   May 1991                    DOS Turbo C
 *E
 *************************************************************************/
int yes_no( char *text )
{
   panel_type  panel;
   int         no_id = 27;
   int         yes_id = 13;
   int         x,y,width,height,maxheight,id=0;

   settextstyle( SMALL_FONT, HORIZ_DIR, 4 );

   width = 0;
   maxheight = 0;
   width = textwidth(text);
   maxheight = textheight(text);

   width = width + 50;
   if (width > getmaxx())
      width = getmaxx()-10;
   height = maxheight * 5;

   create_panel( &panel,width,height,menucolor,menubordercolor );

   y = maxheight;
   create_label( text,CENTER,y,SMALL_FONT,4,menutextcolor,&panel );
   y += maxheight;

   create_button( yes_id, "Yes",
		  3, height-textheight("Y")-6,
		  SMALL_FONT, 4,
		  menutextcolor, menucolor, menubordercolor, RELIEVED,
		  &panel );
   create_button( no_id, "No",
		  width-textwidth("No")-13,
		  height-textheight("No")-6,
		  SMALL_FONT, 4,
		  menutextcolor, menucolor, menubordercolor, RELIEVED,
		  &panel );

   get_display_position( &x, &y, panel.window );

   display_panel( &panel, x,y );

   id = process_panel(&panel, id);

   destroy_panel( &panel );
   close_panel( &panel );

   if (id == yes_id)
      return TRUE;
   else
      return FALSE;
}
Exemplo n.º 8
0
tcontrol* ttabbar::create_child(const std::string& id, const std::string& tooltip, void* cookie, const std::string& sparam)
{
	VALIDATE(report_, "Must valid report_!");

	tcontrol* widget;
	if (toggle_) {
		ttoggle_button* widget2 = create_toggle_button(id, definition_, cookie);
		widget2->set_tooltip(tooltip);
		widget2->set_radio(true);
		widget2->set_callback_state_change(boost::bind(&tdialog::toggle_tabbar, report_->dialog(), _1));
		widget = widget2;

	} else {
		widget = create_button(id, definition_, cookie);
		widget->set_tooltip(tooltip);
		connect_signal_mouse_left_click(
			*widget
			, boost::bind(
				&tdialog::click_tabbar
				, report_->dialog()
				, widget
				, sparam));
	}
	return widget;
}
Exemplo n.º 9
0
static void
open_test_window (void)
{
  GtkWidget *grid;
  int i;

  test_window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  gtk_window_set_title (GTK_WINDOW (test_window), "Tests");

  g_signal_connect (test_window, "delete-event",
                    G_CALLBACK (gtk_main_quit), test_window);

  gtk_window_set_resizable (GTK_WINDOW (test_window), FALSE);

  test_widgets[TEST_WIDGET_IMAGE] = create_image ();
  test_widgets[TEST_WIDGET_LABEL] = create_label (FALSE, FALSE);
  test_widgets[TEST_WIDGET_VERTICAL_LABEL] = create_label (TRUE, FALSE);
  test_widgets[TEST_WIDGET_WRAP_LABEL] = create_label (FALSE, TRUE);
  test_widgets[TEST_WIDGET_BUTTON] = create_button ();
  test_widgets[TEST_WIDGET_ALIGNMENT] = create_alignment ();

  grid = gtk_grid_new ();

  gtk_container_add (GTK_CONTAINER (test_window), grid);

  for (i = 0; i < TEST_WIDGET_LAST; ++i)
    {
      gtk_grid_attach (GTK_GRID (grid), test_widgets[i], i % 3, i / 3, 1, 1);
    }

  gtk_widget_show_all (test_window);
}
Exemplo n.º 10
0
void start_menu_init(){
	start_menu = create_menu("spaceinvader_font_transparent.bmp");

	button* singleplayer = create_button(512, 250, 500, 90, ALIGN_CENTER, &start_menu_singleplayer_on_click, "Singleplayer", rgb(0xFFFFFF), ALIGN_CENTER);
	menu_add_button(start_menu, singleplayer);
	button* multiplayer = create_button(512, 350, 500, 90, ALIGN_CENTER, &start_menu_multiplayer_on_click, "Multiplayer", rgb(0xFFFFFF), ALIGN_CENTER);
	menu_add_button(start_menu, multiplayer);
	button* highscore = create_button(512, 450, 500, 90, ALIGN_CENTER, &start_menu_highscore_on_click, "Highscores", rgb(0xFFFFFF), ALIGN_CENTER);
	menu_add_button(start_menu, highscore);
	button* options = create_button(512, 550, 500, 90, ALIGN_CENTER, &start_menu_options_on_click, "Options", rgb(0xFFFFFF), ALIGN_CENTER);
	menu_add_button(start_menu, options);
	button* exit = create_button(512, 650, 500, 90, ALIGN_CENTER, &start_menu_exit_on_click, "Exit", rgb(0xFFFFFF), ALIGN_CENTER);
	menu_add_button(start_menu, exit);

	title = bitmap_load("title.bmp");
}
Exemplo n.º 11
0
void
intf_show_view(interface *intf, view_e view_type)
{
    if(view_type == intf->current_view)
        return;

    intf->current_view = view_type;
    preferences_set_index(PREF_CURRENT_VIEW, view_type);

    Evas_Object *nf_content = intf->nf_content;

    /* Create the correct view and store it */
    if(intf->nf_views[view_type] == NULL)
    {
        LOGD("New interface view %i", view_type);
        intf->nf_views[view_type] = interface_views[view_type].pf_create(intf, nf_content);
        intf->nf_views[view_type]->i_type = view_type;
    }
    else
        LOGD("Recycling interface view %i", view_type);

    intf_push_view(intf, intf->nf_views[view_type], interface_views[view_type].title);

    /* Create then set the panel toggle btn and add its callbacks */
    Evas_Object *sidebar_toggle_btn = create_button(nf_content, "naviframe/drawers");
    evas_object_smart_callback_add(sidebar_toggle_btn, "clicked", left_panel_button_clicked_cb, intf);
    elm_object_part_content_set(nf_content, "title_left_btn", sidebar_toggle_btn);
}
Exemplo n.º 12
0
void build_buts(GUI* g)
{
  WIDGET* but1=NULL;
  WIDGET* but2=NULL;
  WIDGET* but3=NULL;

  but1=create_button("Button",10,50);
  but2=create_button("Not Enabled Button",105,50);
  set_button_enable(but2,0);
  but3=create_button("Fancy Button",300,50);
  set_button_text_color(but3,0x0000FF00);

  add_to_main(g,but1);
  add_to_main(g,but2);
  add_to_main(g,but3);
}
Exemplo n.º 13
0
GList *
get_all_widgets (void)
{
  GList *retval = NULL;

  retval = g_list_append (retval, create_browser ());
  retval = g_list_append (retval, create_button ());
  retval = g_list_append (retval, create_chain_button ());
  retval = g_list_append (retval, create_color_area ());
  retval = g_list_append (retval, create_color_button ());
  retval = g_list_append (retval, create_color_hex_entry ());
  retval = g_list_append (retval, create_color_profile_combo_box ());
  retval = g_list_append (retval, create_color_scale ());
  retval = g_list_append (retval, create_color_selection ());
  retval = g_list_append (retval, create_dialog ());
  retval = g_list_append (retval, create_enum_combo_box ());
  retval = g_list_append (retval, create_enum_label ());
  retval = g_list_append (retval, create_file_entry ());
  retval = g_list_append (retval, create_frame ());
  retval = g_list_append (retval, create_hint_box ());
  retval = g_list_append (retval, create_int_combo_box ());
  retval = g_list_append (retval, create_memsize_entry ());
  retval = g_list_append (retval, create_number_pair_entry ());
  retval = g_list_append (retval, create_offset_area ());
  retval = g_list_append (retval, create_page_selector ());
  retval = g_list_append (retval, create_path_editor ());
  retval = g_list_append (retval, create_pick_button ());
  retval = g_list_append (retval, create_preview_area ());
  retval = g_list_append (retval, create_string_combo_box ());
  retval = g_list_append (retval, create_unit_menu ());

  return retval;
}
Exemplo n.º 14
0
/*************************************************************************
 *
 *N  displaymessage
 *
 *::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
 *
 *   Purpose:
 *P
 *     This function displays a list of text strings in a
 *     popup text window.  The list must be NULL-terminated.  Must be in
 *     graphics mode to call this function.
 *E
 *::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
 *
 *   Parameters:
 *A
 *    string <input> == (char *) first text string to be displayed.
 *    ... <input> == (char *) variable list of text strings to be displayed.
 *E
 *::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
 *
 *   History:
 *H
 *    Barry Michaels    August 1991                        DOS Turbo C
 *E
 *************************************************************************/
void displaymessage( char *string, ... )
{
   int         i,maxw,height,x,y,pad, nlines;
   panel_type  panel;
   char **text;
   va_list arglist;

   va_start(arglist,string);
   nlines = 1;
   while (va_arg(arglist,char *)) nlines++;
   va_end(arglist);

   text = (char **)vpfmalloc((nlines+1)*sizeof(char *));
   text[0] = string;
   va_start(arglist,string);
   for (i=1;i<nlines;i++) {
      text[i] = va_arg(arglist,char *);
   }
   va_end(arglist);

   settextstyle( SMALL_FONT, HORIZ_DIR, 4 );
   maxw = 0;
   height = 0;
   for (i=0;i<nlines;i++) {
      if (textwidth(text[i]) > maxw) maxw = textwidth(text[i]);
      height = height + textheight(text[i]) + 5;

   }
   if (maxw < (textwidth("Continue") + 10))
      maxw = textwidth("Continue") + 10;
   pad = (maxw*10)/100;
   maxw = maxw + (2*pad);
   if (maxw > getmaxx())
     maxw = getmaxx() - 8;
   height = height + 2*(textheight("Continue") + 5) + 5;

   create_panel( &panel, maxw, height, menucolor, menubordercolor );
   x = pad;
   y = 0;
   for (i=0;i<nlines;i++) {
      y = y + textheight(text[i]) + 5;
      create_label( text[i], x, y, SMALL_FONT, 4, menutextcolor, &panel );
   }
   y = height - (textheight("Continue") + 6);
   x = (maxw - (textwidth("Continue") + 10))/2;
   create_button( 27, "Continue", x, y, SMALL_FONT, 4,
		  menutextcolor, menucolor, menubordercolor, RELIEVED,
		  &panel );

   get_display_position( &x, &y, panel.window );

   display_panel( &panel, x, y );
   i = process_panel( &panel, i );

   destroy_panel( &panel );
   close_panel( &panel );

   free(text);
}
Exemplo n.º 15
0
void show_about(void)
{
        static int didit = 0;
        struct dialog *d;
        unsigned char *p;
        int x, y;

        fake_driver = (rand() & 3) ? 0 : 1;

        if (!didit) {
                vgamem_ovl_alloc(&logo_image);
                it_logo = xpmdata(_logo_it_xpm);
                schism_logo = xpmdata(_logo_schism_xpm);
                didit=1;
        }

        if (status.flags & CLASSIC_MODE) {
                p = it_logo ? it_logo->pixels : NULL;
        } else {
                p = schism_logo ? schism_logo->pixels : NULL;
        }

        /* this is currently pretty gross */
        vgamem_ovl_clear(&logo_image, 2);
        if (p) {
                int c = (status.flags & CLASSIC_MODE) ? 11 : 0;
                for (y = 0; y < LOGO_HEIGHT; y++) {
                        for (x = 0; x < LOGO_WIDTH; x++) {
                                if (p[x]) {
                                        vgamem_ovl_drawpixel(&logo_image, x+2, y+6, c);
                                }
                        }
                        vgamem_ovl_drawpixel(&logo_image, x, y+6, 2);
                        vgamem_ovl_drawpixel(&logo_image, x+1, y+6, 2);
                        p += LOGO_PITCH;
                }
        }

        create_button(widgets_about + 0,
                        33,32,
                        12,
                        0,0,0,0,0,
                        dialog_yes_NULL, "Continue", 3);
        d = dialog_create_custom(11,16,
                        58, 19,
                        widgets_about, 1, 0,
                        about_draw_const, NULL);
        d->action_yes = about_close;
        d->action_no = about_close;
        d->action_cancel = about_close;

        /* okay, in just a moment, we're going to the module page.
         * if your modules dir is large enough, this causes an annoying pause.
         * to defeat this, we start scanning *NOW*. this makes startup "feel"
         * faster.
         */
        status.flags |= DIR_MODULES_CHANGED;
        pages[PAGE_LOAD_MODULE].set_page();
}
Exemplo n.º 16
0
static void test_button_class(void)
{
    static const WCHAR testW[] = {'t','e','s','t',0};
    WNDCLASSEXW exW, ex2W;
    WNDCLASSEXA exA;
    char buffA[100];
    WCHAR *nameW;
    HWND hwnd;
    BOOL ret;
    int len;

    ret = GetClassInfoExA(NULL, WC_BUTTONA, &exA);
    ok(ret, "got %d\n", ret);
    todo_wine
    ok(IS_WNDPROC_HANDLE(exA.lpfnWndProc), "got %p\n", exA.lpfnWndProc);

    ret = GetClassInfoExW(NULL, WC_BUTTONW, &exW);
    ok(ret, "got %d\n", ret);
    ok(!IS_WNDPROC_HANDLE(exW.lpfnWndProc), "got %p\n", exW.lpfnWndProc);

    /* check that versioned class is also accessible */
    nameW = get_versioned_classname(WC_BUTTONW);
    ok(lstrcmpW(nameW, WC_BUTTONW), "got %s\n", wine_dbgstr_w(nameW));

    ret = GetClassInfoExW(NULL, nameW, &ex2W);
    todo_wine {
        ok(ret, "got %d\n", ret);
        ok(ex2W.lpfnWndProc == exW.lpfnWndProc, "got %p, %p\n", exW.lpfnWndProc, ex2W.lpfnWndProc);
    }

    /* Check reported class name */
    hwnd = create_button(BS_CHECKBOX, NULL);
    len = GetClassNameA(hwnd, buffA, sizeof(buffA));
    ok(len == strlen(buffA), "got %d\n", len);
    ok(!strcmp(buffA, "Button"), "got %s\n", buffA);

    len = RealGetWindowClassA(hwnd, buffA, sizeof(buffA));
    ok(len == strlen(buffA), "got %d\n", len);
    ok(!strcmp(buffA, "Button"), "got %s\n", buffA);
    DestroyWindow(hwnd);

    /* explicitely create with versioned class name */
    hwnd = CreateWindowExW(0, nameW, testW, BS_CHECKBOX, 0, 0, 50, 14, NULL, 0, 0, NULL);
    todo_wine
    ok(hwnd != NULL, "failed to create a window %s\n", wine_dbgstr_w(nameW));
    if (hwnd)
    {
        len = GetClassNameA(hwnd, buffA, sizeof(buffA));
        ok(len == strlen(buffA), "got %d\n", len);
        ok(!strcmp(buffA, "Button"), "got %s\n", buffA);

        len = RealGetWindowClassA(hwnd, buffA, sizeof(buffA));
        ok(len == strlen(buffA), "got %d\n", len);
        ok(!strcmp(buffA, "Button"), "got %s\n", buffA);

        DestroyWindow(hwnd);
    }
}
Exemplo n.º 17
0
t_dialog_sanctuary::t_dialog_sanctuary( t_window* parent )
                  : t_window( k_completely_transparent, parent )
{
	t_screen_rect rect;

	m_bitmaps = k_layout.get();
	rect = m_bitmaps->get_rect();
	rect += (parent->get_client_rect().size() - rect.size()) / 2;
	init( rect );

	// create backgrounds
	t_bitmap_layer const* layer;
	t_window*             background;
	t_screen_point		  origin(0,0);

	layer = m_bitmaps->find( "background" );
	background = new t_bitmap_layer_window( layer, origin, this );
	origin = layer->get_rect().top_left();

	// create title
	rect = m_bitmaps->find( "title" )->get_rect() - origin;
	m_title = new t_text_window( get_font( rect.height() ), rect, background, "",
		                         t_pixel_24(0,0,0));
	m_title->set_drop_shadow( false );
	m_title->set_center_horizontal();

	// create text
	rect = m_bitmaps->find( "text" )->get_rect() - origin;
	m_text = new t_text_window( get_font( 20 ), rect, background, "", t_pixel_24(0,0,0));
	m_text->set_drop_shadow( false );
	m_text->set_center_horizontal();

	// create buttons
	t_button*        button;
	t_button_handler handler;

	m_enter_button = create_button( m_bitmaps, "enter", background, origin );
	handler = add_2nd_argument( bound_handler( *this, &t_dialog_sanctuary::close_click ),
		                        int( k_choice_enter ));
	m_enter_button->set_click_handler( handler );

	rect = m_bitmaps->find( "close_button" )->get_rect() - origin;
	button = new t_button( k_close_button.get(), rect.top_left(), background );
	handler = add_2nd_argument( bound_handler( *this, &t_dialog_sanctuary::close_click ),
		                        int( k_choice_cancel ));
	button->set_click_handler( handler );	

	// create labels
	t_text_window* text_window;

	rect = m_bitmaps->find( "enter_text" )->get_rect() - origin;
	text_window = new t_text_window( get_font( rect.height() / 2 ), rect, background,
		                             k_text_entry_label, t_pixel_24(0,0,0));
	text_window->set_drop_shadow( false );
	text_window->set_center_horizontal();
}
Exemplo n.º 18
0
static VALUE
rg_initialize(int argc, VALUE *argv, VALUE self)
{
    VALUE group_or_label, label_or_use_underline, use_underline;
    GtkWidget *widget;

    if (rb_scan_args(argc, argv, "03", &group_or_label, &label_or_use_underline, &use_underline) > 0) {
        if (rb_obj_is_kind_of(group_or_label, RG_TARGET_NAMESPACE)){
            widget = create_button(group_or_label, label_or_use_underline, use_underline);
        } else {
            widget = create_button(Qnil, group_or_label, label_or_use_underline);
        }
    } else {
        widget = gtk_radio_button_new(NULL);
    }

    RBGTK_INITIALIZE(self, widget);
    return Qnil;
}
Exemplo n.º 19
0
void 
shelm_simple_dialog(const char *window_title, const char *window_text, int window_width, int window_height, const char *window_background, const char *window_icccm_name, const char *window_default_title, const char *window_default_icon)
{
  Evas_Object *window, *background, *frame, *box, *hbox, *icon, *button_ok;
  char buf[PATH_MAX];

  snprintf(buf, sizeof(buf), "shellementary-%s", window_icccm_name);
  if (window_title)
    window = create_window(buf, window_title, destroy);
  else
    window = create_window(buf, window_default_title, destroy);

  background = create_background(window, window_background, EINA_FALSE);
  elm_win_resize_object_add(window, background);
  evas_object_show(background);

  frame = create_frame(window, EINA_FALSE);
  elm_win_resize_object_add(window, frame);
  evas_object_show(frame);

  box = create_box(window, EINA_FALSE);
  elm_object_content_set(frame, box);
  evas_object_show(box);

  hbox = create_box(window, EINA_TRUE);
  elm_box_pack_end(box, hbox);
  evas_object_show(hbox);

  icon = create_icon(window, window_default_icon);
  elm_box_pack_start(hbox, icon);
  evas_object_show(icon);

  if (window_text)
    {
      Evas_Object *label;
      label = create_label(window, window_text);
      elm_box_pack_end(hbox, label);
      evas_object_show(label);
    }

  snprintf(buf, sizeof(buf), "%s/icon-ok.png", PACKAGE_DATA_DIR);
  button_ok = create_button(window, buf, _("OK"));
  evas_object_smart_callback_add(button_ok, "clicked", destroy, NULL);
  elm_box_pack_end(box, button_ok);
  evas_object_show(button_ok);

  if (!window_width)
    evas_object_geometry_get(window, NULL, NULL, &window_width, NULL);
  if (!window_height)
    evas_object_geometry_get(window, NULL, NULL, NULL, &window_height);

  evas_object_resize(window, window_width, window_height);

  evas_object_show(window);
}
int main(int argc, char *argv[]) {

	/* parse commandline returns filename index in argv */
	/* create floorplan data structure					*/
	gfp=fpCreate(argv[commandlineParse(argc,argv)]);

	if (gPostScript	) gGUI 		= 1 ;	/* enable gui if post script required		*/
	if (!gGUI		) gVerbose	= 1 ;	/* enable verbose if if gui is not enabled	*/

	/* change random seed into current time */
	srandom(time(NULL));

	if (gGUI) {

		/*  calculating world and drawing dimentions							*/
		gWorldStep=MIN((880/((gfp->ny)*2)),(1000/((gfp->nx)+1))); /* grid step	*/
		gWorldX   =((gfp->nx)+1)*gWorldStep+240; /* world X dimension 			*/
		gWorldY   =(gfp->ny)*2*gWorldStep+180  ; /* world Y dimension 			*/	

		/* initialize display with WHITE 1000x1000 background */
		init_graphics((char*)"Simulated-Annealing Cell-Based Placement Tool", WHITE, NULL);
		init_world (0.,0.,gWorldX,gWorldY);

		/* Create new buttons */
		create_button ((char*)"Window"    , (char*)"---1"      , NULL     ); /* Separator				*/
		create_button ((char*)"---1"      , (char*)"Enable  PS", enablePS ); /* enable PS				*/
		create_button ((char*)"Enable  PS", (char*)"Disable PS", disablePS); /* disable PS				*/
		create_button ((char*)"Disable PS", (char*)"Run 1"     , run1     ); /* refresh every 1    temp	*/
		create_button ((char*)"Run 1"     , (char*)"Run 10"    , run10    ); /* refresh every 10   temp	*/
 		create_button ((char*)"Run 10"    , (char*)"Run 100"   , run100   ); /* refresh every 100  temp	*/
		create_button ((char*)"Run 100"   , (char*)"Run 1000"  , run1000  ); /* refresh every 1000 temp	*/
		create_button ((char*)"Run 1000"  , (char*)"Run All"   , runAll   ); /* refresh at end only		*/
	}

	/* invoke simulated-annealing placement with designated parameters */
	fpAnneal(gfp
			,(gMoveTemp*(gfp->cellsN)^(4/3))
			,gInitTemp*(gfp->bbox)
			,gCoolRate
			,gFreezeTemp/(gfp->bbox/gfp->netsN)
	);

	/* finished! wait still until 'Exit" is pressed */
	if (gGUI)
		while(1) waitLoop();

	/* free database */
	fpDelete(gfp);


	return 1;
}
Exemplo n.º 21
0
static View* create_title_view(Window* window) {
	if (!window) return NULL;

	Rect title_view_frame = rect_make(point_make(0, 0), size_make(window->frame.size.width, WINDOW_TITLE_VIEW_HEIGHT));
	View* title_view = create_view(title_view_frame);
	title_view->background_color = window->border_color;

	Button* close_button = create_button(rect_make(point_zero(), size_make(CHAR_WIDTH * 2, title_view->frame.size.height)), "X");
	close_button->mousedown_handler = (event_handler)&close_button_clicked;
	add_button(title_view, close_button);

	Button* minimize_button = create_button(rect_make(point_make(rect_max_x(close_button->frame), 0), size_make(CHAR_WIDTH * 2, title_view->frame.size.height)), "-");
	minimize_button->mousedown_handler = (event_handler)&minimize_button_clicked;
	add_button(title_view, minimize_button);

	//add title label to title view
	int label_length = 20 * CHAR_WIDTH;
	Rect label_frame = rect_make(point_make(rect_max_x(minimize_button->frame) + 15, title_view_frame.size.height / 2 - (CHAR_HEIGHT / 2)), size_make(label_length, CHAR_HEIGHT));
	Label* title_label = create_label(label_frame, window->title);
	title_label->text_color = color_black();
	add_sublabel(title_view, title_label);

	Bmp* dots = create_bmp(title_view_frame, create_layer(title_view_frame.size));
	uint8_t* ref = dots->layer->raw;
	for (int y = 0; y < dots->frame.size.height; y++) {
		for (int x = 0; x < dots->frame.size.width; x++) {
			if (!((x + y) % 2)) {
				*ref++ = 50;
				*ref++ = 50;
				*ref++ = 50;
			}
			else {
				*ref++ = 200;
				*ref++ = 160;
				*ref++ = 90;
			}
		}
	}
	add_bmp(title_view, dots);

	return title_view;
}
Exemplo n.º 22
0
void Abstract_Widget_List::appendWidget(QWidget *w)
{
    int row = count();
    p->table->insertRow(row);

    QWidget* b_up = create_button(w,&p->mapper_up,"go-up",tr("Move Up"));
    QWidget* b_down = create_button(w,&p->mapper_down,"go-down",tr("Move Down"));
    QWidget* b_remove = create_button(w,&p->mapper_remove,"list-remove",tr("Remove"));
    if ( row == 0 )
        b_up->setEnabled(false);
    else
        p->table->cellWidget(row-1,2)->setEnabled(true);
    b_down->setEnabled(false);

    p->table->setCellWidget(row,0,w);
    p->table->setCellWidget(row,1,b_up);
    p->table->setCellWidget(row,2,b_down);
    p->table->setCellWidget(row,3,b_remove);

    p->widgets.push_back(w);
}
Exemplo n.º 23
0
static void video_change_dialog(void)
{
	struct dialog *d;

	video_revert_driver = video_driver_name();
	video_revert_fs = video_is_fullscreen();

	countdown = 10;
	time(&started);

	create_button(video_dialog_widgets+0, 28,28,8, 0, 0, 0, 1, 1,
					dialog_yes_NULL, "OK", 4);
	create_button(video_dialog_widgets+1, 42,28,8, 1, 1, 0, 1, 0,
					dialog_cancel_NULL, "Cancel", 2);
	d = dialog_create_custom(20, 17, 40, 14,
			video_dialog_widgets,
			2, 1,
			video_dialog_draw_const, NULL);
	d->action_yes = video_mode_keep;
	d->action_no = video_mode_cancel;
	d->action_cancel = video_mode_cancel;
}
Exemplo n.º 24
0
tbutton* create_surface_button(const std::string& id, void* cookie)
{
	config cfg;

	if (!id.empty()) {
		cfg["id"] = id;
	}
	cfg["definition"] = "surface";

	tbutton* widget = create_button(cfg);
	widget->set_cookie(cookie);
	return widget;
}
Exemplo n.º 25
0
static ClutterActor *
create_controls (RBShell *shell)
{
    RBShellPlayer *player;
    ClutterActor *box;
    ClutterActor *button;
    int pos;
    gboolean playing;

    g_object_get (shell, "shell-player", &player, NULL);

    box = mx_box_layout_new ();
    mx_box_layout_set_orientation (MX_BOX_LAYOUT (box), MX_ORIENTATION_HORIZONTAL);
    mx_box_layout_set_spacing (MX_BOX_LAYOUT (box), 16);
    mx_stylable_set_style_class (MX_STYLABLE (box), "ControlsBox");
    mx_stylable_set_style (MX_STYLABLE (box), style);
    clutter_actor_set_reactive (box, TRUE);

    /* XXX rtl? */
    pos = 0;
    button = create_button ("PrevButton", "PrevButtonIcon", "media-skip-backward");
    g_signal_connect_object (button, "clicked", G_CALLBACK (prev_clicked_cb), player, 0);
    mx_box_layout_add_actor (MX_BOX_LAYOUT (box), button, pos++);

    button = create_button ("PlayPauseButton", "PlayPauseButtonIcon", "media-playback-start");
    g_signal_connect_object (button, "clicked", G_CALLBACK (playpause_clicked_cb), player, 0);
    g_signal_connect_object (player, "playing-changed", G_CALLBACK (playing_changed_cb), button, 0);
    g_object_get (player, "playing", &playing, NULL);
    update_playing (MX_BUTTON (button), playing);
    mx_box_layout_add_actor (MX_BOX_LAYOUT (box), button, pos++);

    button = create_button ("NextButton", "NextButtonIcon", "media-skip-forward");
    g_signal_connect_object (button, "clicked", G_CALLBACK (next_clicked_cb), player, 0);
    mx_box_layout_add_actor (MX_BOX_LAYOUT (box), button, pos++);

    g_object_unref (player);
    return box;
}
Exemplo n.º 26
0
void ServerWidget::update_player_actions()
{
    const auto& players = model_player.players();
    for ( unsigned i = 0; i < players.size(); i++ )
    {
        QDialogButtonBox *buttons = new QDialogButtonBox();
        for ( const auto& action : settings().player_actions )
            buttons->addButton(create_button(action,players[i]),
                                QDialogButtonBox::ActionRole);
        auto index = model_player.index(i, PlayerModel::Actions);
        table_players->setIndexWidget(index, buttons);
    }
    table_players->resizeColumnToContents(PlayerModel::Actions);
}
Exemplo n.º 27
0
void create_buttons_dialog(GtkWidget* dialog,UserInstallCallback callback)
{
  GtkWidget* button;



  button = create_button(dialog,_("Cancel"));
  gtk_box_pack_end (GTK_BOX(action_area), button, FALSE, TRUE, 0);
  g_signal_connect_swapped(GTK_OBJECT(button), "clicked", G_CALLBACK(user_install_cancel_callback),GTK_OBJECT(dialog));

  GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT);
  cancel_button = button;
  gtk_widget_show_all (button);

  button = create_button(dialog,_(" Continue "));
  gtk_box_pack_end (GTK_BOX(action_area), button, FALSE, TRUE, 0);  
  GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT);
  gtk_widget_grab_default(button);
  continue_button = button;
  g_signal_connect(G_OBJECT(button), "clicked", (GCallback)user_install_continue_callback,callback);
  gtk_widget_show_all (button);

}
Exemplo n.º 28
0
void
datetime_cb(void *data, Evas_Object *obj, void *event_info)
{
	appdata_s *ad = data;
	Elm_Object_Item *it;
	Evas_Object *box, *layout;

	datetimedata_s *dd = calloc(1, sizeof(datetimedata_s));
	dd->nf = ad->nf;

	time_t local_time = time(NULL);
	char buff[200] = {0};
	struct tm *time_info = localtime(&local_time);
	dd->saved_time = *time_info;

	layout = elm_layout_add(ad->nf);
	evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
	elm_layout_file_set(layout, ELM_DEMO_EDJ, "white_bg_layout");

	box = elm_box_add(layout);
	evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
	evas_object_size_hint_align_set(box, EVAS_HINT_FILL, EVAS_HINT_FILL);
	elm_box_padding_set(box, 0, ELM_SCALE_SIZE(70));
	elm_object_part_content_set(layout, "elm.swallow.content", box);

	strftime(buff, 200, DATE_FORMAT, &dd->saved_time);
	dd->button1 = create_button(dd, box, buff, DATE_FORMAT);

	strftime(buff, 200, TIME_12_FORMAT, &dd->saved_time);
	dd->button2 = create_button(dd, box, buff, TIME_12_FORMAT);

	strftime(buff, 200, TIME_24_FORMAT, &dd->saved_time);
	dd->button3 = create_button(dd, box, buff, TIME_24_FORMAT);

	it = elm_naviframe_item_push(ad->nf, "DateTime", NULL, NULL, layout, NULL);
	elm_naviframe_item_pop_cb_set(it, naviframe_pop_cb, dd);
}
Exemplo n.º 29
0
/* ----------------------------------------------------------------------------
 * Makes it so that this scrollbar is bound to a widget.
 * Whenever the scrollbar is changed, the widget scrolls
 * accordingly.
 */
void scrollbar::make_widget_scroll(widget* widget) {
    attached_widget = widget;
    this->min_value = this->low_value = 0;
    if(widget) {
        widget->children_offset_x = widget->children_offset_y = 0;
        float largest_y2 = FLT_MIN, largest_x2 = FLT_MIN;
        
        for(auto w = widget->widgets.begin(); w != widget->widgets.end(); ++w) {
            if(!w->second) continue;
            
            if(vertical) {
                if(w->second->y2 > largest_y2) largest_y2 = w->second->y2;
            } else {
                if(w->second->x2 > largest_x2) largest_x2 = w->second->x2;
            }
        }
        
        if(vertical) {
            largest_y2 += 8; //Spacing.
            largest_y2 -= widget->y1;
            if(largest_y2 < widget->y2 - widget->y1) {
                this->high_value = this->max_value = 0;
            } else {
                this->high_value = widget->y2 - widget->y1;
                this->max_value = largest_y2;
            }
        } else {
            largest_x2 += 8; //Spacing.
            largest_x2 -= widget->x1;
            if(largest_x2 < widget->x2 - widget->x1) {
                this->high_value = this->max_value = 0;
            } else {
                this->high_value = widget->x2 - widget->x1;
                this->max_value = largest_x2;
            }
        }
        
        register_change_handler(widget_scroller);
        
    } else {
    
        this->max_value = 10;
        this->high_value = 1;
        
        register_change_handler(NULL);
    }
    
    create_button();
}
Exemplo n.º 30
0
gui2::tbutton* tbrowse::create_navigate_button(twindow& window, const std::string& label, int index)
{
	gui2::tbutton* widget = create_button(null_str, "text", NULL);
	widget->set_label(label);

	connect_signal_mouse_left_click(
		*widget
		, boost::bind(
			&tbrowse::click_navigate
			, this
			, boost::ref(window)
			, _3
			, _4
			, index));
	return widget;
}