Browse Source

add window full screen support

CPP-GTK4
yggverse 2 months ago
parent
commit
07e781d357
  1. 19
      src/app/browser.cpp
  2. 5
      src/app/browser.hpp

19
src/app/browser.cpp

@ -203,6 +203,8 @@ Browser::Browser(
HEIGHT HEIGHT
); );
IS_FULLSCREEN ? fullscreen() : unfullscreen();
// Init components // Init components
browserHeader = Gtk::make_managed<browser::Header>( browserHeader = Gtk::make_managed<browser::Header>(
ACTION__DEBUG, ACTION__DEBUG,
@ -278,7 +280,7 @@ int Browser::restore()
while (sqlite3_step(statement) == SQLITE_ROW) while (sqlite3_step(statement) == SQLITE_ROW)
{ {
// Restore widget settings // Restore widget settings
set_default_size( // @TODO actualize set_default_size(
sqlite3_column_int( sqlite3_column_int(
statement, statement,
DB::SESSION::WIDTH DB::SESSION::WIDTH
@ -289,6 +291,11 @@ int Browser::restore()
) )
); );
sqlite3_column_int(
statement,
DB::SESSION::IS_FULLSCREEN
) ? fullscreen() : unfullscreen();
// Restore children components // Restore children components
browserMain->restore( browserMain->restore(
sqlite3_column_int( sqlite3_column_int(
@ -327,7 +334,7 @@ void Browser::save()
db, db,
get_width(), get_width(),
get_height(), get_height(),
false // @TODO full screen status is_fullscreen()
); );
// Delegate save actions to children components // Delegate save actions to children components
@ -351,7 +358,7 @@ int Browser::DB::SESSION::init(
`time` INTEGER NOT NULL DEFAULT CURRENT_TIMESTAMP, `time` INTEGER NOT NULL DEFAULT CURRENT_TIMESTAMP,
`width` INTEGER NOT NULL, `width` INTEGER NOT NULL,
`height` INTEGER NOT NULL, `height` INTEGER NOT NULL,
`is_full_screen` INTEGER NOT NULL `is_fullscreen` INTEGER NOT NULL
) )
)SQL", )SQL",
nullptr, nullptr,
@ -420,7 +427,7 @@ sqlite3_int64 Browser::DB::SESSION::add(
sqlite3 * db, sqlite3 * db,
const int & WIDTH, const int & WIDTH,
const int & HEIGHT, const int & HEIGHT,
const bool & IS_FULL_SCREEN const bool & IS_FULLSCREEN
) { ) {
char * error; // @TODO char * error; // @TODO
@ -431,7 +438,7 @@ sqlite3_int64 Browser::DB::SESSION::add(
INSERT INTO `app_browser__session` ( INSERT INTO `app_browser__session` (
`width`, `width`,
`height`, `height`,
`is_full_screen` `is_fullscreen`
) VALUES ( ) VALUES (
%d, %d,
%d, %d,
@ -440,7 +447,7 @@ sqlite3_int64 Browser::DB::SESSION::add(
)SQL", )SQL",
WIDTH, WIDTH,
HEIGHT, HEIGHT,
IS_FULL_SCREEN ? 1 : 0 IS_FULLSCREEN ? 1 : 0
).c_str(), ).c_str(),
nullptr, nullptr,
nullptr, nullptr,

5
src/app/browser.hpp

@ -42,7 +42,7 @@ namespace app
TIME, TIME,
WIDTH, WIDTH,
HEIGHT, HEIGHT,
IS_FULL_SCREEN IS_FULLSCREEN
}; // table fields index }; // table fields index
static int init( static int init(
@ -57,7 +57,7 @@ namespace app
sqlite3 * db, sqlite3 * db,
const int & WIDTH, const int & WIDTH,
const int & HEIGHT, const int & HEIGHT,
const bool & IS_FULL_SCREEN const bool & IS_FULLSCREEN
); // return sqlite3_last_insert_rowid ); // return sqlite3_last_insert_rowid
}; };
}; };
@ -77,6 +77,7 @@ namespace app
// Defaults // Defaults
const int WIDTH = 640; const int WIDTH = 640;
const int HEIGHT = 480; const int HEIGHT = 480;
const bool IS_FULLSCREEN = false;
/* /*
* Browser class API * Browser class API

Loading…
Cancel
Save