0026936: Drawbacks of inlining in new type system in OCCT 7.0 -- manual
[occt.git] / samples / java / jniviewer / jni / OcctJni_Window.hxx
CommitLineData
7f2debb2 1// Copyright (c) 2014 OPEN CASCADE SAS
2//
3// This file is part of Open CASCADE Technology software library.
4//
5// This library is free software; you can redistribute it and/or modify it under
6// the terms of the GNU Lesser General Public License version 2.1 as published
7// by the Free Software Foundation, with special exception defined in the file
8// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
9// distribution for complete text of the license and disclaimer of any warranty.
10//
11// Alternatively, this file may be used under the terms of Open CASCADE
12// commercial license or contractual agreement.
13
14#ifndef OcctJni_Window_H
15#define OcctJni_Window_H
16
17#include <Aspect_Window.hxx>
18
19//! This class defines dummy window
20class OcctJni_Window : public Aspect_Window
21{
22
23public:
24
25 //! Creates a wrapper over existing Window handle
26 OcctJni_Window (const int theWidth, const int theHeight)
27 : myWidth (theWidth), myHeight(theHeight) {}
28
29 //! Returns native Window handle
30 virtual Aspect_Drawable NativeHandle() const { return 0; }
31
32 //! Returns parent of native Window handle
33 virtual Aspect_Drawable NativeParentHandle() const { return 0; }
34
35 virtual void Destroy() {}
36
37 //! Opens the window <me>
38 virtual void Map() const {}
39
40 //! Closes the window <me>
41 virtual void Unmap() const {}
42
43 //! Applies the resizing to the window <me>
44 virtual Aspect_TypeOfResize DoResize() const { return Aspect_TOR_UNKNOWN; }
45
46 //! Apply the mapping change to the window <me>
47 virtual Standard_Boolean DoMapping() const { return Standard_True; }
48
49 //! Returns True if the window <me> is opened
50 virtual Standard_Boolean IsMapped() const { return Standard_True; }
51
52 //! Returns The Window RATIO equal to the physical WIDTH/HEIGHT dimensions
53 virtual Quantity_Ratio Ratio() const { return 1.0; }
54
55 //! Returns The Window POSITION in PIXEL
56 virtual void Position (Standard_Integer& theX1,
57 Standard_Integer& theY1,
58 Standard_Integer& theX2,
59 Standard_Integer& theY2) const
60 {
61 theX1 = 0;
62 theX2 = myWidth;
63 theY1 = 0;
64 theY2 = myHeight;
65 }
66
67 //! Set The Window POSITION in PIXEL
68 virtual void SetPosition (const Standard_Integer theX1,
69 const Standard_Integer theY1,
70 const Standard_Integer theX2,
71 const Standard_Integer theY2)
72 {
73 myWidth = theX2 - theX1;
74 myHeight = theY2 - theY1;
75 }
76
77 //! Returns The Window SIZE in PIXEL
78 virtual void Size (Standard_Integer& theWidth,
79 Standard_Integer& theHeight) const
80 {
81 theWidth = myWidth;
82 theHeight = myHeight;
83 }
84
85 //! Set The Window SIZE in PIXEL
86 virtual void SetSize (const Standard_Integer theWidth,
87 const Standard_Integer theHeight)
88 {
89 myWidth = theWidth;
90 myHeight = theHeight;
91 }
92
93private:
94
95 int myWidth;
96 int myHeight;
97
98public:
99
100 DEFINE_STANDARD_RTTI(OcctJni_Window)
101
102};
103
104DEFINE_STANDARD_HANDLE(OcctJni_Window, Aspect_Window)
105
106#endif // OcctJni_Window_H