2020-03-12 10:47:59 +01:00
|
|
|
#if !defined(__XTHEME_H__)
|
2020-03-13 14:34:36 +01:00
|
|
|
#define __XTHEME_H__
|
|
|
|
|
2020-03-12 10:47:59 +01:00
|
|
|
#include "../cpp_foundation/XToolsCommon.h"
|
|
|
|
#include "../cpp_foundation/XObjArray.h"
|
2020-03-16 12:15:25 +01:00
|
|
|
#include "../cpp_foundation/XString.h"
|
2020-03-13 14:34:36 +01:00
|
|
|
#include "libeg.h"
|
2020-03-26 21:32:31 +01:00
|
|
|
//#include "nanosvg.h"
|
2020-03-26 18:00:53 +01:00
|
|
|
#include "XImage.h"
|
|
|
|
|
2020-03-13 14:34:36 +01:00
|
|
|
|
2020-03-18 07:39:11 +01:00
|
|
|
#define INDICATOR_SIZE (52)
|
|
|
|
|
2020-03-13 14:34:36 +01:00
|
|
|
class Icon
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
INTN Id; //for example BUILTIN_ICON_POINTER
|
2020-03-29 07:42:33 +02:00
|
|
|
XString Name; //for example "os_moja", "vol_internal"
|
2020-03-13 14:34:36 +01:00
|
|
|
XImage Image;
|
2020-03-18 07:39:11 +01:00
|
|
|
XImage ImageNight;
|
2020-03-13 14:34:36 +01:00
|
|
|
|
2020-04-05 23:14:27 +02:00
|
|
|
Icon(INTN Id, bool Embedded = false);
|
2020-03-13 14:34:36 +01:00
|
|
|
~Icon();
|
|
|
|
|
2020-04-02 21:27:10 +02:00
|
|
|
// Default are not valid, as usual. We delete them. If needed, proper ones can be created
|
|
|
|
Icon(const Icon&) = delete;
|
|
|
|
Icon& operator=(const Icon&) = delete;
|
2020-04-05 23:14:27 +02:00
|
|
|
void GetEmbedded();
|
2020-03-13 14:34:36 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
class XTheme
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
XObjArray<Icon> Icons;
|
2020-03-17 20:43:58 +01:00
|
|
|
EFI_FILE *ThemeDir;
|
2020-03-13 14:34:36 +01:00
|
|
|
|
2020-03-27 17:50:17 +01:00
|
|
|
// UINTN DisableFlags;
|
2020-03-12 10:47:59 +01:00
|
|
|
UINTN HideBadges;
|
|
|
|
UINTN HideUIFlags;
|
2020-03-27 20:47:06 +01:00
|
|
|
// BOOLEAN TextOnly;
|
2020-03-12 10:47:59 +01:00
|
|
|
FONT_TYPE Font;
|
|
|
|
INTN CharWidth;
|
|
|
|
UINTN SelectionColor;
|
|
|
|
XStringW FontFileName;
|
|
|
|
XStringW Theme;
|
|
|
|
XStringW BannerFileName;
|
|
|
|
XStringW SelectionSmallFileName;
|
|
|
|
XStringW SelectionBigFileName;
|
|
|
|
XStringW SelectionIndicatorName;
|
|
|
|
XStringW DefaultSelection;
|
|
|
|
XStringW BackgroundName;
|
|
|
|
SCALING BackgroundScale;
|
2020-03-26 15:24:20 +01:00
|
|
|
INTN BackgroundSharp;
|
2020-03-12 10:47:59 +01:00
|
|
|
BOOLEAN BackgroundDark;
|
2020-03-27 17:50:17 +01:00
|
|
|
// BOOLEAN CustomIcons;
|
2020-03-12 10:47:59 +01:00
|
|
|
BOOLEAN SelectionOnTop;
|
|
|
|
BOOLEAN BootCampStyle;
|
|
|
|
INTN BadgeOffsetX;
|
|
|
|
INTN BadgeOffsetY;
|
|
|
|
INTN BadgeScale;
|
|
|
|
INTN ThemeDesignWidth;
|
|
|
|
INTN ThemeDesignHeight;
|
|
|
|
INTN BannerPosX;
|
|
|
|
INTN BannerPosY;
|
|
|
|
INTN BannerEdgeHorizontal;
|
|
|
|
INTN BannerEdgeVertical;
|
|
|
|
INTN BannerNudgeX;
|
|
|
|
INTN BannerNudgeY;
|
|
|
|
BOOLEAN VerticalLayout;
|
|
|
|
BOOLEAN NonSelectedGrey;
|
|
|
|
INTN MainEntriesSize;
|
|
|
|
INTN TileXSpace;
|
|
|
|
INTN TileYSpace;
|
2020-03-12 15:00:36 +01:00
|
|
|
// INTN IconFormat;
|
2020-03-12 10:47:59 +01:00
|
|
|
BOOLEAN Proportional;
|
2020-03-27 17:50:17 +01:00
|
|
|
// BOOLEAN ShowOptimus;
|
2020-03-29 18:17:27 +02:00
|
|
|
BOOLEAN embedded;
|
2020-03-12 10:47:59 +01:00
|
|
|
BOOLEAN DarkEmbedded;
|
|
|
|
BOOLEAN TypeSVG;
|
2020-04-08 11:45:36 +02:00
|
|
|
// INTN Codepage; //no! it is global settings
|
|
|
|
// INTN CodepageSize;
|
2020-03-12 10:47:59 +01:00
|
|
|
float Scale;
|
2020-03-13 14:34:36 +01:00
|
|
|
float CentreShift;
|
2020-03-20 18:48:19 +01:00
|
|
|
INTN row0TileSize;
|
|
|
|
INTN row1TileSize;
|
2020-04-04 05:46:41 +02:00
|
|
|
INTN BanHeight;
|
2020-03-20 18:48:19 +01:00
|
|
|
INTN LayoutHeight; //it was 376 before
|
2020-03-26 15:24:20 +01:00
|
|
|
INTN LayoutBannerOffset;
|
|
|
|
INTN LayoutButtonOffset;
|
|
|
|
INTN LayoutTextOffset;
|
|
|
|
INTN LayoutAnimMoveForMenuX;
|
2020-04-02 16:03:58 +02:00
|
|
|
INTN ScrollWidth;
|
|
|
|
INTN ScrollButtonsHeight;
|
|
|
|
INTN ScrollBarDecorationsHeight;
|
|
|
|
INTN ScrollScrollDecorationsHeight;
|
|
|
|
|
2020-03-26 15:24:20 +01:00
|
|
|
|
2020-04-07 21:48:36 +02:00
|
|
|
INTN FontWidth;
|
|
|
|
INTN FontHeight;
|
|
|
|
INTN TextHeight;
|
|
|
|
|
2020-03-20 18:48:19 +01:00
|
|
|
BOOLEAN Daylight;
|
2020-03-13 14:34:36 +01:00
|
|
|
|
|
|
|
XImage Background; //Background and Banner will not be in array as they live own life
|
2020-03-17 05:25:38 +01:00
|
|
|
XImage BigBack; //it size is not equal to screen size will be scaled or cropped
|
|
|
|
XImage Banner; //same as logo in the array, make a link?
|
2020-03-20 18:48:19 +01:00
|
|
|
XImage SelectionImages[6];
|
2020-03-23 15:51:20 +01:00
|
|
|
XImage Buttons[4];
|
2020-03-20 18:48:19 +01:00
|
|
|
XImage ScrollbarBackgroundImage;
|
|
|
|
XImage BarStartImage;
|
|
|
|
XImage BarEndImage;
|
|
|
|
XImage ScrollbarImage;
|
|
|
|
XImage ScrollStartImage;
|
|
|
|
XImage ScrollEndImage;
|
|
|
|
XImage UpButtonImage;
|
|
|
|
XImage DownButtonImage;
|
2020-03-13 14:34:36 +01:00
|
|
|
|
2020-04-07 21:48:36 +02:00
|
|
|
XImage FontImage;
|
|
|
|
|
2020-04-04 05:46:41 +02:00
|
|
|
EG_RECT BannerPlace;
|
2020-04-01 14:57:32 +02:00
|
|
|
|
2020-03-17 05:25:38 +01:00
|
|
|
//fill the theme
|
2020-04-05 14:25:39 +02:00
|
|
|
// const XImage& GetIcon(const char* Name);
|
|
|
|
// const XImage& GetIcon(const CHAR16* Name);
|
2020-04-06 14:26:16 +02:00
|
|
|
const XImage& GetIcon(const XString& Name); //get by name
|
|
|
|
const XImage& GetIcon(INTN Id); //get by id
|
2020-04-10 21:29:51 +02:00
|
|
|
const XImage& GetIconAlt(INTN Id, INTN Alt); //if id not found
|
2020-04-05 17:54:10 +02:00
|
|
|
const XImage& LoadOSIcon(const CHAR16* OSIconName); //TODO make XString provider
|
2020-04-06 11:15:36 +02:00
|
|
|
const XImage& LoadOSIcon(const XString& Full);
|
2020-03-13 14:34:36 +01:00
|
|
|
|
2020-04-07 21:48:36 +02:00
|
|
|
//fonts
|
|
|
|
void LoadFontImage(IN BOOLEAN UseEmbedded, IN INTN Rows, IN INTN Cols);
|
|
|
|
void PrepareFont();
|
|
|
|
INTN GetEmpty(const XImage& Buffer, const EFI_GRAPHICS_OUTPUT_BLT_PIXEL& FirstPixel, INTN Start, INTN Step);
|
|
|
|
INTN RenderText(IN const XStringW& Text, OUT XImage* CompImage_ptr,
|
2020-04-09 15:04:12 +02:00
|
|
|
IN INTN PosX, IN INTN PosY, IN INTN Cursor, INTN textType, float textScale = 0.f);
|
2020-04-08 11:45:36 +02:00
|
|
|
//overload for UTF8 text
|
|
|
|
INTN RenderText(IN const XString& Text, OUT XImage* CompImage_ptr,
|
2020-04-09 15:04:12 +02:00
|
|
|
IN INTN PosX, IN INTN PosY, IN INTN Cursor, INTN textType, float textScale = 0.f);
|
2020-04-08 12:04:54 +02:00
|
|
|
VOID MeasureText(IN const XStringW& Text, OUT INTN *Width, OUT INTN *Height);
|
2020-04-07 21:48:36 +02:00
|
|
|
|
|
|
|
|
2020-04-02 21:27:10 +02:00
|
|
|
// void AddIcon(Icon& NewIcon); //return EFI_STATUS?
|
2020-03-16 12:15:25 +01:00
|
|
|
void FillByEmbedded();
|
2020-03-21 12:43:45 +01:00
|
|
|
void FillByDir();
|
2020-04-03 22:00:42 +02:00
|
|
|
EFI_STATUS GetThemeTagSettings(void* DictPointer);
|
2020-03-26 21:32:31 +01:00
|
|
|
void parseTheme(void* p, const char** dict); //in nano project
|
2020-04-06 11:15:36 +02:00
|
|
|
EFI_STATUS ParseSVGXTheme(const CHAR8* buffer); // in VectorTheme
|
2020-04-10 05:11:00 +02:00
|
|
|
EFI_STATUS ParseSVGXIcon(void *p, INTN Id, const XString& IconNameX, XImage* Image);
|
2020-04-03 22:00:42 +02:00
|
|
|
void* LoadTheme(const CHAR16 *TestTheme); //return TagPtr why?
|
2020-03-17 05:25:38 +01:00
|
|
|
|
|
|
|
//screen operations
|
|
|
|
void ClearScreen();
|
2020-03-17 20:43:58 +01:00
|
|
|
void FillRectAreaOfScreen(IN INTN XPos, IN INTN YPos, IN INTN Width, IN INTN Height);
|
2020-04-05 16:04:39 +02:00
|
|
|
// void InitSelection();
|
2020-03-20 18:48:19 +01:00
|
|
|
void InitBar();
|
2020-03-16 12:15:25 +01:00
|
|
|
|
2020-03-20 18:48:19 +01:00
|
|
|
void Init();
|
|
|
|
XTheme(); //default constructor
|
2020-03-13 14:34:36 +01:00
|
|
|
~XTheme();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
//internal layout variables instead of globals in menu.cpp
|
|
|
|
|
|
|
|
};
|
2020-03-16 20:47:02 +01:00
|
|
|
#endif
|