update namespace model

This commit is contained in:
yggverse 2024-08-05 03:15:41 +03:00
parent 521d372b40
commit 47bd3b5b8b
10 changed files with 116 additions and 81 deletions

43
src/app/browser.cpp Normal file
View file

@ -0,0 +1,43 @@
#include "browser.h"
namespace app
{
// Construct
Browser::Browser(
GtkApplication *application
) {
// Init GTK
this->gtk = gtk_application_window_new(
GTK_APPLICATION(
application
)
);
gtk_window_set_default_size(
GTK_WINDOW(
this->gtk
),
Browser::WIDTH,
Browser::HEIGHT
);
// Init requirements
this->header = new browser::Header(
this
);
gtk_window_set_titlebar(
GTK_WINDOW(
this->gtk
),
this->header->gtk
);
// Render
gtk_widget_show(
GTK_WIDGET(
this->gtk
)
);
}
}

37
src/app/browser.h Normal file
View file

@ -0,0 +1,37 @@
#ifndef APP_BROWSER_H
#define APP_BROWSER_H
// Dependencies
#include "../main.h"
// Requirements
#include "browser/header.h"
namespace app
{
namespace browser
{
class Header;
}
class Browser
{
public:
// GTK
GtkWidget *gtk;
// Defaults
const guint WIDTH = 640;
const guint HEIGHT = 480;
// Requirements
browser::Header *header;
Browser(
GtkApplication *application
);
};
};
#endif

View file

@ -0,0 +1,28 @@
#include "header.h"
namespace app
{
namespace browser
{
// Construct
Header::Header(
Browser *browser
) {
// Init GTK
this->gtk = gtk_header_bar_new();
gtk_header_bar_set_show_title_buttons(
GTK_HEADER_BAR(
this->gtk
),
Header::SHOW_TITLE_BUTTONS
);
gtk_widget_show(
GTK_WIDGET(
this->gtk
)
);
}
}
}

27
src/app/browser/header.h Normal file
View file

@ -0,0 +1,27 @@
#ifndef APP_BROWSER_HEADER_H
#define APP_BROWSER_HEADER_H
#include "../browser.h"
namespace app
{
class Browser;
namespace browser
{
class Header
{
public:
GtkWidget *gtk;
const gboolean SHOW_TITLE_BUTTONS = true;
Header(
Browser *browser
);
};
};
};
#endif