mirror of
https://github.com/YGGverse/Yoda.git
synced 2025-02-05 16:04:15 +00:00
implement header subtitle widget
This commit is contained in:
parent
fe8845ae1a
commit
c22b3a6b30
1
Makefile
1
Makefile
@ -9,6 +9,7 @@ SRCS = src/main.cpp\
|
|||||||
src/app/browser.cpp\
|
src/app/browser.cpp\
|
||||||
src/app/browser/header.cpp\
|
src/app/browser/header.cpp\
|
||||||
src/app/browser/header/main.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/main/title.cpp\
|
||||||
src/app/browser/header/menu.cpp\
|
src/app/browser/header/menu.cpp\
|
||||||
src/app/browser/header/tab.cpp\
|
src/app/browser/header/tab.cpp\
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
src/app/browser.cpp
|
src/app/browser.cpp
|
||||||
src/app/browser/header.cpp
|
src/app/browser/header.cpp
|
||||||
src/app/browser/header/main.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/main/title.cpp
|
||||||
src/app/browser/header/menu.cpp
|
src/app/browser/header/menu.cpp
|
||||||
src/app/browser/header/tab.cpp
|
src/app/browser/header/tab.cpp
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#include "main.hpp"
|
#include "main.hpp"
|
||||||
#include "main/title.hpp"
|
#include "main/title.hpp"
|
||||||
|
#include "main/subtitle.hpp"
|
||||||
|
|
||||||
using namespace app::browser::header;
|
using namespace app::browser::header;
|
||||||
|
|
||||||
@ -11,26 +12,33 @@ Main::Main()
|
|||||||
);
|
);
|
||||||
|
|
||||||
set_homogeneous(
|
set_homogeneous(
|
||||||
true
|
HOMOGENEOUS
|
||||||
);
|
);
|
||||||
|
|
||||||
// Init title
|
// Init title
|
||||||
title = new main::Title();
|
mainTitle = new main::Title();
|
||||||
|
|
||||||
append(
|
append(
|
||||||
* title
|
* mainTitle
|
||||||
|
);
|
||||||
|
|
||||||
|
mainSubtitle = new main::Subtitle();
|
||||||
|
|
||||||
|
append(
|
||||||
|
* mainSubtitle
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Main::~Main()
|
Main::~Main()
|
||||||
{
|
{
|
||||||
delete title;
|
delete mainTitle;
|
||||||
|
delete mainSubtitle;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Main::set_title(
|
void Main::set_title(
|
||||||
const Glib::ustring value
|
const Glib::ustring & TEXT
|
||||||
) {
|
) {
|
||||||
title->set(
|
mainTitle->set(
|
||||||
value
|
TEXT
|
||||||
);
|
);
|
||||||
}
|
}
|
@ -9,11 +9,15 @@ namespace app::browser::header
|
|||||||
namespace main
|
namespace main
|
||||||
{
|
{
|
||||||
class Title;
|
class Title;
|
||||||
|
class Subtitle;
|
||||||
}
|
}
|
||||||
|
|
||||||
class Main : public Gtk::Box
|
class Main : public Gtk::Box
|
||||||
{
|
{
|
||||||
main::Title * title;
|
main::Title * mainTitle;
|
||||||
|
main::Subtitle * mainSubtitle;
|
||||||
|
|
||||||
|
const bool HOMOGENEOUS = true;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@ -22,7 +26,7 @@ namespace app::browser::header
|
|||||||
~Main();
|
~Main();
|
||||||
|
|
||||||
void set_title(
|
void set_title(
|
||||||
const Glib::ustring text
|
const Glib::ustring & TEXT
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
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…
x
Reference in New Issue
Block a user