Example #1
0
static void create_screen_ui_object (ui_object *obj, ui_object_types type, va_list pargs)
{

   screen_ui_object
      *new_screen;

	increase_ui_object_counter ();

   ////////////////////////////////////////
   //
   // MALLOC ENTITY DATA
   //
   ////////////////////////////////////////

   obj->type = type;

   new_screen = (screen_ui_object *) safe_malloc (sizeof (screen_ui_object));

   obj->data = new_screen;

   ////////////////////////////////////////
   //
   // INITIALISE ALL ENTITY DATA TO 'WORKING' DEFAULT VALUES
   //
   // DO NOT USE ACCESS FUNCTIONS
   //
   // DO NOT USE RANDOM VALUES
   //
   ////////////////////////////////////////

   memset (new_screen, 0, sizeof (screen_ui_object));

   //new_screen->area.x = 0.0;
   //new_screen->area.y = 0.0;
   //new_screen->area.x_size = 0.0;
   //new_screen->area.y_size = 0.0;
	new_screen->area.colour_start.r = 255;
	new_screen->area.colour_start.g = 255;
	new_screen->area.colour_start.b = 255;
	new_screen->area.colour_start.a = 255;
	new_screen->area.colour_end.r = 255;
	new_screen->area.colour_end.g = 255;
	new_screen->area.colour_end.b = 255;
	new_screen->area.colour_end.a = 255;
   new_screen->area.x_origin = 0.0;
   new_screen->area.y_origin = 0.0;
   new_screen->area.drawable = 1;
   new_screen->area.item_number = -1;
   new_screen->area.redraw = 1;
   new_screen->area.moveable = 0;
   new_screen->area.resizeable = 0;
   new_screen->area.notify_on = NOTIFY_TYPE_DISPLAYED;
   new_screen->area.parent = NULL;
   new_screen->area.child = NULL;
   new_screen->area.next = NULL;
   new_screen->area.prev = NULL;
	new_screen->screen_id = ui_object_counter;

   ////////////////////////////////////////
   //
   // OVERWRITE DEFAULTS WITH GIVEN ATTRIBUTES
   //
   ////////////////////////////////////////

   set_ui_object_attributes (obj, pargs);

   ////////////////////////////////////////
   //
   // INTEGRATE INTO SYSTEM
   //
   ////////////////////////////////////////
}
Example #2
0
static void create_close_ui_object (ui_object *obj, ui_object_types type, va_list pargs)
{

	float
		px_size,
		py_size;

   close_ui_object
      *new_close;

	increase_ui_object_counter ();

   ////////////////////////////////////////
   //
   // MALLOC ENTITY DATA
   //
   ////////////////////////////////////////

   obj->type   = type;

   new_close    = safe_malloc (sizeof (close_ui_object));

   obj->data   = new_close;

   ////////////////////////////////////////
   //
   // INITIALISE ALL ENTITY DATA TO 'WORKING' DEFAULT VALUES
   //
   // DO NOT USE ACCESS FUNCTIONS
   //
   // DO NOT USE RANDOM VALUES
   //
   ////////////////////////////////////////

   memset (new_close, 0, sizeof (close_ui_object));

   //new_close->area.x = 0.0;
   //new_close->area.y = 0.0;
   //new_close->area.x_size = 20.0;
   //new_close->area.y_size = 20.0;
   new_close->area.x_origin = 0.0;
   new_close->area.y_origin = 0.0;
   new_close->area.drawable = 1;
   new_close->area.redraw = 1;
   new_close->area.item_number = -1;
   new_close->area.moveable = 0;
   new_close->area.resizeable = 0;
   new_close->area.notify_on = NOTIFY_TYPE_BUTTON_UP;
   new_close->area.parent = NULL;
   new_close->area.child = NULL;
   new_close->area.next = NULL;
   new_close->area.prev = NULL;

   new_close->area.state = 0;

   ////////////////////////////////////////
   //
   // OVERWRITE DEFAULTS WITH GIVEN ATTRIBUTES
   //
   ////////////////////////////////////////

   set_ui_object_attributes (obj, pargs);

	if (!new_close->area.parent)
	{

		debug_fatal ("ERROR: Close_box MUST have a parent");
	}

	// set close box position relative to parent
	
	px_size = get_ui_object_x_size (new_close->area.parent);
	
	py_size = get_ui_object_y_size (new_close->area.parent);
	
  	new_close->area.x_start = px_size - new_close->area.x_size_start - 1;

  	new_close->area.y_start = 1;

   ////////////////////////////////////////
   //
   // INTEGRATE INTO SYSTEM
   //
   ////////////////////////////////////////
}
Example #3
0
static void create_number_ui_object (ui_object *obj, ui_object_types type, va_list pargs)
{

    number_ui_object
    *new_object;

    increase_ui_object_counter ();

    ////////////////////////////////////////
    //
    // MALLOC ENTITY DATA
    //
    ////////////////////////////////////////

    obj->type = type;

    new_object = (number_ui_object *) safe_malloc (sizeof (number_ui_object));

    obj->data = new_object;

    ////////////////////////////////////////
    //
    // INITIALISE ALL ENTITY DATA TO 'WORKING' DEFAULT VALUES
    //
    // DO NOT USE ACCESS FUNCTIONS
    //
    // DO NOT USE RANDOM VALUES
    //
    ////////////////////////////////////////

    memset (new_object, 0, sizeof (number_ui_object));

    //new_object->area.x = 0.0;
    //new_object->area.y = 0.0;
    //new_object->area.x_size = 0.0;
    //new_object->area.y_size = ui_get_font_height ();
    new_object->area.x_origin = 0.0;
    new_object->area.y_origin = 0.0;
    new_object->area.drawable = 1;
    new_object->area.item_number = -1;
    new_object->area.redraw = 1;
    new_object->area.moveable = 0;
    new_object->area.resizeable = 0;
    new_object->area.notify_on = NOTIFY_TYPE_BUTTON_EITHER;
    new_object->area.parent = NULL;
    new_object->area.child = NULL;
    new_object->area.next = NULL;
    new_object->area.prev = NULL;
    new_object->area.font_type = UI_FONT_ARIAL_10;
    new_object->area.font_colour_end = default_unselected_text_colour;
    new_object->area.font_colour_start = default_unselected_text_colour;
    new_object->area.highlighted_font_type = -1;
    new_object->area.highlighted_font_colour_end = default_selected_text_colour;
    new_object->area.highlighted_font_colour_start = default_selected_text_colour;
    new_object->area.selected_font_type = -1;
    new_object->area.selected_font_colour_end = default_selected_text_colour;
    new_object->area.selected_font_colour_start = default_selected_text_colour;

    new_object->area.text = NULL;

    ////////////////////////////////////////
    //
    // OVERWRITE DEFAULTS WITH GIVEN ATTRIBUTES
    //
    ////////////////////////////////////////

    set_ui_object_attributes (obj, pargs);

    set_ui_object_function (obj, ui_object_number_function);

    ////////////////////////////////////////
    //
    // Check the font default values & override them if not set
    //
    ////////////////////////////////////////

    if ( new_object->area.font_type == -1 )
    {

        new_object->area.font_type = get_ui_font_type ();
    }

    if ( new_object->area.highlighted_font_type == -1 )
    {

        new_object->area.highlighted_font_type = new_object->area.font_type;
    }

    if ( new_object->area.selected_font_type == -1 )
    {

        new_object->area.selected_font_type = new_object->area.font_type;
    }

    ////////////////////////////////////////
    //
    // INTEGRATE INTO SYSTEM
    //
    ////////////////////////////////////////
}
Example #4
0
static void create_input_ui_object (ui_object *obj, ui_object_types type, va_list pargs)
{

   input_ui_object
      *new_input;

	increase_ui_object_counter ();

   ////////////////////////////////////////
   //
   // MALLOC ENTITY DATA
   //
   ////////////////////////////////////////

   obj->type   = type;

   new_input    = safe_malloc (sizeof (input_ui_object));

   obj->data   = new_input;

   ////////////////////////////////////////
   //
   // INITIALISE ALL ENTITY DATA TO 'WORKING' DEFAULT VALUES
   //
   // DO NOT USE ACCESS FUNCTIONS
   //
   // DO NOT USE RANDOM VALUES
   //
   ////////////////////////////////////////

   memset (new_input, 0, sizeof (input_ui_object));

   new_input->area.x = 0.0;
   new_input->area.y = 0.0;
   new_input->area.x_size = 0.0;
   new_input->area.y_size = ui_get_font_height ();
   new_input->area.x_origin = 0.0;
   new_input->area.y_origin = 0.0;
   new_input->area.drawable = 1;
   new_input->area.item_number = -1;
   new_input->area.redraw = 1;
   new_input->area.moveable = 0;
   new_input->area.resizeable = 0;
   new_input->area.notify_on = NOTIFY_TYPE_BUTTON_DOWN;
   new_input->area.parent = NULL;
   new_input->area.child = NULL;
   new_input->area.next = NULL;
   new_input->area.prev = NULL;
   new_input->area.font_id = get_ui_font ();

   new_input->area.text = NULL;

   new_input->draw_cursor = TRUE;
   new_input->cursor_timer = 0;

   ////////////////////////////////////////
   //
   // OVERWRITE DEFAULTS WITH GIVEN ATTRIBUTES
   //
   ////////////////////////////////////////

   set_ui_object_attributes (obj, pargs);

   ////////////////////////////////////////
   //
   // INTEGRATE INTO SYSTEM
   //
   ////////////////////////////////////////
}
Example #5
0
static void create_area_ui_object (ui_object *obj, ui_object_types type, va_list pargs)
{

   area_ui_object
      *new_object;

	increase_ui_object_counter ();

   ////////////////////////////////////////
   //
   // MALLOC ENTITY DATA
   //
   ////////////////////////////////////////

   obj->type = type;

   new_object = (area_ui_object*) safe_malloc (sizeof (area_ui_object));

   obj->data = new_object;

   ////////////////////////////////////////
   //
   // INITIALISE ALL ENTITY DATA TO 'WORKING' DEFAULT VALUES
   //
   // DO NOT USE ACCESS FUNCTIONS
   //
   // DO NOT USE RANDOM VALUES
   //
   ////////////////////////////////////////

   memset (new_object, 0, sizeof (area_ui_object));

   //new_object->x = 0.0;
   //new_object->y = 0.0;
   //new_object->x_size = 0.0;
   //new_object->y_size = 0.0;
   new_object->x_origin = 0.0;
   new_object->y_origin = 0.0;
   new_object->drawable = 1;
   new_object->item_number = -1;
   new_object->item_number2 = -1;				// DL - Wasn't initialised (should it be?)
   new_object->redraw = 1;
   new_object->text_justify = TEXT_JUSTIFY_CENTRE;
   new_object->state = UI_OBJECT_STATE_OFF;
   new_object->notify_on = NOTIFY_TYPE_BUTTON_UP;
   new_object->highlighted_notify_on = NOTIFY_TYPE_BUTTON_EITHER;
   new_object->moveable = 0;
   new_object->resizeable = 0;
   new_object->parent = NULL;
   new_object->child = NULL;
   new_object->next = NULL;
   new_object->prev = NULL;
	new_object->colour_start.r = 255;
	new_object->colour_start.g = 255;
	new_object->colour_start.b = 255;
	new_object->colour_start.a = 255;
	new_object->colour_end.r = 255;
	new_object->colour_end.g = 255;
	new_object->colour_end.b = 255;
	new_object->colour_end.a = 255;
   new_object->font_type = UI_FONT_ARIAL_10;
   new_object->font_colour_end = default_unselected_text_colour;
   new_object->font_colour_start = default_unselected_text_colour;
   new_object->highlighted_font_type = -1;
   new_object->highlighted_font_colour_end = default_selected_text_colour;
   new_object->highlighted_font_colour_start = default_selected_text_colour;
   new_object->selected_font_type = -1;
   new_object->selected_font_colour_end = default_selected_text_colour;
   new_object->selected_font_colour_start = default_selected_text_colour;
   new_object->user_flag1 = 0;
   new_object->user_flag2 = 0;
   new_object->user_flag3 = 0;
   new_object->user_flag4 = 0;
   new_object->user_ptr = NULL;

	new_object->time_length = 1.0;

   ////////////////////////////////////////
   //
   // OVERWRITE DEFAULTS WITH GIVEN ATTRIBUTES
   //
   ////////////////////////////////////////

   set_ui_object_attributes (obj, pargs);

   ////////////////////////////////////////
	//
	// Check the font default values & override them if not set
	//
   ////////////////////////////////////////

	if ( new_object->font_type == -1 )
	{

		new_object->font_type = get_ui_font_type ();
	}

	if ( new_object->highlighted_font_type == -1 )
	{

		new_object->highlighted_font_type = new_object->font_type;
	}

	if ( new_object->selected_font_type == -1 )
	{

		new_object->selected_font_type = new_object->font_type;
	}

   ////////////////////////////////////////
   //
   // INTEGRATE INTO SYSTEM
   //
   ////////////////////////////////////////
}