Home | History | Annotate | Download | only in base
      1 // Copyright 2010 Google Inc. All Rights Reserved
      2 
      3 //         thorcarpenter (at) google.com (Thor Carpenter)
      4 
      5 #ifndef TALK_BASE_WINDOWPICKER_H_
      6 #define TALK_BASE_WINDOWPICKER_H_
      7 
      8 #include <string>
      9 #include <vector>
     10 
     11 #include "talk/base/window.h"
     12 
     13 namespace talk_base {
     14 
     15 class WindowDescription {
     16  public:
     17   WindowDescription() : id_() {}
     18   WindowDescription(const WindowId& id, const std::string& title)
     19       : id_(id), title_(title) {
     20   }
     21   const WindowId& id() const { return id_; }
     22   void set_id(const WindowId& id) { id_ = id; }
     23   const std::string& title() const { return title_; }
     24   void set_title(const std::string& title) { title_ = title; }
     25 
     26  private:
     27   WindowId id_;
     28   std::string title_;
     29 };
     30 
     31 class DesktopDescription {
     32  public:
     33   DesktopDescription() : id_() {}
     34   DesktopDescription(const DesktopId& id, const std::string& title)
     35       : id_(id), title_(title), primary_(false) {
     36   }
     37   const DesktopId& id() const { return id_; }
     38   void set_id(const DesktopId& id) { id_ = id; }
     39   const std::string& title() const { return title_; }
     40   void set_title(const std::string& title) { title_ = title; }
     41   // Indicates whether it is the primary desktop in the system.
     42   bool primary() const { return primary_; }
     43   void set_primary(bool primary) { primary_ = primary; }
     44 
     45  private:
     46   DesktopId id_;
     47   std::string title_;
     48   bool primary_;
     49 };
     50 
     51 typedef std::vector<WindowDescription> WindowDescriptionList;
     52 typedef std::vector<DesktopDescription> DesktopDescriptionList;
     53 
     54 class WindowPicker {
     55  public:
     56   virtual ~WindowPicker() {}
     57   virtual bool Init() = 0;
     58 
     59   // TODO: Move this two methods to window.h when we no longer need to load
     60   // CoreGraphics dynamically.
     61   virtual bool IsVisible(const WindowId& id) = 0;
     62   virtual bool MoveToFront(const WindowId& id) = 0;
     63 
     64   // Gets a list of window description and appends to descriptions.
     65   // Returns true if successful.
     66   virtual bool GetWindowList(WindowDescriptionList* descriptions) = 0;
     67   // Gets a list of desktop descriptions and appends to descriptions.
     68   // Returns true if successful.
     69   virtual bool GetDesktopList(DesktopDescriptionList* descriptions) = 0;
     70   // Gets the width and height of a desktop.
     71   // Returns true if successful.
     72   virtual bool GetDesktopDimensions(const DesktopId& id, int* width,
     73                                     int* height) = 0;
     74 };
     75 
     76 }  // namespace talk_base
     77 
     78 #endif  // TALK_BASE_WINDOWPICKER_H_
     79