Windows/Databasewindow: fix reactive UI

This commit is contained in:
zvon 2020-02-25 17:24:48 +01:00
parent 7186635f1c
commit 3201f8cece

View File

@ -22,14 +22,14 @@
#define LANG_ID_COLUMN 5 #define LANG_ID_COLUMN 5
#define TVID_COLUMN 6 #define TVID_COLUMN 6
#define database_width( width ) width - 25 #define database_width( width ) width - 10
#define database_height( height ) height - 90 #define database_height( height ) height - 50
#define cancel_x( width ) width - 100 #define cancel_x( width ) width - 85
#define cancel_y( height ) height - 73 #define cancel_y( height ) height - 30
#define ok_x( width ) width - 185 #define ok_x( width ) width - 170
#define ok_y( height ) height - 73 #define ok_y( height ) height - 30
#define save_x( width ) 5 #define save_x( width ) 5
#define save_y( height ) height - 73 #define save_y( height ) height - 30
DatabaseWindow *DatabaseWindow::dw = nullptr; DatabaseWindow *DatabaseWindow::dw = nullptr;
@ -61,8 +61,13 @@ DatabaseWindow::DatabaseWindow(
icex.dwICC = ICC_LISTVIEW_CLASSES; icex.dwICC = ICC_LISTVIEW_CLASSES;
InitCommonControlsEx( &icex ); InitCommonControlsEx( &icex );
list_hwnd = createListView( 5, 5, database_width( window_width ), RECT client_rect{};
database_height( window_height ), ID_LISTVIEW, GetClientRect( window, &client_rect );
auto client_width = client_rect.right - client_rect.left;
auto client_height = client_rect.bottom - client_rect.top;
list_hwnd = createListView( 5, 5, database_width( client_width ),
database_height( client_height ), ID_LISTVIEW,
window, hFont ); window, hFont );
addColumnToListView( list_hwnd, L"Show", 90, SHOW_COLUMN ); addColumnToListView( list_hwnd, L"Show", 90, SHOW_COLUMN );
addColumnToListView( list_hwnd, L"Path", 180, PATH_COLUMN ); addColumnToListView( list_hwnd, L"Path", 180, PATH_COLUMN );
@ -99,14 +104,14 @@ DatabaseWindow::DatabaseWindow(
row++; row++;
} }
cancel_button = createButton( L"Cancel", cancel_x( window_width ), cancel_button = createButton( L"Cancel", cancel_x( client_width ),
cancel_y( window_height ), 80, 25, cancel_y( client_height ), 80, 25,
ID_CANCEL_BUTTON, window, hFont ); ID_CANCEL_BUTTON, window, hFont );
ok_button = ok_button =
createButton( L"OK", ok_x( window_width ), ok_y( window_height ), 80, createButton( L"OK", ok_x( client_width ), ok_y( client_height ), 80,
25, ID_OK_BUTTON, window, hFont ); 25, ID_OK_BUTTON, window, hFont );
save_button = save_button =
createButton( L"Save", save_x( window_width ), save_y( window_height ), createButton( L"Save", save_x( client_width ), save_y( client_height ),
80, 25, ID_SAVE_BUTTON, window, hFont ); 80, 25, ID_SAVE_BUTTON, window, hFont );
lang_combo = createCombo( 0, 0, 120, 110, ID_LANG_COMBO, window, hFont ); lang_combo = createCombo( 0, 0, 120, 110, ID_LANG_COMBO, window, hFont );
@ -170,7 +175,7 @@ LRESULT CALLBACK DatabaseWindow::messageHandler( HWND hwnd, UINT umsg,
SetWindowPos( dw->save_button, HWND_TOP, save_x( width ), SetWindowPos( dw->save_button, HWND_TOP, save_x( width ),
save_y( height ), 80, 25, 0 ); save_y( height ), 80, 25, 0 );
UpdateWindow( dw->window ); UpdateWindow( dw->window );
} break; } break;
case WM_NOTIFY: case WM_NOTIFY:
dw->listNotify( lParam ); dw->listNotify( lParam );
break; break;