26 extern const u16 ButtonMenuBmp[];
27 extern const u16 ButtonLowSoundHPBmp[];
28 extern const u16 ButtonHighSoundHPBmp[];
29 extern const u16 ButtonMuteHPBmp[];
30 extern const u16 ButtonSoundHPBmp[];
31 extern const u16 ButtonLowSoundLSBmp[];
32 extern const u16 ButtonHighSoundLSBmp[];
33 extern const u16 ButtonMuteLSBmp[];
34 extern const u16 ButtonSoundLSBmp[];
43 s32 ScreenButton = -1;
44 s32 CurOrientation =
V12;
45 s32 OldOrientation =
V12;
46 s32 RedrawToolbarRequest;
58 { ButtonMenuBmp, fDefaultAction },
59 { ButtonLowSoundLSBmp, fLowSound },
60 { ButtonHighSoundLSBmp, fHighSound },
61 { ButtonMuteLSBmp, fMuteSound },
78 NODEBUG
void TOOLBAR_Init(
void )
97 void TOOLBAR_Handler(
void )
100 s32 OldButton = ScreenButton;
116 X = TOUCHSCR_Info.xAbsPos;
117 Y = TOUCHSCR_Info.yAbsPos;
120 if ( Y > APP_SCREEN_HEIGHT )
124 if ( ScreenButton > ( CurrentToolbar->
NbItems - 1 ) )
126 ScreenButton = CurrentToolbar->
NbItems - 1;
128 if ( ScreenButton < 0 )
140 if ( RedrawToolbarRequest )
142 if ( ( RedrawToolbarRequest >> 4 ) )
145 CurrentToolbar = &DefaultToolbar;
146 if ( AUDIO_SpeakerOn )
163 if ( RedrawToolbarRequest & 0x0F )
166 for ( i = 0 ; i < CurrentToolbar->
NbItems ; i++ )
168 if ( ( RedrawToolbarRequest >> i ) & 1 )
169 TOOLBAR_UnSelectButton( i );
174 RedrawToolbarRequest = 0;
178 OldOrientation = CurOrientation;
186 if ( OldButton != ScreenButton )
188 if ( OldButton != -1 )
189 TOOLBAR_UnSelectButton( OldButton );
191 if ( ScreenButton != -1 )
192 TOOLBAR_SelectButton( ScreenButton );
210 void TOOLBAR_UnSelectButton( u16 button )
212 TOOLBAR_Button( button, DEFAULT_BUTTON_BGND, DEFAULT_BUTTON_BGND, FALSE );
228 void TOOLBAR_SelectButton( u16 button )
233 TOOLBAR_Button( button, DEFAULT_BUTTON_BGND, ACTIVE_BUTTON_BGND, TRUE ) ;
238 BUZZER_SetFrequency( 440 );
271 void TOOLBAR_Button( u16 button, u16 bgnd_color, u16 bgnd_color_sel,
bool sel )
273 s32 index, deltaWidth, deltaHeight, Icon_Width, Icon_Height;
274 coord_t Save_Screen_Width, Save_Screen_Height, Save_LCD_Offset;
280 if ( ( CurrentToolbar->
Items[index].
icon[0] == 0x424D ) && ( CurrentToolbar->
Items[index].
icon[3] == 0 ) )
282 Icon_Width = ( CurrentToolbar->
Items[index].
icon[9] ) >> 8;
283 Icon_Height = ( CurrentToolbar->
Items[index].
icon[11] ) >> 8;
298 Save_LCD_Offset = LCD_Offset;
301 Screen_Width = APP_SCREEN_WIDTH;
302 Screen_Height = APP_SCREEN_HEIGHT;
312 bgnd_color, bgnd_color_sel );
316 DRAW_Line_Circle(
BUTTON_WIDTH * button, APP_SCREEN_HEIGHT,
BUTTON_WIDTH * ( button + 1 ) - 1, APP_SCREEN_HEIGHT, RGB_BUTTON_SEPARATOR );
318 if ( index != ( CurrentToolbar->
NbItems - 1 ) )
327 bgnd_color, bgnd_color_sel );
331 DRAW_Line_Circle( APP_SCREEN_WIDTH,
BUTTON_WIDTH * ( CurrentToolbar->
NbItems - button - 1 ), APP_SCREEN_WIDTH,
BUTTON_WIDTH * ( CurrentToolbar->
NbItems - button ), RGB_BUTTON_SEPARATOR );
333 if ( index != ( CurrentToolbar->
NbItems - 1 ) )
342 bgnd_color, bgnd_color_sel );
348 if ( index != ( CurrentToolbar->
NbItems - 1 ) )
357 bgnd_color, bgnd_color_sel );
363 if ( index != ( CurrentToolbar->
NbItems - 1 ) )
372 Screen_Width = Save_Screen_Width;
373 Screen_Height = Save_Screen_Height;
374 LCD_Offset = Save_LCD_Offset;
398 if ( AUDIO_SpeakerOn )
408 index_t CurrentApplicationIndex = -1;
410 if ( fInitDone == FALSE )
417 if ( APP_LaunchAppli( CurrentApplicationIndex ) ==
MENU_LEAVE )
444 void TOOLBAR_RedrawToolbar( s32 Request )
446 RedrawToolbarRequest |= Request;
465 CurrentToolbar = (
tToolbar* ) NewToolbar;
466 TOOLBAR_RedrawToolbar( TOOLBAR_REDRAW );
482 TOOLBAR_RedrawToolbar( TOOLBAR_DEFAULT );
501 CurrentToolbar->
Items[button].
icon = newicon;
503 TOOLBAR_RedrawToolbar( 1 << button );