diff --git a/Makefile b/Makefile index 860e11c8..e8eece17 100644 --- a/Makefile +++ b/Makefile @@ -9,6 +9,7 @@ SRCS = src/main.cpp\ src/app/browser.cpp\ src/app/browser/header.cpp\ src/app/browser/header/main.cpp\ + src/app/browser/header/main/subtitle.cpp\ src/app/browser/header/main/title.cpp\ src/app/browser/header/menu.cpp\ src/app/browser/header/tab.cpp\ diff --git a/po/POTFILES.in b/po/POTFILES.in index 882a479c..00efafd2 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -1,6 +1,7 @@ src/app/browser.cpp src/app/browser/header.cpp src/app/browser/header/main.cpp +src/app/browser/header/main/subtitle.cpp src/app/browser/header/main/title.cpp src/app/browser/header/menu.cpp src/app/browser/header/tab.cpp diff --git a/src/app/browser/header/main.cpp b/src/app/browser/header/main.cpp index e65d914d..52a33df9 100644 --- a/src/app/browser/header/main.cpp +++ b/src/app/browser/header/main.cpp @@ -1,5 +1,6 @@ #include "main.hpp" #include "main/title.hpp" +#include "main/subtitle.hpp" using namespace app::browser::header; @@ -11,26 +12,33 @@ Main::Main() ); set_homogeneous( - true + HOMOGENEOUS ); // Init title - title = new main::Title(); + mainTitle = new main::Title(); append( - * title + * mainTitle + ); + + mainSubtitle = new main::Subtitle(); + + append( + * mainSubtitle ); } Main::~Main() { - delete title; + delete mainTitle; + delete mainSubtitle; } void Main::set_title( - const Glib::ustring value + const Glib::ustring & TEXT ) { - title->set( - value + mainTitle->set( + TEXT ); } \ No newline at end of file diff --git a/src/app/browser/header/main.hpp b/src/app/browser/header/main.hpp index b1b56c09..6d701d60 100644 --- a/src/app/browser/header/main.hpp +++ b/src/app/browser/header/main.hpp @@ -9,11 +9,15 @@ namespace app::browser::header namespace main { class Title; + class Subtitle; } class Main : public Gtk::Box { - main::Title * title; + main::Title * mainTitle; + main::Subtitle * mainSubtitle; + + const bool HOMOGENEOUS = true; public: @@ -22,7 +26,7 @@ namespace app::browser::header ~Main(); void set_title( - const Glib::ustring text + const Glib::ustring & TEXT ); }; } diff --git a/src/app/browser/header/main/subtitle.cpp b/src/app/browser/header/main/subtitle.cpp new file mode 100644 index 00000000..f5f2ff6f --- /dev/null +++ b/src/app/browser/header/main/subtitle.cpp @@ -0,0 +1,36 @@ +#include "subtitle.hpp" + +using namespace app::browser::header::main; + +Subtitle::Subtitle() +{ + add_css_class( + "subtitle" + ); + + set_single_line_mode( + true + ); + + set_ellipsize( + Pango::EllipsizeMode::END + ); + + set_valign( + Gtk::Align::CENTER + ); + + set_width_chars( + WIDTH_CHARS + ); +} + +Subtitle::~Subtitle() = default; + +void Subtitle::set( + const Glib::ustring & TEXT +) { + set_text( + TEXT + ); +} \ No newline at end of file diff --git a/src/app/browser/header/main/subtitle.hpp b/src/app/browser/header/main/subtitle.hpp new file mode 100644 index 00000000..92cc6d4a --- /dev/null +++ b/src/app/browser/header/main/subtitle.hpp @@ -0,0 +1,27 @@ +#ifndef APP_BROWSER_HEADER_MAIN_SUBTITLE_HPP +#define APP_BROWSER_HEADER_MAIN_SUBTITLE_HPP + +#include +#include +#include +#include + +namespace app::browser::header::main +{ + class Subtitle : public Gtk::Label + { + const int WIDTH_CHARS = 5; + + public: + + Subtitle(); + + ~Subtitle(); + + void set( + const Glib::ustring & TEXT + ); + }; +} + +#endif // APP_BROWSER_HEADER_MAIN_SUBTITLE_HPP \ No newline at end of file