Back to index

unity  6.0.0
WindowButtons.h
Go to the documentation of this file.
00001 // -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*-
00002 /*
00003  * Copyright (C) 2010-2012 Canonical Ltd
00004  *
00005  * This program is free software: you can redistribute it and/or modify
00006  * it under the terms of the GNU General Public License version 3 as
00007  * published by the Free Software Foundation.
00008  *
00009  * This program is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  * GNU General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
00016  *
00017  * Authored by: Neil Jagdish Patel <neil.patel@canonical.com>
00018  *              Marco Trevisan (TreviƱo) <3v1n0@ubuntu.com>
00019  */
00020 
00021 #ifndef WINDOW_BUTTONS_H
00022 #define WINDOW_BUTTONS_H
00023 
00024 #include <Nux/HLayout.h>
00025 #include <Nux/Button.h>
00026 
00027 #include "unity-shared/UBusWrapper.h"
00028 #include "unity-shared/Introspectable.h"
00029 
00030 namespace unity
00031 {
00032 class WindowButtons : public nux::HLayout, public debug::Introspectable
00033 {
00034   // These are the [close][minimize][restore] buttons on the panel when there
00035   // is a maximized window
00036 
00037 public:
00038   WindowButtons();
00039 
00040   void SetOpacity(double opacity);
00041   double GetOpacity();
00042 
00043   void SetFocusedState(bool focused);
00044   bool GetFocusedState();
00045 
00046   void SetControlledWindow(Window xid);
00047   Window GetControlledWindow();
00048 
00049   void SetMonitor(int monitor);
00050   int GetMonitor();
00051 
00052   virtual nux::Area* FindAreaUnderMouse(const nux::Point& mouse_pos, nux::NuxEventType event_type);
00053 
00054   sigc::signal<void> close_clicked;
00055   sigc::signal<void> minimize_clicked;
00056   sigc::signal<void> restore_clicked;
00057   sigc::signal<void> maximize_clicked;
00058   sigc::signal<void, int, int, int, int, unsigned long, unsigned long> mouse_move;
00059   sigc::signal<void, int, int, unsigned long, unsigned long> mouse_enter;
00060   sigc::signal<void, int, int, unsigned long, unsigned long> mouse_leave;
00061 
00062 protected:
00063   std::string GetName() const;
00064   void AddProperties(GVariantBuilder* builder);
00065 
00066 private:
00067   void OnCloseClicked(nux::Button *button);
00068   void OnMinimizeClicked(nux::Button *button);
00069   void OnRestoreClicked(nux::Button *button);
00070   void OnMaximizeClicked(nux::Button *button);
00071   void OnOverlayShown(GVariant* data);
00072   void OnOverlayHidden(GVariant* data);
00073   void OnDashSettingsUpdated();
00074 
00075   int monitor_;
00076   double opacity_;
00077   bool focused_;
00078   Window window_xid_;
00079   std::string active_overlay_;
00080 
00081   UBusManager ubus_manager_;
00082 };
00083 }
00084 #endif