~ubuntu-branches/ubuntu/utopic/kde-workspace/utopic-proposed

« back to all changes in this revision

Viewing changes to plasma/generic/scriptengines/google_gadgets/plasma_view_host.h

  • Committer: Bazaar Package Importer
  • Author(s): Michał Zając
  • Date: 2011-07-09 08:31:15 UTC
  • Revision ID: james.westby@ubuntu.com-20110709083115-ohyxn6z93mily9fc
Tags: upstream-4.6.90
Import upstream version 4.6.90

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
  Copyright 2007 Google Inc.
 
3
 
 
4
  Licensed under the Apache License, Version 2.0 (the "License");
 
5
  you may not use this file except in compliance with the License.
 
6
  You may obtain a copy of the License at
 
7
 
 
8
       http://www.apache.org/licenses/LICENSE-2.0
 
9
 
 
10
  Unless required by applicable law or agreed to in writing, software
 
11
  distributed under the License is distributed on an "AS IS" BASIS,
 
12
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 
13
  See the License for the specific language governing permissions and
 
14
  limitations under the License.
 
15
*/
 
16
 
 
17
#ifndef GGADGET_PLASMA_VIEW_HOST_H__
 
18
#define GGADGET_PLASMA_VIEW_HOST_H__
 
19
 
 
20
#include <set>
 
21
 
 
22
#include <QtGui/QGraphicsWidget>
 
23
 
 
24
#include <ggadget/view_interface.h>
 
25
#include <ggadget/graphics_interface.h>
 
26
#include <ggadget/view_host_interface.h>
 
27
#include <ggadget/qt/qt_graphics.h>
 
28
#include <ggadget/qt/qt_view_widget.h>
 
29
#include "plasma_host.h"
 
30
 
 
31
namespace ggadget {
 
32
 
 
33
using namespace ggadget::qt;
 
34
 
 
35
inline bool isHorizontal(Plasma::Location loc) {
 
36
  return loc == Plasma::TopEdge || loc == Plasma::BottomEdge;
 
37
}
 
38
 
 
39
inline bool isVertical(Plasma::Location loc) {
 
40
  return loc == Plasma::LeftEdge || loc == Plasma::RightEdge;
 
41
}
 
42
 
 
43
class PlasmaViewHost : public ViewHostInterface {
 
44
 public:
 
45
  PlasmaViewHost(GadgetInfo *info, ViewHostInterface::Type type, bool popout = false);
 
46
  virtual ~PlasmaViewHost();
 
47
 
 
48
  virtual Type GetType() const;
 
49
  virtual void Destroy();
 
50
  virtual void SetView(ViewInterface *view);
 
51
  virtual ViewInterface *GetView() const;
 
52
  virtual GraphicsInterface *NewGraphics() const {
 
53
    return new QtGraphics(1.0);
 
54
  }
 
55
  virtual void *GetNativeWidget() const;
 
56
  virtual void ViewCoordToNativeWidgetCoord(
 
57
      double x, double y, double *widget_x, double *widget_y) const;
 
58
  virtual void NativeWidgetCoordToViewCoord(
 
59
      double x, double y, double *view_x, double *view_y) const;
 
60
  virtual void QueueDraw();
 
61
  virtual void QueueResize();
 
62
  virtual void EnableInputShapeMask(bool enable) { Q_UNUSED(enable); }
 
63
  virtual void SetResizable(ViewInterface::ResizableMode mode);
 
64
  virtual void SetCaption(const std::string &caption);
 
65
  virtual void SetShowCaptionAlways(bool) {}
 
66
  virtual void SetCursor(ggadget::ViewInterface::CursorType cursor);
 
67
  virtual void ShowTooltip(const std::string &tooltip);
 
68
  virtual void ShowTooltipAtPosition(const std::string &tooltip,
 
69
                                     double x, double y);
 
70
  virtual bool ShowView(bool modal, int flags,
 
71
                        Slot1<bool, int> *feedback_handler);
 
72
  virtual void CloseView();
 
73
  virtual bool ShowContextMenu(int button);
 
74
  virtual void BeginResizeDrag(int, ViewInterface::HitTest) {}
 
75
  virtual void BeginMoveDrag(int) {}
 
76
 
 
77
  virtual void Alert(const ViewInterface *view, const char *message);
 
78
  virtual ConfirmResponse Confirm(const ViewInterface *view,
 
79
                                  const char *message, bool);
 
80
  virtual std::string Prompt(const ViewInterface *view,
 
81
                             const char *message,
 
82
                             const char *default_value);
 
83
  virtual int GetDebugMode() const;
 
84
 
 
85
  GadgetInfo *getInfo();
 
86
 
 
87
 private:
 
88
  class Private;
 
89
  Private *d;
 
90
  DISALLOW_EVIL_CONSTRUCTORS(PlasmaViewHost);
 
91
};
 
92
 
 
93
} // namespace ggadget
 
94
 
 
95
#endif // GGADGET_PLASMA_VIEW_HOST_H__