mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-01 09:05:27 +00:00
implement header subtitle widget
This commit is contained in:
parent
fe8845ae1a
commit
c22b3a6b30
6 changed files with 86 additions and 9 deletions
36
src/app/browser/header/main/subtitle.cpp
Normal file
36
src/app/browser/header/main/subtitle.cpp
Normal file
|
|
@ -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
|
||||
);
|
||||
}
|
||||
27
src/app/browser/header/main/subtitle.hpp
Normal file
27
src/app/browser/header/main/subtitle.hpp
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
#ifndef APP_BROWSER_HEADER_MAIN_SUBTITLE_HPP
|
||||
#define APP_BROWSER_HEADER_MAIN_SUBTITLE_HPP
|
||||
|
||||
#include <glibmm/ustring.h>
|
||||
#include <gtkmm/enums.h>
|
||||
#include <gtkmm/label.h>
|
||||
#include <pangomm/layout.h>
|
||||
|
||||
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
|
||||
Loading…
Add table
Add a link
Reference in a new issue