Browse Source

Haiku: implement some more window-related methods

Kostadin Damyanov 10 years ago
parent
commit
7ad89c7e83
2 changed files with 49 additions and 1 deletions
  1. 43 1
      platform/haiku/os_haiku.cpp
  2. 6 0
      platform/haiku/os_haiku.h

+ 43 - 1
platform/haiku/os_haiku.cpp

@@ -20,7 +20,6 @@ void OS_Haiku::run() {
 	}
 
 	main_loop->init();
-	window->Show();
 	window->StartMessageRunner();
 	app->Run();
 	window->StopMessageRunner();
@@ -56,6 +55,16 @@ void OS_Haiku::initialize(const VideoMode& p_desired, int p_video_driver, int p_
 
 	window = new HaikuDirectWindow(frame);
 
+	if (current_video_mode.fullscreen) {
+		window->SetFullScreen(true);
+	}
+
+	if (!current_video_mode.resizable) {
+		uint32 flags = window->Flags();
+		flags |= B_NOT_RESIZABLE;
+		window->SetFlags(flags);
+	}
+
 #if defined(OPENGL_ENABLED) || defined(LEGACYGL_ENABLED)
 	context_gl = memnew(ContextGL_Haiku(window));
 	context_gl->initialize();
@@ -98,6 +107,7 @@ void OS_Haiku::initialize(const VideoMode& p_desired, int p_video_driver, int p_
 
 	input = memnew(InputDefault);
 	window->SetInput(input);
+	window->Show();
 }
 
 void OS_Haiku::finalize() {
@@ -246,6 +256,38 @@ bool OS_Haiku::is_window_fullscreen() const {
 	return current_video_mode.fullscreen;
 }
 
+void OS_Haiku::set_window_resizable(bool p_enabled) {
+	uint32 flags = window->Flags();
+
+	if (p_enabled) {
+		flags &= ~(B_NOT_RESIZABLE);
+	} else {
+		flags |= B_NOT_RESIZABLE;
+	}
+
+	window->SetFlags(flags);
+}
+
+bool OS_Haiku::is_window_resizable() const {
+	return !(window->Flags() & B_NOT_RESIZABLE);
+}
+
+void OS_Haiku::set_window_minimized(bool p_enabled) {
+	window->Minimize(p_enabled);
+}
+
+bool OS_Haiku::is_window_minimized() const {
+	return window->IsMinimized();
+}
+
+void OS_Haiku::set_window_maximized(bool p_enabled) {
+	window->Minimize(!p_enabled);
+}
+
+bool OS_Haiku::is_window_maximized() const {
+	return !window->IsMinimized();
+}
+
 void OS_Haiku::set_video_mode(const VideoMode& p_video_mode, int p_screen) {
 	ERR_PRINT("set_video_mode() NOT IMPLEMENTED");
 }

+ 6 - 0
platform/haiku/os_haiku.h

@@ -81,6 +81,12 @@ public:
 	virtual void set_window_position(const Point2& p_position);
 	virtual void set_window_fullscreen(bool p_enabled);
 	virtual bool is_window_fullscreen() const;
+	virtual void set_window_resizable(bool p_enabled);
+	virtual bool is_window_resizable() const;
+	virtual void set_window_minimized(bool p_enabled);
+	virtual bool is_window_minimized() const;
+	virtual void set_window_maximized(bool p_enabled);
+	virtual bool is_window_maximized() const;
 
 	virtual void set_video_mode(const VideoMode& p_video_mode, int p_screen=0);
 	virtual VideoMode get_video_mode(int p_screen=0) const;