Você está na página 1de 6

PT MENU

Definition: It is a menu screen which consists of menu list in rows and columns.
Each menu list item consists of a bmp image and a text above it. User can specify any
number of rows and columns which can be displayed within the horizontal and vertical
resolution on screen. Navigation is provided with the four arrow keys UP, DOWN,
LEFT, RIGHT with the following rules.

Current Focus Key Press New Focus


First row, first column UP No Effect
First row, first column LEFT No Effect
First row, first column DOWN Second row, first column
First row, first column RIGHT First row, second column if
available. Otherwise Second
row, first column
Last row, last column DOWN No Effect
Last row, last column RIGHT No Effect
Last row, last column LEFT Last row, previous column
if available. Otherwise
previous row, first column
Last row, last column UP Previous row, first column
Any row, last column RIGHT Next row, first column
Any row, last column DOWN Next row, first column
Any row, last column LEFT Same row, previous column
Any row, last column UP Previous row, first column
Any row, first column LEFT Previous row, last column
Any row, first column RIGHT Same row, next column
Any row, first column DOWN Next row, first column
Any row, first column UP Previous row, first column
Any row, any column RIGHT Same row, next column
Any row, any column LEFT Same row, previous column
Any row, any column DOWN Next row, first column
Any row, any column UP Previous row, first column
Resource structure:
1. typedef struct _button_resource
{
o_pixmap_rl *pixmapImg;
char *text;
int x;
int y;

}button_resource;

pixmapImg : Pointer to image to be placed in this button.


text : Pointer to the text to be displayed on the image.
x : X coordinate of screen where the the button should appear.
y : Y coordinate of screen where the the button should appear.

2. typedef struct _menu_resource


{
int NoOfMenuItems;
int NoOfRows;
ID *groupList;
NavigationType state;

} menu_resource;

NoOfMenuItems : Total number of menu items in the menu list.


NoOfRows : Number of rows in the menu list.
groupList : Pointer to group id list
state : defines the type of navigation(Vertical, Horizontal or Both)

Private structure:
1. struct _button
{
o_shape shapes [4];
o_pixmap_rl *pixmapImg;
char *text;
int x;
int y;
ButtonState state;
};

shapes[4] : Array of shapes used in the gadget.


shapes[0] = BUTTON_BOX
shapes[1] = BUTTON_IMAGE
shapes[2] = BUTTON_TXT
shapes[3] = SHAPE_END
pixmapImg : Pointer to image to be placed in this button.
text : Pointer to the text to be displayed on the image.
x : X coordinate of gadget.
y : Y coordinate of gadget

2. struct _menu
{
o_shape *shapes;
int NoOfMenuItems;
int NoOfRows;
ID *groupList;
NavigationType state;

};

shapes : Pointer to shapes used in the gadget.


NoOfMenuItems : Total number of menu items in the menu list.
NoOfRows : Number of rows in the menu list.
groupList : Pointer to group id list
state : defines the type of navigation(Vertical, Horizontal or Both)

Public Functions:

1. init_button_class( ):

Prototype: void init_button_class( ID );


Return type: void
Argument(s) if any: button_resource_ID– a unique user defined identifier to
identify the button gadgetResource.

It initiates the button gadget class before use.

2. init_menu_class( menu_resource_ID ):
Prototype: void init_menu_class( ID );
Return type: void
Argument(s) if any: menu_resource_ID – a unique user defined identifier to
identify the menu gadgetResource.

It initiates the menu gadget class before use.


3. get_menu_params( ):
Prototype: menu_resource * get_menu_params( void );
Return type: menu_resource *
Argument(s) if any: void

It gets the menu resource parameters.

4. ShowHide_Arrow():
Prototype: void ShowHide_Arrow( ArrowType arrtype, DisplayStatus status );
Return type: void
Argument(s) if any: arrtype – indicates the arrow type (UP, DOWN, LEFT,
RIGHT).
status – indicates the display status (SHOW, HIDE)

It shows or hides the given arrtype according to the given status.

5. get_prev_row():
Prototype: int get_prev_row( o_gadget* );
Return type: int
Argument(s) if any: o_gadget* – pointer to the gadget

It returns the previous row index of the given gadget.

6. get_next_row():
Prototype: int get_next_row( o_gadget* );
Return type: int
Argument(s) if any: o_gadget* – pointer to the gadget

It returns the next row index of the given gadget.

7. handle_arrow_icons():
Prototype: void handle_arrow_icons( group * this );
Return type: void
Argument(s) if any: this –pointer to the button gadget.

It handles the display of the arrow icons according to the current focused gadget.
Private Functions:

1. button_message_handler() :
Prototype: void button_message_handler( button * this, o_message * msg );
Return type: void
Argument(s) if any: this –pointer to the button gadget.
msg – pointer to the UIMS generated message from the
application.

It handles all the UIMS generated messages received and forwarded by the
application.

2. handle_key_up() :
Prototype: void handle_key_up( button * this, o_message *msg )
Return type: void
Argument(s) if any: this –pointer to the button gadget.
msg – pointer to the UIMS generated message from the
application.

It sets the current button state to FOCUSED.

3. handle_key_down( )
Prototype: handle_key_down( keyBoard * this, o_message *msg )
Return type: void
Argument(s) if any: this –pointer to the gadget.
msg – pointer to the UIMS generated message from the
application.

It sets the current button state to DOWN.

4. set_button_state()
Prototype: void set_button_state( button * this, ButtonState state )
Return type: void
Argument(s) if any: this –pointer to the button gadget.
state – can be any of the button state (IDLE, FOCUSED,
DOWN)
Change the appearance of the button to reflect the new state. Based on the
state, we choose the corresponding set of shape attributes and apply them to the
box part of the button.

5. menu_class_message_handler() :
Prototype: void menu_class_message_handler( menu * this, o_message *
msg)

Return type: void


Argument(s) if any: this –pointer to the menu gadget.
msg – pointer to the UIMS generated message from the
application.

It handles all the UIMS generated messages received and forwarded by the
application.

Você também pode gostar