mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-02 17:45:28 +00:00
update namespace model
This commit is contained in:
parent
521d372b40
commit
47bd3b5b8b
10 changed files with 116 additions and 81 deletions
4
Makefile
4
Makefile
|
|
@ -6,8 +6,8 @@ LDFLAGS = `pkg-config --libs gtk4`
|
||||||
# Define target executable and source files
|
# Define target executable and source files
|
||||||
TARGET = bin/Yoda
|
TARGET = bin/Yoda
|
||||||
SRCS = src/main.cpp\
|
SRCS = src/main.cpp\
|
||||||
src/Yoda/Browser.cpp\
|
src/app/browser.cpp\
|
||||||
src/Yoda/Browser/Header.cpp
|
src/app/browser/header.cpp
|
||||||
|
|
||||||
OBJS = $(SRCS:.cpp=.o)
|
OBJS = $(SRCS:.cpp=.o)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,32 +0,0 @@
|
||||||
#include "Browser.h"
|
|
||||||
|
|
||||||
Yoda::Browser::Browser(
|
|
||||||
GtkApplication *application
|
|
||||||
) {
|
|
||||||
this->gtk = gtk_application_window_new(
|
|
||||||
GTK_APPLICATION(
|
|
||||||
application
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
gtk_window_set_default_size(
|
|
||||||
GTK_WINDOW(
|
|
||||||
this->gtk
|
|
||||||
),
|
|
||||||
Browser::WIDTH,
|
|
||||||
Browser::HEIGHT
|
|
||||||
);
|
|
||||||
|
|
||||||
gtk_window_set_titlebar(
|
|
||||||
GTK_WINDOW(
|
|
||||||
this->gtk
|
|
||||||
),
|
|
||||||
(new YodaBrowser::Header())->gtk
|
|
||||||
);
|
|
||||||
|
|
||||||
gtk_widget_show(
|
|
||||||
GTK_WIDGET(
|
|
||||||
this->gtk
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
@ -1,20 +0,0 @@
|
||||||
#include "Header.h"
|
|
||||||
|
|
||||||
YodaBrowser::Header::Header()
|
|
||||||
{
|
|
||||||
// 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
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
@ -1,21 +0,0 @@
|
||||||
#ifndef YODA_BROWSER_HEADER_H
|
|
||||||
#define YODA_BROWSER_HEADER_H
|
|
||||||
|
|
||||||
// Dependencies
|
|
||||||
#include "../Browser.h"
|
|
||||||
|
|
||||||
namespace YodaBrowser
|
|
||||||
{
|
|
||||||
class Header
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
|
|
||||||
GtkWidget *gtk;
|
|
||||||
|
|
||||||
const gboolean SHOW_TITLE_BUTTONS = true;
|
|
||||||
|
|
||||||
Header();
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
43
src/app/browser.cpp
Normal file
43
src/app/browser.cpp
Normal 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
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,23 +1,33 @@
|
||||||
#ifndef YODA_BROWSER_H
|
#ifndef APP_BROWSER_H
|
||||||
#define YODA_BROWSER_H
|
#define APP_BROWSER_H
|
||||||
|
|
||||||
// Dependencies
|
// Dependencies
|
||||||
#include "../main.h"
|
#include "../main.h"
|
||||||
|
|
||||||
// Requirements
|
// Requirements
|
||||||
#include "Browser/Header.h"
|
#include "browser/header.h"
|
||||||
|
|
||||||
namespace Yoda
|
namespace app
|
||||||
{
|
{
|
||||||
|
namespace browser
|
||||||
|
{
|
||||||
|
class Header;
|
||||||
|
}
|
||||||
|
|
||||||
class Browser
|
class Browser
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
// GTK
|
||||||
GtkWidget *gtk;
|
GtkWidget *gtk;
|
||||||
|
|
||||||
|
// Defaults
|
||||||
const guint WIDTH = 640;
|
const guint WIDTH = 640;
|
||||||
const guint HEIGHT = 480;
|
const guint HEIGHT = 480;
|
||||||
|
|
||||||
|
// Requirements
|
||||||
|
browser::Header *header;
|
||||||
|
|
||||||
Browser(
|
Browser(
|
||||||
GtkApplication *application
|
GtkApplication *application
|
||||||
);
|
);
|
||||||
28
src/app/browser/header.cpp
Normal file
28
src/app/browser/header.cpp
Normal 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
27
src/app/browser/header.h
Normal 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
|
||||||
|
|
@ -4,7 +4,7 @@ void activate(
|
||||||
GtkApplication *application
|
GtkApplication *application
|
||||||
) {
|
) {
|
||||||
// Init default component
|
// Init default component
|
||||||
new Yoda::Browser(
|
new app::Browser(
|
||||||
application
|
application
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
#include "Yoda/Browser.h"
|
#include "app/browser.h"
|
||||||
|
|
||||||
void static activate(
|
void static activate(
|
||||||
GtkApplication *application
|
GtkApplication *application
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue