- changed title to Implementation of Login Screen for cgraphic
- edited description
Implementation of Login Screen for cgraphic
Issue #261
new
Implementation reason
The system has to be protected against unauthorized access also in GUI
Generic Description
The goal of the task is to implement login screen in cgraphic program.
View of the login screen:
Required Interface
typedef enum { ScreenID_Loading , ScreenID_Login , ScreenID_SystemHandler , ScreenID_NumberOfElements } ScreenID_t; typedef enum { WidgetID_Login_Logo = 0, WidgetID_Login_LoginString , WidgetID_Login_PasswordString , WidgetID_Login_LoginBox , WidgetID_Login_PasswordBox , WidgetID_Login_Button , WidgetID_Login_Keyboard , WidgetID_Login_Terminal , WidgetID_Login_NumberOfElements , } WidgetID_t; typedef enum { Color_White = 0xf3f3f3 , Color_Black = 0x000000 , Color_BrightLeading = 0xe69138 , Color_NormalLeading = 0xb45f06 , Color_DarkLeading = 0x783f04 , Color_BrightSupporting = 0xacacac , Color_NormalSupporting = 0x595959 , Color_DarkSupporting = 0x323232 , Color_BrightGold = 0xf1c232 , Color_NormalGold = 0xbf9000 , Color_DarkGold = 0x7f6000 , Color_BrightBlue = 0x45818e , Color_NormalBlue = 0x134f5c , Color_DarkBlue = 0x0c343d , } Color_t; const oC_WidgetScreen_Palette_t cgraphics_TerminalPalette = { [ oC_WidgetScreen_WidgetState_Ready ] = { .ColorFormat = oC_ColorFormat_RGB888 , .TextColor = Color_White , .FillColor = Color_Black , .BorderColor = Color_White , } , [ oC_WidgetScreen_WidgetState_Pressed ] = { .ColorFormat = oC_ColorFormat_RGB888 , .TextColor = Color_White , .FillColor = Color_Black , .BorderColor = Color_White , } , [ oC_WidgetScreen_WidgetState_Activated ] = { .ColorFormat = oC_ColorFormat_RGB888 , .TextColor = Color_White , .FillColor = Color_Black , .BorderColor = Color_White , } , [ oC_WidgetScreen_WidgetState_Hovered ] = { .ColorFormat = oC_ColorFormat_RGB888 , .TextColor = Color_White , .FillColor = Color_Black , .BorderColor = Color_White , } , [ oC_WidgetScreen_WidgetState_Disabled ] = { .ColorFormat = oC_ColorFormat_RGB888 , .TextColor = Color_White , .FillColor = Color_Black , .BorderColor = Color_White , } , }; const oC_WidgetScreen_Palette_t cgraphics_WidgetOnWhitePalette = { [ oC_WidgetScreen_WidgetState_Ready ] = { .ColorFormat = oC_ColorFormat_RGB888 , .TextColor = Color_White , .FillColor = Color_BrightLeading , .BorderColor = Color_NormalLeading , } , [ oC_WidgetScreen_WidgetState_Pressed ] = { .ColorFormat = oC_ColorFormat_RGB888 , .TextColor = Color_NormalLeading , .FillColor = Color_DarkLeading , .BorderColor = Color_NormalLeading , } , [ oC_WidgetScreen_WidgetState_Activated ] = { .ColorFormat = oC_ColorFormat_RGB888 , .TextColor = Color_White , .FillColor = Color_DarkLeading , .BorderColor = Color_White , } , [ oC_WidgetScreen_WidgetState_Hovered ] = { .ColorFormat = oC_ColorFormat_RGB888 , .TextColor = Color_White , .FillColor = Color_NormalLeading , .BorderColor = Color_DarkLeading , } , [ oC_WidgetScreen_WidgetState_Disabled ] = { .ColorFormat = oC_ColorFormat_RGB888 , .TextColor = Color_BrightLeading , .FillColor = Color_NormalLeading , .BorderColor = Color_DarkLeading , } , }; const oC_WidgetScreen_Palette_t cgraphics_WidgetOnLeadingPalette = { [ oC_WidgetScreen_WidgetState_Ready ] = { .ColorFormat = oC_ColorFormat_RGB888 , .TextColor = Color_White , .FillColor = Color_NormalLeading , .BorderColor = Color_White , } , [ oC_WidgetScreen_WidgetState_Pressed ] = { .ColorFormat = oC_ColorFormat_RGB888 , .TextColor = Color_NormalLeading , .FillColor = Color_DarkLeading , .BorderColor = Color_NormalLeading , } , [ oC_WidgetScreen_WidgetState_Activated ] = { .ColorFormat = oC_ColorFormat_RGB888 , .TextColor = Color_White , .FillColor = Color_DarkLeading , .BorderColor = Color_White , } , [ oC_WidgetScreen_WidgetState_Hovered ] = { .ColorFormat = oC_ColorFormat_RGB888 , .TextColor = Color_White , .FillColor = Color_NormalLeading , .BorderColor = Color_DarkLeading , } , [ oC_WidgetScreen_WidgetState_Disabled ] = { .ColorFormat = oC_ColorFormat_RGB888 , .TextColor = Color_BrightLeading , .FillColor = Color_NormalLeading , .BorderColor = Color_NormalLeading , } , }; const oC_WidgetScreen_DrawStyle_t cgraphic_DrawStyle_Default = { [ oC_WidgetScreen_WidgetState_Ready ] = { .BorderStyle = oC_WidgetScreen_BorderStyle_Solid , .BorderWidth = 1, .DrawFill = true, .DrawText = true, .Opacity = 255, } , [ oC_WidgetScreen_WidgetState_Pressed ] = { .BorderStyle = oC_WidgetScreen_BorderStyle_Solid , .BorderWidth = 2, .DrawFill = true, .DrawText = true, .Opacity = 255, } , [ oC_WidgetScreen_WidgetState_Activated ] = { .BorderStyle = oC_WidgetScreen_BorderStyle_Solid , .BorderWidth = 1, .DrawFill = true, .DrawText = true, .Opacity = 255, } , [ oC_WidgetScreen_WidgetState_Hovered ] = { .BorderStyle = oC_WidgetScreen_BorderStyle_Solid , .BorderWidth = 2, .DrawFill = true, .DrawText = true, .Opacity = 255, } , [ oC_WidgetScreen_WidgetState_Disabled ] = { .BorderStyle = oC_WidgetScreen_BorderStyle_Solid , .BorderWidth = 2, .DrawFill = true, .DrawText = true, .Opacity = 255, } , }; const oC_WidgetScreen_DrawStyle_t cgraphic_DrawStyle_Opacity = { [ oC_WidgetScreen_WidgetState_Ready ] = { .BorderStyle = oC_WidgetScreen_BorderStyle_Solid , .BorderWidth = 1, .DrawFill = true, .DrawText = true, .Opacity = 128, } , [ oC_WidgetScreen_WidgetState_Pressed ] = { .BorderStyle = oC_WidgetScreen_BorderStyle_Solid , .BorderWidth = 2, .DrawFill = true, .DrawText = true, .Opacity = 128, } , [ oC_WidgetScreen_WidgetState_Activated ] = { .BorderStyle = oC_WidgetScreen_BorderStyle_Solid , .BorderWidth = 1, .DrawFill = true, .DrawText = true, .Opacity = 128, } , [ oC_WidgetScreen_WidgetState_Hovered ] = { .BorderStyle = oC_WidgetScreen_BorderStyle_Solid , .BorderWidth = 2, .DrawFill = true, .DrawText = true, .Opacity = 128, } , [ oC_WidgetScreen_WidgetState_Disabled ] = { .BorderStyle = oC_WidgetScreen_BorderStyle_Solid , .BorderWidth = 2, .DrawFill = true, .DrawText = true, .Opacity = 128, } , }; void cgraphic_Login_StringChanged( oC_WidgetScreen_t Screen, oC_WidgetScreen_UserContext_t Context , oC_WidgetScreen_WidgetIndex_t WidgetIndex , const char * String ); const oC_WidgetScreen_WidgetDefinition_t cgraphic_Login_Widgets[WidgetID_Login_NumberOfElements] = { [ WidgetID_Login_Logo ] = { .Type = oC_WidgetScreen_WidgetType_Image, .Position = { } , .Height = 0 , .Width = 0 , .ZPosition = 1 , .Palette = cgraphics_WidgetOnWhitePalette, .DrawStyle = cgraphic_DrawStyle_Default, .ImagePath = "/flash/chocoos.png", } , [ WidgetID_Login_LoginString ] = { .Type = oC_WidgetScreen_WidgetType_TextBox, .Position = { } , .Height = 0 , .Width = 0 , .ZPosition = 1 , .Palette = cgraphics_WidgetOnWhitePalette, .DrawStyle = cgraphic_DrawStyle_Default, .String = { .DefaultString = "Login" , .Font = oC_Font_(Consolas8pt), .TextAlign = oC_WidgetScreen_TextAlign_Left , .VerticalTextAlign = oC_WidgetScreen_VerticalTextAlign_Center , .UpdateStringHandler = NULL, } , } , [ WidgetID_Login_PasswordString ] = { .Type = oC_WidgetScreen_WidgetType_TextBox, .Position = { } , .Height = 0 , .Width = 0 , .ZPosition = 1 , .Palette = cgraphics_WidgetOnWhitePalette, .DrawStyle = cgraphic_DrawStyle_Default, .String = { .DefaultString = "Password" , .Font = oC_Font_(Consolas8pt), .TextAlign = oC_WidgetScreen_TextAlign_Left , .VerticalTextAlign = oC_WidgetScreen_VerticalTextAlign_Center , .UpdateStringHandler = NULL, } , } , [ WidgetID_Login_LoginBox ] = { .Type = oC_WidgetScreen_WidgetType_EditBox, .Position = { } , .Height = 0 , .Width = 0 , .ZPosition = 1 , .Palette = cgraphics_WidgetOnWhitePalette, .DrawStyle = cgraphic_DrawStyle_Default, .String = { .DefaultString = "" , .Font = oC_Font_(Consolas8pt), .TextAlign = oC_WidgetScreen_TextAlign_Left , .VerticalTextAlign = oC_WidgetScreen_VerticalTextAlign_Center , .UpdateStringHandler = cgraphic_Login_UpdateLogin, } , .EditBox = { } , } , [ WidgetID_Login_PasswordBox ] = { .Type = oC_WidgetScreen_WidgetType_EditBox, .Position = { } , .Height = 0 , .Width = 0 , .ZPosition = 1 , .Palette = cgraphics_WidgetOnWhitePalette, .DrawStyle = cgraphic_DrawStyle_Default, .String = { .DefaultString = "" , .Font = oC_Font_(Consolas8pt), .TextAlign = oC_WidgetScreen_TextAlign_Left , .VerticalTextAlign = oC_WidgetScreen_VerticalTextAlign_Center , .UpdateStringHandler = cgraphic_Login_UpdateLogin, } , .EditBox = { } , } , [ WidgetID_Login_Button ] = { .Type = oC_WidgetScreen_WidgetType_PushButton, .Position = { } , .Height = 0 , .Width = 0 , .ZPosition = 1 , .Palette = cgraphics_WidgetOnWhitePalette, .DrawStyle = cgraphic_DrawStyle_Default, .String = { .DefaultString = "LOGIN" , .Font = oC_Font_(Consolas8pt), .TextAlign = oC_WidgetScreen_TextAlign_Center , .VerticalTextAlign = oC_WidgetScreen_VerticalTextAlign_Center , .UpdateStringHandler = NULL, } , .PushButton = { .Type = oC_WidgetScreen_PushButtonType_Standard , } , } , [ WidgetID_Login_Keyboard ] = { .Type = oC_WidgetScreen_WidgetType_PushButton, .Position = { } , .Height = 0 , .Width = 0 , .ZPosition = 1 , .Palette = cgraphics_WidgetOnWhitePalette, .DrawStyle = cgraphic_DrawStyle_Default, .String = { .DefaultString = "" , .Font = oC_Font_(Consolas8pt), .TextAlign = oC_WidgetScreen_TextAlign_Center , .VerticalTextAlign = oC_WidgetScreen_VerticalTextAlign_Center , .UpdateStringHandler = NULL, .StringChangedHandler= cgraphic_Login_StringChanged, } , .Keyboard = { .BackgroundColor = Color_BrightLeading, .ColorFormat = oC_ColorFormat_RGB888, } , } , [ WidgetID_Login_Terminal ] = { .Type = oC_WidgetScreen_WidgetType_ProgressBar, .Position = { } , .Height = 0 , .Width = 0 , .ZPosition = 1 , .Palette = cgraphics_WidgetOnWhitePalette, .DrawStyle = cgraphic_DrawStyle_Default, } , }; void cgraphic_Login_UpdateLogin( oC_WidgetScreen_t Screen , oC_WidgetScreen_UserContext_t Context , oC_WidgetScreen_WidgetIndex_t WidgetIndex , char * outString, oC_MemorySize_t BufferLength ); void cgraphic_Login_UpdatePassword( oC_WidgetScreen_t Screen , oC_WidgetScreen_UserContext_t Context , oC_WidgetScreen_WidgetIndex_t WidgetIndex , char * outString, oC_MemorySize_t BufferLength ); oC_WidgetScreen_ScreenId_t cgraphic_Login_ButtonPressedHandler( oC_WidgetScreen_t Screen , oC_WidgetScreen_UserContext_t Context , oC_WidgetScreen_WidgetIndex_t WidgetIndex , oC_WidgetScreen_ScreenId_t ScreenID , bool * outReprepareScreen ); const oC_WidgetScreen_WidgetDefinition_t cgraphic_Login_Widgets[WidgetID_Login_NumberOfElements] = { [ WidgetID_Login_Logo ] = { .Type = oC_WidgetScreen_WidgetType_Image, .Position = { } , .Height = 0 , .Width = 0 , .ZPosition = 1 , .Palette = cgraphics_WidgetOnWhitePalette, .DrawStyle = cgraphic_DrawStyle_Default, .ImagePath = "/flash/chocoos.png", } , [ WidgetID_Login_LoginString ] = { .Type = oC_WidgetScreen_WidgetType_TextBox, .Position = { } , .Height = 0 , .Width = 0 , .ZPosition = 1 , .Palette = cgraphics_WidgetOnWhitePalette, .DrawStyle = cgraphic_DrawStyle_Default, .String = { .DefaultString = "Login" , .Font = oC_Font_(Consolas8pt), .TextAlign = oC_WidgetScreen_TextAlign_Left , .VerticalTextAlign = oC_WidgetScreen_VerticalTextAlign_Center , .UpdateStringHandler = NULL, } , } , [ WidgetID_Login_PasswordString ] = { .Type = oC_WidgetScreen_WidgetType_TextBox, .Position = { } , .Height = 0 , .Width = 0 , .ZPosition = 1 , .Palette = cgraphics_WidgetOnWhitePalette, .DrawStyle = cgraphic_DrawStyle_Default, .String = { .DefaultString = "Password" , .Font = oC_Font_(Consolas8pt), .TextAlign = oC_WidgetScreen_TextAlign_Left , .VerticalTextAlign = oC_WidgetScreen_VerticalTextAlign_Center , .UpdateStringHandler = NULL, } , } , [ WidgetID_Login_LoginBox ] = { .Type = oC_WidgetScreen_WidgetType_EditBox, .Position = { } , .Height = 0 , .Width = 0 , .ZPosition = 1 , .Palette = cgraphics_WidgetOnWhitePalette, .DrawStyle = cgraphic_DrawStyle_Default, .String = { .DefaultString = "" , .Font = oC_Font_(Consolas8pt), .TextAlign = oC_WidgetScreen_TextAlign_Left , .VerticalTextAlign = oC_WidgetScreen_VerticalTextAlign_Center , .UpdateStringHandler = cgraphic_Login_UpdateLogin, } , .EditBox = { } , } , [ WidgetID_Login_PasswordBox ] = { .Type = oC_WidgetScreen_WidgetType_EditBox, .Position = { } , .Height = 0 , .Width = 0 , .ZPosition = 1 , .Palette = cgraphics_WidgetOnWhitePalette, .DrawStyle = cgraphic_DrawStyle_Default, .String = { .DefaultString = "" , .Font = oC_Font_(Consolas8pt), .TextAlign = oC_WidgetScreen_TextAlign_Left , .VerticalTextAlign = oC_WidgetScreen_VerticalTextAlign_Center , .UpdateStringHandler = cgraphic_Login_UpdatePassword, } , .EditBox = { } , } , [ WidgetID_Login_Button ] = { .Type = oC_WidgetScreen_WidgetType_PushButton, .Position = { } , .Height = 0 , .Width = 0 , .ZPosition = 1 , .Palette = cgraphics_WidgetOnWhitePalette, .DrawStyle = cgraphic_DrawStyle_Default, .Handlers[ WidgetState_Pressed ] = cgraphic_Login_ButtonPressedHandler , .String = { .DefaultString = "LOGIN" , .Font = oC_Font_(Consolas8pt), .TextAlign = oC_WidgetScreen_TextAlign_Center , .VerticalTextAlign = oC_WidgetScreen_VerticalTextAlign_Center , .UpdateStringHandler = NULL, } , .PushButton = { .Type = oC_WidgetScreen_PushButtonType_Standard , } , } , [ WidgetID_Login_Keyboard ] = { .Type = oC_WidgetScreen_WidgetType_PushButton, .Position = { } , .Height = 0 , .Width = 0 , .ZPosition = 1 , .Palette = cgraphics_WidgetOnWhitePalette, .DrawStyle = cgraphic_DrawStyle_Default, .String = { .DefaultString = "" , .Font = oC_Font_(Consolas8pt), .TextAlign = oC_WidgetScreen_TextAlign_Center , .VerticalTextAlign = oC_WidgetScreen_VerticalTextAlign_Center , .UpdateStringHandler = NULL, } , .Keyboard = { } , } , [ WidgetID_Login_Terminal ] = { .Type = oC_WidgetScreen_WidgetType_ProgressBar, .Position = { } , .Height = 0 , .Width = 0 , .ZPosition = 1 , .Palette = cgraphics_WidgetOnWhitePalette, .DrawStyle = cgraphic_DrawStyle_Default, } , }; extern oC_WidgetScreen_ScreenId_t cgraphic_Login_Prepare( oC_WidgetScreen_t Screen , oC_WidgetScreen_UserContext_t Context , oC_WidgetScreen_ScreenId_t ScreenID ); extern oC_WidgetScreen_ScreenId_t cgraphic_Login_Handler( oC_WidgetScreen_t Screen , oC_WidgetScreen_UserContext_t Context , oC_WidgetScreen_ScreenId_t ScreenID ); extern const oC_WidgetScreen_WidgetDefinition_t cgraphic_Login_Widgets[WidgetID_Login_NumberOfElements]; static const oC_WidgetScreen_ScreenDefinition_t Definitions[] = { [ ScreenID_Login ] = { .Position = { 0, 0 } , .Height = 480 , .Width = 272 , .BackgroundColor = Color_White , .ColorFormat = oC_ColorFormat_RGB888 , .PrepareHandler = cgraphic_Login_Prepare , .Handler = cgraphic_Login_Handler , .WidgetsDefinitions = cgraphic_Login_Widgets , .NumberOfWidgetsDefinitions = WidgetID_Login_NumberOfElements , } , }
Bitbucket
https://bitbucket.org/chocos/chocos/issues/261/implementation-of-login-screen-for-cgraphic
Trello
Story
- [ #240 ] - Preparation of the sample graphic program
List of requirements
Comments (4)
-
reporter -
reporter - edited description
-
reporter - edited description
-
reporter - edited description
- Log in to comment