- edited description
Add support of Keyboard widget
Issue #250
new
Implementation reason
The system handles touch screen but currently it is not possible to enter a string without PC for example in the terminal or programs.
Generic Description
The system has to allow for insertion of characters by using touch screen. Programs like cgraphic
needs it for example to allow users to login.
###Example view of uppercase letters page###
###Example view of lowercase letters page###
###Example view of numbers+special keys###
###Example view of numbers+special keys with shift###
###Example view of function keys###
Required Interface
typedef enum { oC_WidgetScreen_WidgetType_None = 0 , oC_WidgetScreen_WidgetType_EditBox , oC_WidgetScreen_WidgetType_TextBox , oC_WidgetScreen_WidgetType_PushButton , oC_WidgetScreen_WidgetType_CheckBox , oC_WidgetScreen_WidgetType_RadioButton , oC_WidgetScreen_WidgetType_ProgressBar , oC_WidgetScreen_WidgetType_Image , oC_WidgetScreen_WidgetType_Keyboard , oC_WidgetScreen_WidgetType_NumberOfTypes , } oC_WidgetScreen_WidgetType_t; typedef enum { WidgetType_TextBox = oC_WidgetScreen_WidgetType_TextBox, WidgetType_PushButton = oC_WidgetScreen_WidgetType_PushButton, WidgetType_CheckBox = oC_WidgetScreen_WidgetType_CheckBox, WidgetType_RadioButton = oC_WidgetScreen_WidgetType_RadioButton, WidgetType_ProgressBar = oC_WidgetScreen_WidgetType_ProgressBar, WidgetType_Image = oC_WidgetScreen_WidgetType_Image, WidgetType_Keyboard = oC_WidgetScreen_WidgetType_Keyboard, WidgetType_NumberOfTypes = oC_WidgetScreen_WidgetType_NumberOfTypes, } WidgetType_t; // Index of keyboard page (set of keys) typedef enum { oC_WidgetScreen_KeyboardPage_0 = 0, oC_WidgetScreen_KeyboardPage_1, oC_WidgetScreen_KeyboardPage_2, oC_WidgetScreen_KeyboardPage_3, oC_WidgetScreen_KeyboardPage_4, oC_WidgetScreen_KeyboardPage_5, oC_WidgetScreen_KeyboardPage_6, oC_WidgetScreen_KeyboardPage_7, oC_WidgetScreen_KeyboardPage_8, oC_WidgetScreen_KeyboardPage_9, oC_WidgetScreen_KeyboardPage_Max } oC_WidgetScreen_KeyboardPage_t; typedef enum { oC_WidgetScreen_KeyID__CharactersKeys = 0, oC_WidgetScreen_KeyID__SpecialKeys = 0x1000 , oC_WidgetScreen_KeyID_ChangePage, oC_WidgetScreen_KeyID_ESC, oC_WidgetScreen_KeyID_F1, oC_WidgetScreen_KeyID_F2, oC_WidgetScreen_KeyID_F3, oC_WidgetScreen_KeyID_F4, oC_WidgetScreen_KeyID_F5, oC_WidgetScreen_KeyID_F6, oC_WidgetScreen_KeyID_F7, oC_WidgetScreen_KeyID_F8, oC_WidgetScreen_KeyID_F9, oC_WidgetScreen_KeyID_F10, oC_WidgetScreen_KeyID_F11, oC_WidgetScreen_KeyID_F12, oC_WidgetScreen_KeyID_PrintScreen, oC_WidgetScreen_KeyID_ScrollLock, oC_WidgetScreen_KeyID_PauseBreak, oC_WidgetScreen_KeyID_Insert, oC_WidgetScreen_KeyID_Delete, oC_WidgetScreen_KeyID_PageUp, oC_WidgetScreen_KeyID_PageDown, oC_WidgetScreen_KeyID_Home, oC_WidgetScreen_KeyID_End, oC_WidgetScreen_KeyID_TAB, oC_WidgetScreen_KeyID_CapsLock, oC_WidgetScreen_KeyID_LeftShift, oC_WidgetScreen_KeyID_LeftCtrl, oC_WidgetScreen_KeyID_LeftFn, oC_WidgetScreen_KeyID_LeftAlt, oC_WidgetScreen_KeyID_Space, oC_WidgetScreen_KeyID_RightAlt, oC_WidgetScreen_KeyID_RightWin, oC_WidgetScreen_KeyID_RightCtrl, oC_WidgetScreen_KeyID_RightShift, oC_WidgetScreen_KeyID_Enter, oC_WidgetScreen_KeyID_Backspace, oC_WidgetScreen_KeyID_NumLock, oC_WidgetScreen_KeyID_ArrowUp, oC_WidgetScreen_KeyID_ArrowLeft, oC_WidgetScreen_KeyID_ArrowDown, oC_WidgetScreen_KeyID_ArrowRight, } oC_WidgetScreen_KeyID_t; // Type for storing definition of key typedef struct oC_WidgetScreen_Key_t { oC_WidgetScreen_KeyID_t ID; oC_DefaultString_t Title; union { oC_WidgetScreen_KeyboardPage_t KeyboardPage; const struct oC_WidgetScreen_Key_t * LeftAltKey; // alternative function when left alt modificator is pressed const struct oC_WidgetScreen_Key_t * RightAltKey; // alternative function when right alt modificator is pressed const struct oC_WidgetScreen_Key_t * ShiftKey; // alternative function when shift modificator is presses } Argument; } oC_WidgetScreen_Key_t; // Definition of keyboard button typedef struct { oC_DefaultString_t String; oC_Pixel_Position_t Position; oC_Pixel_ResolutionUInt_t Width; oC_Pixel_ResolutionUInt_t Height; oC_WidgetScreen_Key_t Key; } oC_WidgetScreen_KeyboardButtonDefinition_t; // Type for storing ID of button in the keyboard page typedef uint16_t oC_WidgetScreen_KeyboardButtonID_t; // Type for storing set of keyboard keys typedef struct { oC_DefaultString_t Title; // Title of the page with buttons oC_WidgetScreen_KeyboardButtonID_t NumberOfButtons; // Number of defined buttons on the page const oC_WidgetScreen_KeyboardButtonDefinition_t * Buttons; // Pointer to the array with keys } oC_WidgetScreen_KeyboardPageDefinition_t; // Default definitions of keyboard pages to use in keyboard widget // Keyboard page with letters extern const oC_WidgetScreen_KeyboardPageDefinition_t oC_WidgetScreen_KeyboardPageDefinition_Letters; // Keyboard page with numbers only extern const oC_WidgetScreen_KeyboardPageDefinition_t oC_WidgetScreen_KeyboardPageDefinition_Numbers; // Keyboard page with numbers and special keys extern const oC_WidgetScreen_KeyboardPageDefinition_t oC_WidgetScreen_KeyboardPageDefinition_NumbersAndSpecial; // Keyboard page with function keys like F1, F2, ESC, etc ... extern const oC_WidgetScreen_KeyboardPageDefinition_t oC_WidgetScreen_KeyboardPageDefinition_FunctionKeys; // Handler called when string in widget has been changed typedef void (*oC_WidgetScreen_StringChangedHandler_t)( oC_WidgetScreen_t Screen, oC_WidgetScreen_UserContext_t Context , oC_WidgetScreen_WidgetIndex_t WidgetIndex , const char * String ); typedef struct { oC_WidgetScreen_WidgetType_t Type; oC_Pixel_Position_t Position; oC_Pixel_ResolutionUInt_t Height; oC_Pixel_ResolutionUInt_t Width; oC_WidgetScreen_ZPosition_t ZPosition; const oC_WidgetScreen_Palette_t * Palette; const oC_WidgetScreen_DrawStyle_t * DrawStyle; oC_DefaultPathString_t ImagePath; oC_WidgetScreen_WidgetHandlers_t Handlers; struct { oC_DefaultString_t DefaultString; oC_Font_t Font; oC_WidgetScreen_TextAlign_t TextAlign; oC_WidgetScreen_VerticalTextAlign_t VerticalTextAlign; oC_WidgetScreen_UpdateWidgetStringHandler_t UpdateStringHandler; oC_WidgetScreen_StringChangedHandler_t StringChangedHandler; // Called when string has been changed } String; union { struct { oC_WidgetScreen_PushButtonType_t Type; } PushButton; struct { oC_Pixel_ResolutionUInt_t OptionWidth; oC_Pixel_ResolutionUInt_t OptionHeight; oC_Pixel_ResolutionUInt_t HorizontalCellSpacing; oC_Pixel_ResolutionUInt_t VerticalCellSpacing; } CheckBox, RadioButton; struct { const oC_WidgetScreen_KeyboardPageDefinition_t * Pages[oC_WidgetScreen_KeyboardPage_Max]; oC_Color_t BackgroundColor; oC_ColorFormat_t ColorFormat; } Keyboard; } TypeSpecific; } oC_WidgetScreen_WidgetDefinition_t; // Draws keyboard static void DrawKeyboard ( Widget_t * Widget , oC_ColorMap_t * ColorMap, oC_Pixel_Position_t ScreenPosition ); // Registers keyboard activity in input manager static bool RegisterKeyboardActivity ( Widget_t * Widget , oC_Pixel_Position_t ScreenPosition ); // Updates keyboard state after key press static bool UpdateKeyboardState ( Widget_t * Widget , oC_Pixel_Position_t ScreenPosition ); // Checks if keyboard widget definition is correct static bool CheckKeyboardDefinition ( const WidgetDefinition_t * Definition ); static const WidgetHandlersDefinition_t WidgetHandlersDefinition[oC_WidgetScreen_WidgetType_NumberOfTypes] = { [ WidgetType_Keyboard ] = { .DrawWidget = DrawKeyboard , .UpdateState = UpdateKeyboardState , .RegisterActivity = RegisterKeyboardActivity , .CheckDefinition = CheckKeyboardDefinition } , }; typedef struct { oC_ObjectControl_t ObjectControl; oC_Screen_t Screen; oC_Pixel_Position_t RelativePosition; oC_Pixel_Position_t RelativeEndPosition; oC_List(Option_t*) Options; WidgetValue_t Value; WidgetValue_t MaximumValue; Palette_t Palette; DrawStyle_t DrawStyle; WidgetState_t State; oC_WidgetScreen_WidgetDefinition_t Definition; bool DrawString; void * UserContext; oC_ICtrlMan_Activity_t ActiveActivity; oC_ICtrlMan_Activity_t ReleaseActivity; oC_IDI_Event_t ActiveEvent; oC_IDI_Event_t ReleaseEvent; oC_Time_t MaxReleaseTimeout; oC_Timestamp_t MaxReleaseTimestamp; bool Visible; oC_WidgetScreen_KeyboardPage_t KeyboardPage; } Widget_t;
Bitbucket
https://bitbucket.org/chocos/chocos/issues/250/add-support-of-keyboard-widget
Trello
Link to trello board: https://trello.com/c/NCDUQPvt
Story
- [ #240 ] - Preparation of the sample graphic program
List of requirements
Comments (7)
-
reporter -
reporter - changed title to Add support of Keyboard widget
- edited description
-
reporter - edited description
-
reporter - edited description
-
reporter - edited description
-
reporter - edited description
-
reporter - edited description
- Log in to comment