Ejemplo n.º 1
0
static void open_note_tab_continued(int id)
{
	int tf_x = 10;
	int tf_y = 45;
	int tf_width = notepad_win_x_len - 20;
	int tf_height = notepad_win_y_len - 80;
	int tab;

	note_list[id].window = tab_add (notepad_win, note_tabcollection_id, note_list[id].name, 0, 1, 0);
	widget_set_color (notepad_win, note_list[id].window, 0.77f, 0.57f, 0.39f);

	// input text field
	note_list[id].input = text_field_add_extended(note_list[id].window, note_widget_id++, NULL, tf_x, tf_y, tf_width, tf_height, TEXT_FIELD_BORDER|TEXT_FIELD_EDITABLE|TEXT_FIELD_CAN_GROW|TEXT_FIELD_SCROLLBAR, note_zoom, 0.77f, 0.57f, 0.39f, &note_list[id].text, 1, FILTER_ALL, 5, 5);

	// remove button
	note_list[id].button = button_add (note_list[id].window, NULL, button_remove_category, 20, 8);
	widget_set_OnClick(note_list[id].window, note_list[id].button, notepad_remove_category);
	widget_set_color(note_list[id].window, note_list[id].button, 0.77f, 0.57f, 0.39f);
	widget_set_OnMouseover(note_list[id].window, note_list[id].button, mouseover_remove_handler);

	set_window_handler (note_list[id].window, ELW_HANDLER_DESTROY, note_tab_destroy);

	tab = tab_collection_get_tab_nr (notepad_win, note_tabcollection_id, note_list[id].window);
	tab_collection_select_tab (notepad_win, note_tabcollection_id, tab);
}
Ejemplo n.º 2
0
void display_popup_win (INPUT_POPUP *ipu, const char* label)
{
	widget_list *wok;
	widget_list *wno;

	if(ipu->popup_win < 0)
	{
		Uint32 flags = ELW_WIN_DEFAULT & ~ELW_CLOSE_BOX;
		ipu->popup_win = create_window (win_prompt, ipu->parent, 0, ipu->x, ipu->y, ipu->popup_x_len, ipu->popup_y_len, flags);

		// clear the buffer
		init_text_message (&ipu->popup_text, ipu->maxlen);
		set_text_message_color (&ipu->popup_text, 0.77f, 0.57f, 0.39f);

		// Label
		ipu->popup_label = label_add (ipu->popup_win, NULL, label, 5, 5);
		widget_set_color (ipu->popup_win, ipu->popup_label, 0.77f, 0.57f, 0.39f);

		// Input
		ipu->popup_field = text_field_add_extended (ipu->popup_win, 101, NULL, 5, 28, ipu->popup_x_len - 10, 28*ipu->rows, ipu->text_flags, 1.0f, 0.77f, 0.57f, 0.39f, &ipu->popup_text, 1, FILTER_ALL, 5, 5);
		widget_set_color (ipu->popup_win, ipu->popup_field, 0.77f, 0.57f, 0.39f);

		// Accept
		ipu->popup_ok = button_add (ipu->popup_win, NULL, button_okay, 0, 0);
		widget_set_OnClick (ipu->popup_win, ipu->popup_ok, popup_ok_button_handler);
		widget_set_color (ipu->popup_win, ipu->popup_ok, 0.77f, 0.57f, 0.39f);

		// Reject
		ipu->popup_no = button_add (ipu->popup_win, NULL, button_cancel, 0, 0);
		widget_set_OnClick (ipu->popup_win, ipu->popup_no, popup_cancel_button_handler);
		widget_set_color (ipu->popup_win, ipu->popup_no, 0.77f, 0.57f, 0.39f);

		// align the buttons
		wok = widget_find(ipu->popup_win, ipu->popup_ok);
		wno = widget_find(ipu->popup_win, ipu->popup_no);
		widget_move(ipu->popup_win, ipu->popup_ok, (ipu->popup_x_len - wok->len_x - wno->len_x)/3, ipu->popup_y_len - (wok->len_y + 5));
		widget_move(ipu->popup_win, ipu->popup_no, wok->len_x + 2*(ipu->popup_x_len - wok->len_x - wno->len_x)/3, ipu->popup_y_len - (wno->len_y + 5));

		set_window_handler (ipu->popup_win, ELW_HANDLER_KEYPRESS, popup_keypress_handler);

		if ((ipu->popup_win > -1) && (ipu->popup_win < windows_list.num_windows))
			windows_list.window[ipu->popup_win].data = ipu;
	}
	else
	{
		if ((ipu->parent > -1) && (ipu->parent < windows_list.num_windows))
		{
			window_info *win = &windows_list.window[ipu->parent];
			move_window(ipu->popup_win, ipu->parent, 0, win->pos_x+ipu->x, win->pos_y+ipu->y);
		}
		text_field_clear(ipu->popup_win, ipu->popup_field);
		label_set_text (ipu->popup_win, ipu->popup_label, label);
		show_window (ipu->popup_win);
		select_window (ipu->popup_win);
	}
}
Ejemplo n.º 3
0
void fill_notepad_window()
{
	int i, tmp;
	widget_list *wnew;
	widget_list *wsave;

	int note_tabs_width = notepad_win_x_len;
	int note_tabs_height = notepad_win_y_len - 5;

	note_button_scroll_height = note_tabs_height - 55 - 20; // -20 for the tab tags
	note_button_width = (note_tabs_width - note_button_scroll_width - note_button_x_space - 15) / 2;

	set_window_handler(notepad_win, ELW_HANDLER_DISPLAY, &display_notepad_handler);
	set_window_handler(notepad_win, ELW_HANDLER_CLICK, &click_buttonwin_handler);

	note_tabcollection_id = tab_collection_add (notepad_win, NULL, 0, 5, note_tabs_width, note_tabs_height, 20);
	widget_set_size (notepad_win, note_tabcollection_id, 0.7);
	widget_set_color (notepad_win, note_tabcollection_id, 0.77f, 0.57f, 0.39f);
	main_note_tab_id = tab_add (notepad_win, note_tabcollection_id, tab_main, 0, 0, 0);
	widget_set_color (notepad_win, main_note_tab_id, 0.77f, 0.57f, 0.39f);
	set_window_handler(main_note_tab_id, ELW_HANDLER_CLICK, &click_buttonwin_handler);

	// Add Category
	new_note_button_id = button_add(main_note_tab_id, NULL, button_new_category, 0, 0);
	widget_set_OnClick(main_note_tab_id, new_note_button_id, notepad_add_category);
	widget_set_color(main_note_tab_id, new_note_button_id, 0.77f, 0.57f, 0.39f);

	// Save Notes
	save_notes_button_id = button_add(main_note_tab_id, NULL, button_save_notes, 0, 0);
	widget_set_OnClick(main_note_tab_id, save_notes_button_id, click_save_handler);
	widget_set_color(main_note_tab_id, save_notes_button_id, 0.77f, 0.57f, 0.39f);

	// align the buttons
	wnew = widget_find(main_note_tab_id, new_note_button_id);
	wsave = widget_find(main_note_tab_id, save_notes_button_id);
	tmp = (notepad_win_x_len - note_button_scroll_width)/2;
	widget_move(main_note_tab_id, new_note_button_id, (tmp - wnew->len_x)/2, 10);
	widget_move(main_note_tab_id, save_notes_button_id, tmp + (tmp - wsave->len_x)/2, 10);

	notepad_load_file ();

	init_ipu (&popup_str, main_note_tab_id, NOTE_NAME_LEN*DEFAULT_FONT_X_LEN, 100, NOTE_NAME_LEN, 1, NULL, notepad_add_continued);
	popup_str.x = (notepad_win_x_len - popup_str.popup_x_len) / 2;
	popup_str.y = (notepad_win_y_len - popup_str.popup_y_len) / 2;

	note_button_scroll_id = vscrollbar_add (main_note_tab_id, NULL, note_tabs_width - note_button_scroll_width - 5, 50, note_button_scroll_width, note_button_scroll_height);
	widget_set_OnClick (main_note_tab_id, note_button_scroll_id, note_button_scroll_handler);
	widget_set_OnDrag (main_note_tab_id, note_button_scroll_id, note_button_scroll_handler);

	// Add the note selection buttons and their scroll bar
	for(i = 0; i < nr_notes; i++)
		note_button_add (i, i);

	update_note_button_scrollbar (0);
}
Ejemplo n.º 4
0
void text_line_set_color(struct text_line* t, struct color* fore_color, struct color* back_color, struct color* frame_color)
{
	widget_set_color(WIDGET_POINTER(t), fore_color, back_color);
	t->frame_color = (NULL == frame_color ? t->frame_color : *frame_color);
}
Ejemplo n.º 5
0
BOOL xwt_gtk_base_setprop( PXWT_WIDGET widget, char *prop, PHB_ITEM pValue )
{
   BOOL ret = TRUE;
   XWT_GTK_BASE *wSelf = (PXWT_GTK_BASE) widget->widget_data;
   GtkWidget *wTop = wSelf->top_widget( widget );
   GtkWidget *wMain = wSelf->main_widget;
   char *szPropVal;

   if ( strcmp( prop, "x" ) == 0 )
   {
      wSelf->x = hb_itemGetNI(pValue);
      gtk_widget_set_uposition( wTop, wSelf->x , wSelf->y );
   }
   else if ( strcmp( prop, "y" ) == 0 )
   {
      wSelf->y = hb_itemGetNI(pValue);
      gtk_widget_set_uposition( wTop, wSelf->x , wSelf->y );
   }
   else if ( strcmp( prop, "width" ) == 0 )
   {
      wSelf->width = hb_itemGetNI(pValue);
      if ( wSelf->height > 0 )
      {
         gtk_widget_set_size_request( wTop, wSelf->width , wSelf->height );
      }
   }
   else if ( strcmp( prop, "height" ) == 0 )
   {
      wSelf->height = hb_itemGetNI(pValue);
      if ( wSelf->width > 0 )
      {
         gtk_widget_set_size_request( wTop, wSelf->width , wSelf->height );
      }
   }
   else if ( strcmp( prop, "id" ) == 0 )
   {
      wSelf->nId = hb_itemGetNI(pValue);
   }
   else if ( strcmp( prop, "broadcast" ) == 0 )
   {
      wSelf->bBroadcast = hb_itemGetL(pValue);
   }
   else if ( strcmp( prop, "visibility" ) == 0 )
   {
      szPropVal = hb_itemGetCPtr( pValue );
      if( szPropVal == NULL )
      {
         ret = FALSE;
      }
      else if ( strcmp( szPropVal, "normal" ) == 0 )
      {
         gtk_widget_show( wTop );
      }
      else if ( strcmp( szPropVal, "hidden" ) == 0 )
      {
         gtk_widget_hide( wTop );
      }
      else
      {
         ret = FALSE;
      }
   }
   else if ( strcmp( prop, "focus" ) == 0 )
   {
      if( hb_itemGetL( pValue ) )
      {
         gtk_widget_grab_focus( wTop );
      }
      else
      {
         ret = FALSE; // can't just give away focus
      }
   }
   // fgcolor
   else if ( strcmp( prop, "fgcolor" ) == 0 )
   {
   
     GdkColor color;
     szPropVal  = hb_itemGetCPtr( pValue ) ;
     if ( szPropVal )
     {
     wSelf->fgColor = hb_itemGetCPtr( pValue ) ;
     gdk_color_parse (wSelf->fgColor, &color);
     switch( widget->type )
     {

            case XWT_TYPE_TOGGLEBUTTON:
            case XWT_TYPE_RADIOBUTTON:
            case XWT_TYPE_CHECKBOX:
      	       widget_set_color(wTop, &color,1);
	       break;
            case XWT_TYPE_BUTTON:	    
	    case XWT_TYPE_LABEL:
      	       widget_set_color(wMain, &color,1);
	       break;
      }	

     }
     else
     { 
        ret = FALSE ; 
     }
   }
   
   else if ( strcmp( prop, "bgcolor" ) == 0 )
   {
   
     GdkColor color;
          szPropVal  = hb_itemGetCPtr( pValue ) ;
     if ( szPropVal ) 
     {
      wSelf->bgColor = hb_itemGetCPtr( pValue ) ;
     gdk_color_parse (wSelf->bgColor, &color);
//     widget_set_color(GTK_LABEL(wMain), &color,2 );
     switch( widget->type )
     {

            case XWT_TYPE_TOGGLEBUTTON:
            case XWT_TYPE_RADIOBUTTON:
            case XWT_TYPE_CHECKBOX:
      	       widget_set_color(wTop, &color,2);
	       break;
            case XWT_TYPE_BUTTON:	    
	    case XWT_TYPE_LABEL:	    
      	       widget_set_color(wMain, &color,2);
	       break;
      }	
}
     else
     { 
        ret = FALSE ; 
     }
   }

   else if ( strcmp( prop, "textcolor" ) == 0 )
   {
      GdkColor color;
       szPropVal  = hb_itemGetCPtr( pValue ) ;
     if ( szPropVal ) 

      {
            wSelf->textColor = hb_itemGetCPtr( pValue ) ;
      gdk_color_parse (wSelf->textColor, &color);

//      widget_set_color(GTK_LABEL(wMain), &color,4 );
     switch( widget->type )
     {

            case XWT_TYPE_TOGGLEBUTTON:
            case XWT_TYPE_RADIOBUTTON:
            case XWT_TYPE_CHECKBOX:
      	       widget_set_color(wTop, &color,4);
	       break;
            case XWT_TYPE_BUTTON:	    	    
	    case XWT_TYPE_LABEL:	    
      	       widget_set_color(wMain, &color,4);
	       break;
      }	

}
     else
     { 
        ret = FALSE ; 
     }
   }
   else if ( strcmp( prop, "basecolor" ) == 0 )
   {
      GdkColor color;
           szPropVal  = hb_itemGetCPtr( pValue ) ;
     if ( szPropVal ) {

    wSelf->baseColor = hb_itemGetCPtr( pValue ) ;
      gdk_color_parse (wSelf->baseColor, &color);

//      widget_set_color(GTK_LABEL(wMain), &color,3 );
      switch( widget->type )
      {

            case XWT_TYPE_TOGGLEBUTTON:
            case XWT_TYPE_RADIOBUTTON:
            case XWT_TYPE_CHECKBOX:
      	       widget_set_color(wTop, &color,3);
	       break;
            case XWT_TYPE_BUTTON:	    
	    case XWT_TYPE_LABEL:	    
      	       widget_set_color(wMain, &color,3);
	       break;
      }	
}
     else
     { 
        ret = FALSE ; 
     }      

   }

   else
   {
      ret = FALSE;
   }

   return ret;
}
Ejemplo n.º 6
0
void spinbox_set_color(struct spinbox* b, struct color* fcolor, struct color* bcolor)
{
	widget_set_color(WIDGET_POINTER(b), fcolor, bcolor);
}