summaryrefslogtreecommitdiffstats
path: root/views
diff options
context:
space:
mode:
authordavemoore@chromium.org <davemoore@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-25 19:09:53 +0000
committerdavemoore@chromium.org <davemoore@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-25 19:09:53 +0000
commitd968fdab62374a2fce2811a9b631f89d7ce30e96 (patch)
tree7c620dc6d6eba881ca7bc1e6c1cbdfbedb51ec8c /views
parent1ffc48b3e1a9ebff5c1020798536a5dd9f974662 (diff)
downloadchromium_src-d968fdab62374a2fce2811a9b631f89d7ce30e96.zip
chromium_src-d968fdab62374a2fce2811a9b631f89d7ce30e96.tar.gz
chromium_src-d968fdab62374a2fce2811a9b631f89d7ce30e96.tar.bz2
Implement IsMinimized() and IsMaximized() for view gtk
Review URL: http://codereview.chromium.org/115745 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@16859 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views')
-rw-r--r--views/window/window_gtk.cc22
-rw-r--r--views/window/window_gtk.h10
2 files changed, 28 insertions, 4 deletions
diff --git a/views/window/window_gtk.cc b/views/window/window_gtk.cc
index 8363a66..5455239 100644
--- a/views/window/window_gtk.cc
+++ b/views/window/window_gtk.cc
@@ -105,13 +105,11 @@ bool WindowGtk::IsVisible() const {
}
bool WindowGtk::IsMaximized() const {
- NOTIMPLEMENTED();
- return false;
+ return window_maximized_;
}
bool WindowGtk::IsMinimized() const {
- NOTIMPLEMENTED();
- return false;
+ return window_minimized_;
}
void WindowGtk::SetFullscreen(bool fullscreen) {
@@ -208,6 +206,12 @@ void WindowGtk::Init(const gfx::Rect& bounds) {
UpdateWindowTitle();
+ GtkWindow* gtk_window = GetNativeWindow();
+ g_signal_connect(G_OBJECT(gtk_window),
+ "window-state-event",
+ G_CALLBACK(CallWindowStateEvent),
+ NULL);
+
// SetInitialBounds(bounds);
// if (!IsAppWindow()) {
@@ -228,4 +232,14 @@ void WindowGtk::SaveWindowPosition() {
NOTIMPLEMENTED();
}
+// static
+void WindowGtk::CallWindowStateEvent(GtkWidget* widget,
+ GdkEventWindowState* window_state) {
+ WindowGtk* window_gtk = GetWindowForNative(widget);
+ window_gtk->window_maximized_ =
+ window_state->new_window_state & GDK_WINDOW_STATE_MAXIMIZED;
+ window_gtk->window_minimized_ =
+ window_state->new_window_state & GDK_WINDOW_STATE_ICONIFIED;
+}
+
} // namespace views
diff --git a/views/window/window_gtk.h b/views/window/window_gtk.h
index d38ce62..18b9210 100644
--- a/views/window/window_gtk.h
+++ b/views/window/window_gtk.h
@@ -71,6 +71,10 @@ class WindowGtk : public WidgetGtk, public Window {
void Init(const gfx::Rect& bounds);
private:
+ // Used to track window state changes
+ static void CallWindowStateEvent(GtkWidget* widget,
+ GdkEventWindowState* window_state);
+
// Asks the delegate if any to save the window's location and size.
void SaveWindowPosition();
@@ -91,6 +95,12 @@ class WindowGtk : public WidgetGtk, public Window {
// Set to true if the window is in the process of closing.
bool window_closed_;
+ // Set to true if the window is maximized
+ bool window_maximized_;
+
+ // Set to true of the window is minimized
+ bool window_minimized_;
+
DISALLOW_COPY_AND_ASSIGN(WindowGtk);
};