LunaSysMgr
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
IpcClientHost.h
Go to the documentation of this file.
1 /* @@@LICENSE
2 *
3 * Copyright (c) 2009-2012 Hewlett-Packard Development Company, L.P.
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *
17 * LICENSE@@@ */
18 
19 
20 
21 
22 #ifndef IPCCLIENTHOST_H
23 #define IPCCLIENTHOST_H
24 
25 #include "Common.h"
26 
27 #include <string>
28 #include <map>
29 #include <set>
30 #include <glib.h>
31 
32 #include <PIpcChannelListener.h>
33 #include "Window.h"
34 
35 #include <QObject>
36 
37 class PIpcChannel;
38 class PIpcBuffer;
39 class SysMgrKeyEvent;
40 
42 {
43  Q_OBJECT
44 public:
45 
46  IpcClientHost();
47  IpcClientHost(int pid, const std::string& name, PIpcChannel* channel);
48  virtual ~IpcClientHost();
49 
50  void windowDeleted(Window* w);
51 
52  virtual void relaunch(char * const argv[]);
53  virtual void closeWindow(Window* w);
54 
55  virtual void replaceWindowKey(Window* win, int oldKey, int newKey);
56 
57  int pid() const { return m_pid; }
58  std::string name() const { return m_name; }
59  bool hasWindows() const;
60 
61 protected:
62 
63  virtual void onMessageReceived(const PIpcMessage& msg);
64  virtual void onDisconnected();
65 
66  virtual void onReturnedInputEvent(const SysMgrKeyEvent& event);
67  virtual void onPrepareAddWindow(int key, int type, int width, int height);
68  virtual void onAddWindow(int key);
69  virtual void onRemoveWindow(int key);
70  virtual void onSetWindowProperties(int key, const std::string& winProps);
71  virtual void onFocusWindow(int key);
72  virtual void onUnfocusWindow(int key);
73 
74 
75 
76  virtual Window* findWindow(int key) const;
77 
78 protected Q_SLOTS:
79 
81 
82 
83 protected:
84 
85  int m_pid;
87  std::string m_name;
88 
89  typedef std::map<int, Window*> WindowMap;
90  typedef std::set<Window*> WindowSet;
94 
95  bool m_clearing;
96  GSource* m_idleDestroySrc;
97 
98 private:
99 
101  IpcClientHost& operator=(const IpcClientHost&);
102 
103  static gboolean idleDestroyCallback(gpointer arg);
104 };
105 
106 
107 #endif /* IPCCLIENTHOST_H */