CMsgBox: rework msgbox classes with Window class implementation

Replacing messagebox, hintbox_ext and some derivated parts with
basic class hintbox and derivated class CMsgBox. This should unify
window handling and avoids maintain of multiple classes with quasi
same purpose and adds more functionality.

TODO: fix and optimize details


Origin commit data
------------------
Commit: dde298b1b7
Author: Thilo Graf <dbt@novatux.de>
Date: 2016-04-04 (Mon, 04 Apr 2016)
This commit is contained in:
2016-04-04 21:57:17 +02:00
parent 0897cd1c24
commit 11b3307251
81 changed files with 1981 additions and 1697 deletions

View File

@@ -1,64 +1,95 @@
/*
Neutrino-GUI - DBoxII-Project
Copyright (C) 2001 Steffen Hehn 'McClean'
Homepage: http://dbox.cyberphoria.org/
Kommentar:
Diese GUI wurde von Grund auf neu programmiert und sollte nun vom
Aufbau und auch den Ausbaumoeglichkeiten gut aussehen. Neutrino basiert
auf der Client-Server Idee, diese GUI ist also von der direkten DBox-
Steuerung getrennt. Diese wird dann von Daemons uebernommen.
Based up Neutrino-GUI - Tuxbox-Project
Copyright (C) 2001 by Steffen Hehn 'McClean'
Implement CComponent-Windowclass.
Copyright (C) 2015 Thilo Graf 'dbt'
License: GPL
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 2 of the License, or
(at your option) any later version.
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 2 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.
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, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __helpbox__
#define __helpbox__
#include <system/localize.h>
#include <gui/components/cc.h>
#include <global.h>
#include <neutrino.h>
#include <gui/widget/drawable.h>
#define HELPBOX_DEFAULT_LINE_HEIGHT 35
#define HELPBOX_DEFAULT_LINE_INDENT 10
#include <string>
#include <vector>
class Helpbox
class Helpbox : public CComponentsWindowMax
{
public:
Helpbox();
~Helpbox();
void show(const neutrino_locale_t Caption, const int Width = 450, int timeout = -1);
void addLine(std::string& text);
void addLine(const char *text);
void addLine(std::string& icon, std::string& text);
void addLine(const char *icon, const char *text);
void addPagebreak();
protected:
private:
uint8_t page;
//start position of items on page
int hbox_y;
ContentLines m_lines;
///default font
Font* hbox_font;
public:
Helpbox( const std::string& Title,
const std::string& Default_Text = std::string(),
const int& text_mode = CTextBox::AUTO_WIDTH | CTextBox::AUTO_HIGH,
const int& line_space = HELPBOX_DEFAULT_LINE_HEIGHT,
Font* font_text = NULL,
const char* Icon = NEUTRINO_ICON_INFO);
///show = paint, for compatibility
void show(bool do_save_bg = true){ paint(do_save_bg) ;}
void addLine( const std::string& text,
const int& text_mode = CTextBox::AUTO_WIDTH | CTextBox::AUTO_HIGH,
const int& line_space = HELPBOX_DEFAULT_LINE_HEIGHT,
const int& line_indent = HELPBOX_DEFAULT_LINE_INDENT,
Font* font_text = NULL);
void addLine( const char *text,
const int& text_mode = CTextBox::AUTO_WIDTH | CTextBox::AUTO_HIGH,
const int& line_space = HELPBOX_DEFAULT_LINE_HEIGHT,
const int& line_indent = HELPBOX_DEFAULT_LINE_INDENT,
Font* font_text = NULL);
void addLine( const std::string& icon,
const std::string& text,
const int& text_mode = CTextBox::AUTO_WIDTH | CTextBox::AUTO_HIGH,
const int& line_space = HELPBOX_DEFAULT_LINE_HEIGHT,
const int& line_indent = HELPBOX_DEFAULT_LINE_INDENT,
Font* font_text = NULL);
void addLine( const char *icon,
const char *text,
const int& text_mode = CTextBox::AUTO_WIDTH | CTextBox::AUTO_HIGH,
const int& line_space = HELPBOX_DEFAULT_LINE_HEIGHT,
const int& line_indent = HELPBOX_DEFAULT_LINE_INDENT,
Font* font_text = NULL);
///adds a separator as horizontal line, arg 'line_space' defines the space of full separator height, the separator line itself has a defined height of 2px and is centered within line space.
///arg 'line_indent' defines begin of line from left border within body object.
///arg 'enable_gradient' enable/disable gradient, Note: default = true, but gradient is only effected, if global/theme gradient settings are enabled!
void addSeparatorLine( const int& line_space = HELPBOX_DEFAULT_LINE_HEIGHT,
const int& line_indent = HELPBOX_DEFAULT_LINE_INDENT,
bool enable_gradient = true);
///adds a simple empty separator as horizontal space, arg 'line_space' defines the space of full separator height
void addSeparator( const int& line_space = HELPBOX_DEFAULT_LINE_HEIGHT);
void addPagebreak();
int exec(){return ccw_body->exec();}
};
#endif