@@ -70,6 +70,19 @@ void jwm::WindowWin32::setTitle(const std::wstring& title) {
7070 SetWindowTextW (_hWnd, title.c_str ());
7171}
7272
73+ void jwm::WindowWin32::setTitlebarVisible (bool isVisible) {
74+ JWM_VERBOSE (" Set titlebar visible=" << isVisible << " for window 0x" << this );
75+ if (isVisible == true ) {
76+ LONG_PTR lStyle = GetWindowLongPtr (_hWnd, GWL_STYLE);
77+ lStyle |= (WS_CAPTION | WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_SYSMENU);
78+ SetWindowLongPtr (_hWnd, GWL_STYLE, lStyle);
79+ } else {
80+ LONG_PTR lStyle = GetWindowLongPtr (_hWnd, GWL_STYLE);
81+ lStyle &= ~(WS_CAPTION | WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_SYSMENU);
82+ SetWindowLongPtr (_hWnd, GWL_STYLE, lStyle);
83+ }
84+ }
85+
7386void jwm::WindowWin32::setIcon (const std::wstring& iconPath) {
7487 JWM_VERBOSE (" Set window icon '" << iconPath << " '" );
7588 // width / height of 0 along with LR_DEFAULTSIZE tells windows to load the default icon size.
@@ -656,6 +669,15 @@ LRESULT jwm::WindowWin32::processEvent(UINT uMsg, WPARAM wParam, LPARAM lParam)
656669 dispatch (classes::EventWindowFocusOut::kInstance );
657670 break ;
658671
672+ case WM_STYLECHANGED: {
673+ IRect rect = getWindowRect ();
674+ int windowWidth = rect.getWidth ();
675+ int windowHeight = rect.getHeight ();
676+ JWM_VERBOSE (" StyleChanged event"
677+ << " window w=" << windowWidth << " h=" << windowHeight);
678+ setContentSize (windowWidth, windowHeight);
679+ return 0 ;
680+ }
659681
660682 case WM_CLOSE:
661683 JWM_VERBOSE (" Event close" );
@@ -1013,6 +1035,12 @@ extern "C" JNIEXPORT void JNICALL Java_io_github_humbleui_jwm_WindowWin32__1nSet
10131035 env->ReleaseStringChars (title, titleStr);
10141036}
10151037
1038+ extern " C" JNIEXPORT void JNICALL Java_io_github_humbleui_jwm_WindowWin32__1nSetTitlebarVisible
1039+ (JNIEnv* env, jobject obj, jboolean isVisible) {
1040+ jwm::WindowWin32* instance = reinterpret_cast <jwm::WindowWin32*>(jwm::classes::Native::fromJava (env, obj));
1041+ instance->setTitlebarVisible (isVisible);
1042+ }
1043+
10161044extern " C" JNIEXPORT void JNICALL Java_io_github_humbleui_jwm_WindowWin32__1nSetIcon
10171045 (JNIEnv* env, jobject obj, jstring iconPath) {
10181046 jwm::WindowWin32* instance = reinterpret_cast <jwm::WindowWin32*>(jwm::classes::Native::fromJava (env, obj));
0 commit comments