Browse Source

update header init

CPP-GTK4
yggverse 3 months ago
parent
commit
5d042b84b0
  1. 17
      src/Yoda/Browser.cpp
  2. 3
      src/Yoda/Browser.h
  3. 5
      src/Yoda/Browser/Header.cpp
  4. 12
      src/Yoda/Browser/Header.h

17
src/Yoda/Browser.cpp

@ -9,13 +9,6 @@ Yoda::Browser::Browser(
) )
); );
gtk_window_set_title(
GTK_WINDOW(
this->gtk
),
Browser::TITLE
);
gtk_window_set_default_size( gtk_window_set_default_size(
GTK_WINDOW( GTK_WINDOW(
this->gtk this->gtk
@ -24,15 +17,11 @@ Yoda::Browser::Browser(
Browser::HEIGHT Browser::HEIGHT
); );
GtkWidget *label = gtk_label_new( gtk_window_set_titlebar(
"Hello, World!"
);
gtk_window_set_child(
GTK_WINDOW( GTK_WINDOW(
this->gtk this->gtk
), ),
label (new YodaBrowser::Header())->gtk
); );
gtk_widget_show( gtk_widget_show(
@ -40,6 +29,4 @@ Yoda::Browser::Browser(
this->gtk this->gtk
) )
); );
// @TODO signals
} }

3
src/Yoda/Browser.h

@ -3,6 +3,8 @@
#include "../main.h" #include "../main.h"
#include "Browser/Header.h"
namespace Yoda namespace Yoda
{ {
class Browser class Browser
@ -13,7 +15,6 @@ namespace Yoda
const guint WIDTH = 640; const guint WIDTH = 640;
const guint HEIGHT = 480; const guint HEIGHT = 480;
const gchar* TITLE = "Yoda";
Browser( Browser(
GtkApplication *application GtkApplication *application

5
src/Yoda/Browser/Header.cpp

@ -1,8 +1,7 @@
#include "Header.h" #include "Header.h"
YodaBrowser::Header::Header( YodaBrowser::Header::Header()
Yoda::Browser *browser {
) {
// Init GTK // Init GTK
this->gtk = gtk_header_bar_new(); this->gtk = gtk_header_bar_new();

12
src/Yoda/Browser/Header.h

@ -3,27 +3,17 @@
#include "../../main.h" #include "../../main.h"
#include "../Browser.h"
namespace YodaBrowser namespace YodaBrowser
{ {
class Header class Header
{ {
public: public:
// GTK
GtkWidget *gtk; GtkWidget *gtk;
// Dependencies
Yoda::Browser *browser;
// Defaults
const gboolean SHOW_TITLE_BUTTONS = true; const gboolean SHOW_TITLE_BUTTONS = true;
// Construct Header();
Header(
Yoda::Browser *browser
);
}; };
}; };

Loading…
Cancel
Save