Browse Source

init main header widget

CPP-GTK4
yggverse 3 months ago
parent
commit
a98e9e088a
  1. 2
      Makefile
  2. 2
      po/POTFILES.in
  3. 9
      src/app/browser/header.cpp
  4. 2
      src/app/browser/header.hpp
  5. 24
      src/app/browser/header/main.cpp
  6. 25
      src/app/browser/header/main.hpp
  7. 10
      src/app/browser/header/main/title.cpp
  8. 28
      src/app/browser/header/main/title.hpp

2
Makefile

@ -8,6 +8,8 @@ TARGET = bin/Yoda
SRCS = src/main.cpp\ 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/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\
src/app/browser/main.cpp\ src/app/browser/main.cpp\

2
po/POTFILES.in

@ -1,5 +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/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
src/app/browser/main.cpp src/app/browser/main.cpp

9
src/app/browser/header.cpp

@ -1,4 +1,5 @@
#include "header.hpp" #include "header.hpp"
#include "header/main.hpp"
#include "header/menu.hpp" #include "header/menu.hpp"
#include "header/tab.hpp" #include "header/tab.hpp"
@ -24,10 +25,18 @@ Header::Header()
pack_start( pack_start(
* tab * tab
); );
// Init main widget
main = new header::Main();
set_title_widget(
* main
);
} }
Header::~Header() Header::~Header()
{ {
delete menu; delete menu;
delete tab; delete tab;
delete main;
} }

2
src/app/browser/header.hpp

@ -7,12 +7,14 @@ namespace app::browser
{ {
namespace header namespace header
{ {
class Main;
class Menu; class Menu;
class Tab; class Tab;
} }
class Header : public Gtk::HeaderBar class Header : public Gtk::HeaderBar
{ {
app::browser::header::Main * main;
app::browser::header::Menu * menu; app::browser::header::Menu * menu;
app::browser::header::Tab * tab; app::browser::header::Tab * tab;

24
src/app/browser/header/main.cpp

@ -0,0 +1,24 @@
#include "main.hpp"
#include "main/title.hpp"
using namespace app::browser::header;
Main::Main()
{
// Init container
set_orientation(
Gtk::Orientation::VERTICAL
);
// Init title
title = new main::Title();
append(
* title
);
}
Main::~Main()
{
delete title;
}

25
src/app/browser/header/main.hpp

@ -0,0 +1,25 @@
#ifndef APP_BROWSER_HEADER_MAIN_HPP
#define APP_BROWSER_HEADER_MAIN_HPP
#include <gtkmm/box.h>
namespace app::browser::header
{
namespace main
{
class Title;
}
class Main : public Gtk::Box
{
main::Title * title;
public:
Main();
~Main();
};
}
#endif // APP_BROWSER_HEADER_MAIN_HPP

10
src/app/browser/header/main/title.cpp

@ -0,0 +1,10 @@
#include "title.hpp"
using namespace app::browser::header::main;
Title::Title()
{
// @TODO
}
Title::~Title() = default;

28
src/app/browser/header/main/title.hpp

@ -0,0 +1,28 @@
#ifndef APP_BROWSER_HEADER_MAIN_TITLE_HPP
#define APP_BROWSER_HEADER_MAIN_TITLE_HPP
#include <glibmm/i18n.h>
#include <glibmm/ustring.h>
#include <gtkmm/label.h>
namespace app::browser::header::main
{
class Title : public Gtk::Label
{
public:
Title();
~Title();
void set_title(
Glib::ustring $value
);
void set_subtitle(
Glib::ustring $value
);
};
}
#endif // APP_BROWSER_HEADER_MAIN_TITLE_HPP
Loading…
Cancel
Save