mirror of
https://github.com/YGGverse/Yoda.git
synced 2025-03-13 06:01:21 +00:00
draft append method
This commit is contained in:
parent
0a7090ec50
commit
d6fc439908
@ -6,7 +6,9 @@ namespace app
|
|||||||
{
|
{
|
||||||
namespace container
|
namespace container
|
||||||
{
|
{
|
||||||
// Construct
|
/**
|
||||||
|
* Construct
|
||||||
|
*/
|
||||||
Page::Page(
|
Page::Page(
|
||||||
Container *container
|
Container *container
|
||||||
) {
|
) {
|
||||||
@ -22,6 +24,26 @@ namespace app
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Init empty page
|
||||||
|
*/
|
||||||
|
void Page::init(
|
||||||
|
char *request,
|
||||||
|
bool focus
|
||||||
|
) {
|
||||||
|
// @TODO
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Open page request
|
||||||
|
*/
|
||||||
|
void Page::open(
|
||||||
|
char *request,
|
||||||
|
bool history
|
||||||
|
) {
|
||||||
|
// @TODO
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -22,6 +22,16 @@ namespace app
|
|||||||
Page(
|
Page(
|
||||||
Container *container
|
Container *container
|
||||||
);
|
);
|
||||||
|
|
||||||
|
void init(
|
||||||
|
char *request,
|
||||||
|
bool focus
|
||||||
|
);
|
||||||
|
|
||||||
|
void open(
|
||||||
|
char *request,
|
||||||
|
bool history
|
||||||
|
);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -6,10 +6,15 @@ namespace app
|
|||||||
{
|
{
|
||||||
namespace container
|
namespace container
|
||||||
{
|
{
|
||||||
// Construct
|
/**
|
||||||
|
* Construct
|
||||||
|
*/
|
||||||
Tab::Tab(
|
Tab::Tab(
|
||||||
Container *container
|
Container *container
|
||||||
) {
|
) {
|
||||||
|
// Init dependencies
|
||||||
|
this->container = container;
|
||||||
|
|
||||||
// Init GTK
|
// Init GTK
|
||||||
this->gtk = gtk_notebook_new();
|
this->gtk = gtk_notebook_new();
|
||||||
|
|
||||||
@ -26,6 +31,83 @@ namespace app
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Append new tab
|
||||||
|
*/
|
||||||
|
void Tab::append(
|
||||||
|
char *request,
|
||||||
|
bool open = true,
|
||||||
|
bool focus = true
|
||||||
|
) {
|
||||||
|
|
||||||
|
// Init new page
|
||||||
|
Page *page = new Page(
|
||||||
|
this->container
|
||||||
|
);
|
||||||
|
|
||||||
|
gtk_notebook_append_page(
|
||||||
|
GTK_NOTEBOOK(
|
||||||
|
this->gtk
|
||||||
|
),
|
||||||
|
GTK_WIDGET(
|
||||||
|
page->gtk
|
||||||
|
),
|
||||||
|
NULL // @TODO label
|
||||||
|
);
|
||||||
|
|
||||||
|
gtk_notebook_set_tab_reorderable(
|
||||||
|
GTK_NOTEBOOK(
|
||||||
|
this->gtk
|
||||||
|
),
|
||||||
|
GTK_WIDGET(
|
||||||
|
page->gtk
|
||||||
|
),
|
||||||
|
Tab::REORDERABLE
|
||||||
|
);
|
||||||
|
|
||||||
|
// Page open requested
|
||||||
|
if (open)
|
||||||
|
{
|
||||||
|
page->open(
|
||||||
|
request,
|
||||||
|
false // history
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
else
|
||||||
|
{
|
||||||
|
page->init(
|
||||||
|
request,
|
||||||
|
true // focus @TODO boolean empty(request)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Focus requested
|
||||||
|
if (focus)
|
||||||
|
{
|
||||||
|
gtk_notebook_set_current_page(
|
||||||
|
GTK_NOTEBOOK(
|
||||||
|
this->gtk
|
||||||
|
),
|
||||||
|
gtk_notebook_page_num(
|
||||||
|
GTK_NOTEBOOK(
|
||||||
|
this->gtk
|
||||||
|
),
|
||||||
|
GTK_WIDGET(
|
||||||
|
page->gtk
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Render
|
||||||
|
gtk_widget_show(
|
||||||
|
GTK_WIDGET(
|
||||||
|
this->gtk
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,12 @@
|
|||||||
#ifndef APP_BROWSER_CONTAINER_TAB_H
|
#ifndef APP_BROWSER_CONTAINER_TAB_H
|
||||||
#define APP_BROWSER_CONTAINER_TAB_H
|
#define APP_BROWSER_CONTAINER_TAB_H
|
||||||
|
|
||||||
|
// Dependencies
|
||||||
#include "../container.h"
|
#include "../container.h"
|
||||||
|
|
||||||
|
// Requirements
|
||||||
|
#include "page.h"
|
||||||
|
|
||||||
namespace app
|
namespace app
|
||||||
{
|
{
|
||||||
namespace browser
|
namespace browser
|
||||||
@ -11,18 +15,31 @@ namespace app
|
|||||||
|
|
||||||
namespace container
|
namespace container
|
||||||
{
|
{
|
||||||
|
class Page; // @TODO not required here
|
||||||
|
|
||||||
class Tab
|
class Tab
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
// GTK
|
||||||
GtkWidget *gtk;
|
GtkWidget *gtk;
|
||||||
|
|
||||||
|
// Defaults
|
||||||
const gboolean REORDERABLE = true;
|
const gboolean REORDERABLE = true;
|
||||||
const gboolean SCROLLABLE = true;
|
const gboolean SCROLLABLE = true;
|
||||||
|
|
||||||
|
// Dependencies
|
||||||
|
Container *container;
|
||||||
|
|
||||||
Tab(
|
Tab(
|
||||||
Container *container
|
Container *container
|
||||||
);
|
);
|
||||||
|
|
||||||
|
void append(
|
||||||
|
char *request,
|
||||||
|
bool open,
|
||||||
|
bool focus
|
||||||
|
);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user