Checkpoint/include/gui.h

81 lines
2.2 KiB
C
Raw Normal View History

2017-09-29 07:45:56 +00:00
/* This file is part of Checkpoint
> Copyright (C) 2017 Bernardo Giordano
>
> This program is free software: you can redistribute it and/or modify
> it under the terms of the GNU General Public License as published by
> the Free Software Foundation, either version 3 of the License, or
> (at your option) any later version.
>
> This program is distributed in the hope that it will be useful,
> but WITHOUT ANY WARRANTY; without even the implied warranty of
> MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> GNU General Public License for more details.
>
> You should have received a copy of the GNU General Public License
> along with this program. If not, see <http://www.gnu.org/licenses/>.
> See LICENSE for information.
*/
#ifndef GUI_H
#define GUI_H
#include "common.h"
#define TEXTURE_CHECKPOINT 1
#define TEXTURE_CHECKBOX 2
2017-10-04 11:18:41 +00:00
#define TEXTURE_TWLCARD 3
#define TEXTURE_FIRST_FREE_INDEX 4
2017-09-29 07:45:56 +00:00
#define COLOR_BACKGROUND ABGR8(255, 51, 51, 51)
#define COLOR_BARS RGBA8(150, 150, 150, 255)
#define WHITE RGBA8(255, 255, 255, 255)
#define GREYISH RGBA8(200, 200, 200, 255)
#define BLACK RGBA8(0, 0, 0, 255)
#define BLUE RGBA8(0, 0, 255, 255)
#define RED RGBA8(255, 0, 0, 255)
2017-09-29 20:58:55 +00:00
#define GREEN RGBA8(0, 255, 0, 255)
2017-09-29 07:45:56 +00:00
2017-12-22 21:30:37 +00:00
bool askForConfirmation(std::string text);
2017-09-29 07:45:56 +00:00
size_t getScrollableIndex(void);
std::vector<size_t> getSelectedEntries(void);
bool multipleSelectionEnabled(void);
void clearSelectedEntries(void);
void addSelectedEntry(size_t index);
void resetDirectoryListIndex(void);
2017-12-23 14:29:53 +00:00
void setScrollableIndex(size_t index);
2017-12-22 21:30:37 +00:00
void drawCopy(std::u16string src, u32 offset, u32 size);
2017-10-07 12:19:53 +00:00
2017-09-29 07:45:56 +00:00
class Gui
{
public:
Gui(void);
2017-09-29 20:58:55 +00:00
void createInfo(std::string title, std::string message);
2017-09-29 07:45:56 +00:00
void createError(Result res, std::string message);
bool getBottomScroll(void);
size_t getNormalizedIndex(void);
bool isBackupReleased(void);
bool isRestoreReleased(void);
void setBottomScroll(bool enable);
void updateButtonsColor(void);
void updateSelector(void);
2017-09-30 10:06:33 +00:00
void resetIndex(void);
2017-09-29 07:45:56 +00:00
void draw(void);
private:
void drawSelector(void);
int getSelectorX(size_t index);
int getSelectorY(size_t index);
size_t index;
int page;
const size_t rowlen = 4;
const size_t collen = 8;
bool bottomScrollEnabled;
};
#endif