Exemplo n.º 1
0
void Horizontal_paned::Set_pane_position(float p)
{
	float pane_size = Get_value(PANE);
	float max_x = Get_size().x-pane_size;
	pane_position = p<0?0:p>max_x?max_x:p;
	pane_reference = pane_position/max_x;
	Organise();
}
Exemplo n.º 2
0
/*-----------------------------------------------------------------*/
int main(void) {
   char command;
   int  value;
   struct list_node_s* head_p = NULL;  
      /* start with empty list */

   command = Get_command();
   while (command != 'q' && command != 'Q') {
      switch (command) {
         case 'i': 
         case 'I': 
            value = Get_value();
            Insert(head_p, value);
            break;
         case 'p':
         case 'P':
            Print(head_p);
            break;
         case 'm': 
         case 'M':
            value = Get_value();
            printf("Member not implemented\n");
            break;
         case 'd':
         case 'D':
            value = Get_value();
            printf("Delete not implemented\n");
            break;
         case 'f':
         case 'F':
            printf("Free list not implemented\n");
            break;
         default:
            printf("There is no %c command\n", command);
            printf("Please try again\n");
      }
      command = Get_command();
   }

   // Free_list

   return 0;
}  /* main */
Exemplo n.º 3
0
void Expander::Handle_event(const ALLEGRO_EVENT& event)
{
	if(child && Is_open())
		child->Handle_event(event);

	if(ALLEGRO_EVENT_MOUSE_BUTTON_UP == event.type)
	{
		Vector2 p = Get_position();
		bool covers_point = Covers_point(event.mouse.x, event.mouse.y);

		if(covers_point && event.mouse.y<p.y+Get_value(SELF_HEIGHT))
		{
			if(event.mouse.x < p.x+Get_value(INDENT))
			{
				if(Is_open())
					Close();
				else
					Open();
			}
		}
	}
}
Exemplo n.º 4
0
/*-----------------------------------------------------------------*/
int main(void) {
   char command;
   int  value;
   struct list_node_s* head_p = NULL;  /* start with empty list */

   command = Get_command();
   while (command != 'q' && command != 'Q') {
      switch (command) {
         case 'i': 
         case 'I': 
            value = Get_value();
            Insert(value, &head_p);  /* Ignore return value */
            break;
         case 'p':
         case 'P':
            Print(head_p);
            break;
         case 'm': 
         case 'M':
            value = Get_value();
            Member(value, head_p);   /* Ignore return value */
            break;
         case 'd':
         case 'D':
            value = Get_value();
            Delete(value, &head_p);  /* Ignore return value */
            break;
         default:
            printf("There is no %c command\n", command);
            printf("Please try again\n");
      }
      command = Get_command();
   }
   Free_list(&head_p);

   return 0;
}  /* main */
Exemplo n.º 5
0
void Horizontal_paned::Organise()
{
	Vector2 position = Get_position();
	Vector2 size = Get_size();
	float pane_size = Get_value(PANE);
	float leftsize = pane_position;
	float rightsize = size.x-pane_size-leftsize;
	if(left)
	{
		left->Set_position(position);
		left->Set_size(Vector2(leftsize, size.y));
	}
	if(right)
	{
		right->Set_position(Vector2(position.x+leftsize+pane_size, position.y));
		right->Set_size(Vector2(rightsize, size.y));
	}
}
Exemplo n.º 6
0
void Vertical_paned::Organise()
{
	Vector2 position = Get_position();
	Vector2 size = Get_size();
	float topsize = pane_position;
	float pane_size = Get_value(PANE);
	float bottomsize = size.y-pane_size-topsize;
	if(top)
	{
		top->Set_position(position);
		top->Set_size(Vector2(size.x, topsize));
	}
	if(bottom)
	{
		bottom->Set_position(Vector2(position.x, position.y+topsize+pane_size));
		bottom->Set_size(Vector2(size.x, bottomsize));
	}
	Calculate_request_size();
}