windows/patternwindow: localization

This commit is contained in:
zvon 2020-04-01 13:54:19 +02:00
parent c12020529b
commit 768f171de9
2 changed files with 19 additions and 10 deletions

View File

@ -1,4 +1,9 @@
#pragma comment( linker, "\"/manifestdependency:type='win32' \
name='Microsoft.Windows.Common-Controls' version='6.0.0.0' \
processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"" )
#include "patternwindow.hpp"
#include "../functions.hpp"
#include "../resources_windows.h"
#include "gui_functions.hpp"
#define ID_PATTERN_STATIC 0x0001
@ -12,21 +17,25 @@ PatternWindow *PatternWindow::pw = nullptr;
PatternWindow::PatternWindow( HINSTANCE hInstance, const wchar_t *pattern,
HWND parent_window )
: parent( parent_window ) {
window = CreateWindowW( L"PatternWindow", L"Change database pattern",
window = CreateWindowW( L"PatternWindow", _( PATTERN ),
WS_OVERLAPPEDWINDOW ^ WS_THICKFRAME | WS_VISIBLE,
CW_USEDEFAULT, CW_USEDEFAULT, window_width,
window_height, parent, NULL, hInstance, NULL );
ShowWindow( window, SW_SHOW );
auto hFont = ( HFONT )GetStockObject( DEFAULT_GUI_FONT );
EnableWindow( parent, false );
setIcons( hInstance, window );
createLabel( L"Pattern:", 5, 5, 30, 15, ID_PATTERN_STATIC, window, hFont );
std::wstring label = _( PATTERN );
label += L":";
createLabel( label.c_str(), 5, 5, 30, 15, ID_PATTERN_STATIC, window,
hFont );
pattern_input =
createEditBox( 5, 20, 190, 25, ID_PATTERN_EDIT, window, hFont );
createEditBox( 5, 20, 190, 20, ID_PATTERN_EDIT, window, hFont );
createButton( L"Cancel", window_width - 100, window_height - 88, 80, 25,
createButton( _( CANCEL ), window_width - 100, window_height - 88, 80, 25,
ID_CANCEL_BUTTON, window, hFont );
createButton( L"OK", window_width - 185, window_height - 88, 80, 25,
createButton( _( OK ), window_width - 185, window_height - 88, 80, 25,
ID_OK_BUTTON, window, hFont );
SendMessage( pattern_input, WM_SETTEXT, NULL, ( LPARAM )pattern );
@ -50,12 +59,12 @@ LRESULT CALLBACK PatternWindow::messageHandler( HWND hwnd, UINT umsg,
case WM_COMMAND:
switch ( LOWORD( wParam ) ) {
case ID_OK_BUTTON:
pw->result = OK;
pw->result = DIA_OK;
pw->storePattern();
SendMessage( hwnd, WM_CLOSE, 0, 0 );
break;
case ID_CANCEL_BUTTON:
pw->result = Cancel;
pw->result = DIA_Cancel;
SendMessage( hwnd, WM_CLOSE, 0, 0 );
break;
}
@ -79,5 +88,5 @@ void PatternWindow::mainLoop() {
}
bool PatternWindow::accepted() {
return result == OK;
return result == DIA_OK;
}

View File

@ -1,5 +1,5 @@
#include <string>
#include <windows.h>
#include <string>
class PatternWindow {
public:
@ -18,7 +18,7 @@ public:
}
private:
enum DialogResult { OK, Cancel };
enum DialogResult { DIA_OK, DIA_Cancel };
void storePattern();