mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-01 17:15:28 +00:00
update content container init by type
This commit is contained in:
parent
d5ce67fbec
commit
afa4261b0e
7 changed files with 131 additions and 75 deletions
|
|
@ -4,36 +4,59 @@
|
|||
|
||||
using namespace app::browser::main::tab::page::content;
|
||||
|
||||
Text::Text()
|
||||
{
|
||||
// @TODO GtkViewport?
|
||||
}
|
||||
|
||||
void Text::set_gemini(
|
||||
const Glib::ustring & GEMTEXT
|
||||
Text::Text(
|
||||
const Type & TYPE,
|
||||
const Glib::ustring & VALUE
|
||||
) {
|
||||
auto viewport = new Gtk::Viewport( // @TODO
|
||||
// Init components
|
||||
textGemini = nullptr;
|
||||
textPlain = nullptr;
|
||||
|
||||
// GtkLabel does not support ScrolledWindow features, create GtkViewport
|
||||
auto viewport = new Gtk::Viewport( // @TODO manage
|
||||
NULL, //Gtk::Adjustment::H
|
||||
NULL //Gtk::Adjustment::V
|
||||
);
|
||||
); // @TODO manage, optimize
|
||||
|
||||
viewport->set_scroll_to_focus(
|
||||
false
|
||||
);
|
||||
|
||||
viewport->set_child(
|
||||
* new text::Gemini( // @TODO manage
|
||||
GEMTEXT
|
||||
)
|
||||
);
|
||||
// Detect text driver by text type requested
|
||||
switch (TYPE)
|
||||
{
|
||||
case GEMINI:
|
||||
|
||||
textGemini = new text::Gemini(
|
||||
VALUE
|
||||
);
|
||||
|
||||
viewport->set_child(
|
||||
* textGemini
|
||||
);
|
||||
|
||||
break;
|
||||
|
||||
case PLAIN:
|
||||
|
||||
// @TODO
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
throw _("Invalid text type enum"); // @TODO
|
||||
}
|
||||
|
||||
set_child(
|
||||
* viewport
|
||||
);
|
||||
}
|
||||
|
||||
void Text::set_plain(
|
||||
const Glib::ustring & TEXT
|
||||
) {
|
||||
Text::~Text()
|
||||
{
|
||||
delete textGemini;
|
||||
delete textPlain;
|
||||
|
||||
// @TODO
|
||||
}
|
||||
|
|
@ -1,26 +1,39 @@
|
|||
#ifndef APP_BROWSER_MAIN_TAB_PAGE_CONTENT_TEXT_HPP
|
||||
#define APP_BROWSER_MAIN_TAB_PAGE_CONTENT_TEXT_HPP
|
||||
|
||||
#include <glibmm/ustring.h>
|
||||
//#include <gtkmm/adjustment.h> @TODO
|
||||
#include <glibmm/i18n.h>
|
||||
#include <glibmm/ustring.h>
|
||||
#include <gtkmm/scrolledwindow.h>
|
||||
#include <gtkmm/viewport.h>
|
||||
|
||||
namespace app::browser::main::tab::page::content
|
||||
{
|
||||
namespace text
|
||||
{
|
||||
class Gemini;
|
||||
class Plain;
|
||||
}
|
||||
|
||||
class Text : public Gtk::ScrolledWindow
|
||||
{
|
||||
text::Gemini * textGemini;
|
||||
text::Plain * textPlain;
|
||||
|
||||
public:
|
||||
|
||||
Text();
|
||||
enum Type
|
||||
{
|
||||
GEMINI,
|
||||
PLAIN
|
||||
};
|
||||
|
||||
void set_gemini(
|
||||
const Glib::ustring & GEMTEXT
|
||||
Text(
|
||||
const Type & TYPE,
|
||||
const Glib::ustring & VALUE
|
||||
);
|
||||
|
||||
void set_plain(
|
||||
const Glib::ustring & TEXT
|
||||
);
|
||||
~Text();
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ using namespace app::browser::main::tab::page::content::text;
|
|||
Gemini::Gemini(
|
||||
const Glib::ustring & GEMTEXT
|
||||
) {
|
||||
// Init widget
|
||||
set_valign(
|
||||
Gtk::Align::START
|
||||
);
|
||||
|
|
@ -22,6 +23,6 @@ Gemini::Gemini(
|
|||
);
|
||||
|
||||
set_markup(
|
||||
GEMTEXT // @TODO
|
||||
GEMTEXT//markup
|
||||
);
|
||||
}
|
||||
|
|
@ -1,14 +1,16 @@
|
|||
#ifndef APP_BROWSER_MAIN_TAB_PAGE_CONTENT_TEXT_GEMINI_HPP
|
||||
#define APP_BROWSER_MAIN_TAB_PAGE_CONTENT_TEXT_GEMINI_HPP
|
||||
|
||||
#include <glibmm/regex.h>
|
||||
#include <glibmm/ustring.h>
|
||||
#include <gtkmm/enums.h>
|
||||
#include <gtkmm/label.h>
|
||||
|
||||
namespace app::browser::main::tab::page::content::text
|
||||
{
|
||||
class Gemini : public Gtk::Label
|
||||
{
|
||||
Glib::ustring markup;
|
||||
|
||||
public:
|
||||
|
||||
Gemini(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue