mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-02 01:25:27 +00:00
draft gemtext route
This commit is contained in:
parent
af6b1efe32
commit
a73bb3aea6
8 changed files with 118 additions and 9 deletions
|
|
@ -1,4 +1,5 @@
|
|||
#include "content.hpp"
|
||||
#include "content/text/gemini.hpp"
|
||||
|
||||
using namespace app::browser::main::tab::page;
|
||||
|
||||
|
|
@ -11,12 +12,44 @@ Content::Content()
|
|||
set_homogeneous(
|
||||
true
|
||||
);
|
||||
|
||||
widget = nullptr;
|
||||
}
|
||||
|
||||
Content::~Content() = default;
|
||||
Content::~Content()
|
||||
{
|
||||
delete widget;
|
||||
};
|
||||
|
||||
void Content::set(
|
||||
const Glib::ustring & buffer
|
||||
// Public actions
|
||||
void Content::text_gemini(
|
||||
const Glib::ustring & gemtext
|
||||
) {
|
||||
// @TODO
|
||||
update(
|
||||
new content::text::Gemini(
|
||||
gemtext
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// @TODO text_plain, picture, video, etc.
|
||||
|
||||
// Private helpers
|
||||
void Content::update(
|
||||
Gtk::Widget * new_widget
|
||||
) {
|
||||
if (widget != nullptr)
|
||||
{
|
||||
remove(
|
||||
* widget
|
||||
);
|
||||
|
||||
delete widget;
|
||||
}
|
||||
|
||||
widget = new_widget;
|
||||
|
||||
append(
|
||||
* widget
|
||||
);
|
||||
}
|
||||
|
|
@ -1,21 +1,28 @@
|
|||
#ifndef APP_BROWSER_MAIN_TAB_PAGE_CONTENT_HPP
|
||||
#define APP_BROWSER_MAIN_TAB_PAGE_CONTENT_HPP
|
||||
|
||||
#include <gtkmm/box.h>
|
||||
#include <glibmm/ustring.h>
|
||||
#include <gtkmm/box.h>
|
||||
#include <gtkmm/widget.h>
|
||||
|
||||
namespace app::browser::main::tab::page
|
||||
{
|
||||
class Content : public Gtk::Box
|
||||
{
|
||||
Gtk::Widget * widget;
|
||||
|
||||
void update(
|
||||
Gtk::Widget * new_widget
|
||||
);
|
||||
|
||||
public:
|
||||
|
||||
Content();
|
||||
|
||||
~Content();
|
||||
|
||||
void set(
|
||||
const Glib::ustring & buffer
|
||||
void text_gemini(
|
||||
const Glib::ustring & gemtext
|
||||
);
|
||||
};
|
||||
}
|
||||
|
|
|
|||
21
src/app/browser/main/tab/page/content/text/gemini.cpp
Normal file
21
src/app/browser/main/tab/page/content/text/gemini.cpp
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
#include "gemini.hpp"
|
||||
|
||||
using namespace app::browser::main::tab::page::content::text;
|
||||
|
||||
Gemini::Gemini(
|
||||
const Glib::ustring & gemtext
|
||||
) {
|
||||
set_wrap(
|
||||
true
|
||||
);
|
||||
|
||||
set_selectable(
|
||||
true
|
||||
);
|
||||
|
||||
set_markup(
|
||||
gemtext // @TODO
|
||||
);
|
||||
}
|
||||
|
||||
Gemini::~Gemini() = default;
|
||||
21
src/app/browser/main/tab/page/content/text/gemini.hpp
Normal file
21
src/app/browser/main/tab/page/content/text/gemini.hpp
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
#ifndef APP_BROWSER_MAIN_TAB_PAGE_CONTENT_TEXT_GEMINI_HPP
|
||||
#define APP_BROWSER_MAIN_TAB_PAGE_CONTENT_TEXT_GEMINI_HPP
|
||||
|
||||
#include <glibmm/ustring.h>
|
||||
#include <gtkmm/label.h>
|
||||
|
||||
namespace app::browser::main::tab::page::content::text
|
||||
{
|
||||
class Gemini : public Gtk::Label
|
||||
{
|
||||
public:
|
||||
|
||||
Gemini(
|
||||
const Glib::ustring & gemtext
|
||||
);
|
||||
|
||||
~Gemini();
|
||||
};
|
||||
}
|
||||
|
||||
#endif // APP_BROWSER_MAIN_TAB_PAGE_CONTENT_TEXT_GEMINI_HPP
|
||||
Loading…
Add table
Add a link
Reference in a new issue