mirror of
https://github.com/encounter/SDL.git
synced 2025-12-20 02:15:27 +00:00
Added SDL_SetWindowResizable(). (thanks, Ethan!)
This commit is contained in:
@@ -56,6 +56,7 @@ enum WinCommands {
|
||||
BWIN_RESTORE_WINDOW,
|
||||
BWIN_SET_TITLE,
|
||||
BWIN_SET_BORDERED,
|
||||
BWIN_SET_RESIZABLE,
|
||||
BWIN_FULLSCREEN
|
||||
};
|
||||
|
||||
@@ -378,6 +379,9 @@ class SDL_BWin:public BDirectWindow
|
||||
case BWIN_SET_BORDERED:
|
||||
_SetBordered(message);
|
||||
break;
|
||||
case BWIN_SET_RESIZABLE:
|
||||
_SetResizable(message);
|
||||
break;
|
||||
case BWIN_SHOW_WINDOW:
|
||||
Show();
|
||||
break;
|
||||
@@ -568,6 +572,18 @@ private:
|
||||
SetLook(bEnabled ? B_BORDERED_WINDOW_LOOK : B_NO_BORDER_WINDOW_LOOK);
|
||||
}
|
||||
|
||||
void _SetResizable(BMessage *msg) {
|
||||
bool bEnabled;
|
||||
if(msg->FindBool("window-resizable", &bEnabled) != B_OK) {
|
||||
return;
|
||||
}
|
||||
if (bEnabled) {
|
||||
SetFlags(GetFlags() & ~(B_NOT_RESIZABLE | B_NOT_ZOOMABLE));
|
||||
} else {
|
||||
SetFlags(GetFlags() | (B_NOT_RESIZABLE | B_NOT_ZOOMABLE));
|
||||
}
|
||||
}
|
||||
|
||||
void _Restore() {
|
||||
if(IsMinimized()) {
|
||||
Minimize(false);
|
||||
|
||||
@@ -81,6 +81,7 @@ BE_CreateDevice(int devindex)
|
||||
device->MinimizeWindow = BE_MinimizeWindow;
|
||||
device->RestoreWindow = BE_RestoreWindow;
|
||||
device->SetWindowBordered = BE_SetWindowBordered;
|
||||
device->SetWindowResizable = BE_SetWindowResizable;
|
||||
device->SetWindowFullscreen = BE_SetWindowFullscreen;
|
||||
device->SetWindowGammaRamp = BE_SetWindowGammaRamp;
|
||||
device->GetWindowGammaRamp = BE_GetWindowGammaRamp;
|
||||
|
||||
@@ -145,6 +145,12 @@ void BE_SetWindowBordered(_THIS, SDL_Window * window, SDL_bool bordered) {
|
||||
_ToBeWin(window)->PostMessage(&msg);
|
||||
}
|
||||
|
||||
void BE_SetWindowResizable(_THIS, SDL_Window * window, SDL_bool resizable) {
|
||||
BMessage msg(BWIN_SET_RESIZABLE);
|
||||
msg.AddBool("window-resizable", resizable != SDL_FALSE);
|
||||
_ToBeWin(window)->PostMessage(&msg);
|
||||
}
|
||||
|
||||
void BE_ShowWindow(_THIS, SDL_Window * window) {
|
||||
BMessage msg(BWIN_SHOW_WINDOW);
|
||||
_ToBeWin(window)->PostMessage(&msg);
|
||||
|
||||
@@ -39,6 +39,7 @@ extern void BE_MaximizeWindow(_THIS, SDL_Window * window);
|
||||
extern void BE_MinimizeWindow(_THIS, SDL_Window * window);
|
||||
extern void BE_RestoreWindow(_THIS, SDL_Window * window);
|
||||
extern void BE_SetWindowBordered(_THIS, SDL_Window * window, SDL_bool bordered);
|
||||
extern void BE_SetWindowResizable(_THIS, SDL_Window * window, SDL_bool resizable);
|
||||
extern void BE_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * display, SDL_bool fullscreen);
|
||||
extern int BE_SetWindowGammaRamp(_THIS, SDL_Window * window, const Uint16 * ramp);
|
||||
extern int BE_GetWindowGammaRamp(_THIS, SDL_Window * window, Uint16 * ramp);
|
||||
|
||||
Reference in New Issue
Block a user