- Added initial version of Hierarchical Menu
- Beautified the Message Box a bit
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
// Includes
|
||||
#include "../Screens.h"
|
||||
#include "../UI_Control.h"
|
||||
#include "../Command_Definition.h"
|
||||
|
||||
#include "../Display.h"
|
||||
#include "../Display_Objects.h"
|
||||
@@ -17,17 +18,28 @@
|
||||
|
||||
// ============================================================================================
|
||||
// Variables
|
||||
static Object_ID _RGB_Selector_Object;
|
||||
static RGB_Color* _RGB_Color;
|
||||
static Object_ID _Object_Message_Box;
|
||||
|
||||
static const Hierarchical_Menu* _Return_Menu = NULL;
|
||||
static const Menu_List* _Return_List = NULL;
|
||||
static int32_t _Return_Selected_Item;
|
||||
|
||||
static char* _Title;
|
||||
static uint32_t _Title_Length;
|
||||
static LED_Data_t* _RGB_Color;
|
||||
|
||||
static uint8_t _Current_Component;
|
||||
static uint8_t* _Color;
|
||||
|
||||
static bool _Decision_Made;
|
||||
static uint32_t _Counter;
|
||||
|
||||
|
||||
// ============================================================================================
|
||||
// Function Declarations
|
||||
void Screen_Setup_Select_RGB(Screen_Transition_Direction direction_out, Screen_Transition_Direction direction_in, Easing type, uint32_t frame_duration, RGB_Color* rgb_color);
|
||||
void Screen_Setup_Select_RGB(Screen_Transition_Direction direction_out, Screen_Transition_Direction direction_in, Easing type, uint32_t frame_duration, char* title, uint32_t title_length, LED_Data_t* rgb_color, const Hierarchical_Menu* return_menu, const Menu_List* return_list, int32_t return_selected_item);
|
||||
|
||||
static void Screen_Init (Screen_Transition_Direction direction_out, Screen_Transition_Direction direction_in, Easing type, uint32_t frame_duration);
|
||||
static void Screen_Tick (void);
|
||||
static void Screen_Click (uint button_return_value);
|
||||
static void Screen_Touch_Event (int16_t x, int16_t y);
|
||||
@@ -42,9 +54,26 @@ static void Screen_On_Object_Deselect (Object_ID object_id);
|
||||
/*******************************************************************
|
||||
Functions
|
||||
*******************************************************************/
|
||||
void Screen_Setup_Select_RGB(Screen_Transition_Direction direction_out, Screen_Transition_Direction direction_in, Easing type, uint32_t frame_duration, RGB_Color* rgb_color)
|
||||
void Screen_Setup_Select_RGB(Screen_Transition_Direction direction_out, Screen_Transition_Direction direction_in, Easing type, uint32_t frame_duration, char* title, uint32_t title_length, LED_Data_t* rgb_color, const Hierarchical_Menu* return_menu, const Menu_List* return_list, int32_t return_selected_item)
|
||||
{
|
||||
_Screen_Tick = Screen_Tick;
|
||||
_Current_Component = 0;
|
||||
_RGB_Color = rgb_color;
|
||||
_Color = &(rgb_color->Array[_Current_Component]);
|
||||
|
||||
Screen_Init(direction_out, direction_in, type, frame_duration);
|
||||
|
||||
_Return_Menu = return_menu;
|
||||
_Return_List = return_list;
|
||||
_Return_Selected_Item = return_selected_item;
|
||||
|
||||
_Decision_Made = false;
|
||||
_Counter = 0;
|
||||
}
|
||||
|
||||
void Screen_Init(Screen_Transition_Direction direction_out, Screen_Transition_Direction direction_in, Easing type, uint32_t frame_duration)
|
||||
{
|
||||
_Screen_Tick = Screen_Tick;
|
||||
_Screen_Tick = Screen_Tick;
|
||||
_Screen_Click = Screen_Click;
|
||||
_Screen_Touch_Event = Screen_Touch_Event;
|
||||
_Screen_Action_CW = Screen_Action_CW;
|
||||
@@ -55,25 +84,14 @@ void Screen_Setup_Select_RGB(Screen_Transition_Direction direction_out, Screen_T
|
||||
_Screen_On_Object_Deselect = Screen_On_Object_Deselect;
|
||||
|
||||
Display_Objects_Clear();
|
||||
|
||||
Display_Screen_Transition_Start(direction_out, direction_in, type, frame_duration);
|
||||
|
||||
|
||||
|
||||
//////////////////////////////
|
||||
//////////////////////////////
|
||||
// Add Display Objects here //
|
||||
//////////////////////////////
|
||||
|
||||
_Current_Component = 0;
|
||||
_RGB_Color = rgb_color;
|
||||
_Color = &(rgb_color->Array[_Current_Component]);
|
||||
|
||||
// Create the RGB selector object
|
||||
_RGB_Selector_Object = Display_Objects_Add_Select_RGB(
|
||||
_RGB_Color, // Pointer to color to modify
|
||||
&_Current_Component, // Indicater for active RGB Base Color
|
||||
&_Configuration_Default_Select_RGB // Use configuration
|
||||
);
|
||||
Display_Objects_Add_Select_RGB(_RGB_Color, &_Current_Component, &_Configuration_Default_Select_RGB);
|
||||
_Object_Message_Box = Display_Objects_Add_Message_Box(CENTER_MIDDLE, BOTH_IN_PERCENT, 50, 50, "Saved", MESSAGE_BOX_ICON_CIRCLE_CHECKMARK, &_Message_Box_Style_Regular);
|
||||
|
||||
Display_Select_Object();
|
||||
|
||||
@@ -83,7 +101,13 @@ void Screen_Setup_Select_RGB(Screen_Transition_Direction direction_out, Screen_T
|
||||
|
||||
void Screen_Tick(void)
|
||||
{
|
||||
if(_Decision_Made) {
|
||||
_Counter++;
|
||||
}
|
||||
|
||||
if(_Counter == MESSAGE_BOX_DEFAULT_TICKS) {
|
||||
Screen_Setup_Settings_Hierarchical_Menu(TRANSITION_DOWN, TRANSITION_RIGHT, SCREEN_TRANSITION_DEFAULT_EASING, SCREEN_TRANSITION_DEFAULT_FRAMES, _Return_Menu, _Return_List, _Return_Selected_Item);
|
||||
}
|
||||
}
|
||||
|
||||
void Screen_Click(uint button_return_value)
|
||||
@@ -98,6 +122,10 @@ void Screen_Touch_Event(int16_t x, int16_t y)
|
||||
|
||||
void Screen_Action_CW(Object_ID object_id)
|
||||
{
|
||||
if(_Decision_Made) {
|
||||
return;
|
||||
}
|
||||
|
||||
int32_t Color = *_Color;
|
||||
UI_Control_Selector_Inc(&Color, 0, UINT8_MAX, false);
|
||||
*_Color = (uint8_t)Color;
|
||||
@@ -105,6 +133,10 @@ void Screen_Action_CW(Object_ID object_id)
|
||||
|
||||
void Screen_Action_CCW(Object_ID object_id)
|
||||
{
|
||||
if(_Decision_Made) {
|
||||
return;
|
||||
}
|
||||
|
||||
int32_t Color = *_Color;
|
||||
UI_Control_Selector_Dec(&Color, 0, UINT8_MAX, false);
|
||||
*_Color = (uint8_t)Color;
|
||||
@@ -136,7 +168,10 @@ void Screen_On_Object_Deselect(Object_ID object_id)
|
||||
return;
|
||||
}
|
||||
|
||||
// Screen_Setup_Menu_Main(TRANSITION_DOWN, TRANSITION_DOWN, INOUT_SINE, 15, false, 1);
|
||||
if(!_Decision_Made) {
|
||||
Display_Objects_Show_Message_Box(_Object_Message_Box, MESSAGE_BOX_DEFAULT_TICKS);
|
||||
_Decision_Made = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user