0031067: Visualization - Aspect_Window::DoResize() should be a non-const method
[occt.git] / src / Aspect / Aspect_Window.hxx
CommitLineData
42cf5bc1 1// Created by: NW,JPB,CAL
2// Copyright (c) 1991-1999 Matra Datavision
3// Copyright (c) 1999-2014 OPEN CASCADE SAS
4//
5// This file is part of Open CASCADE Technology software library.
6//
7// This library is free software; you can redistribute it and/or modify it under
8// the terms of the GNU Lesser General Public License version 2.1 as published
9// by the Free Software Foundation, with special exception defined in the file
10// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11// distribution for complete text of the license and disclaimer of any warranty.
12//
13// Alternatively, this file may be used under the terms of Open CASCADE
14// commercial license or contractual agreement.
15
16#ifndef _Aspect_Window_HeaderFile
17#define _Aspect_Window_HeaderFile
18
42cf5bc1 19#include <Aspect_Background.hxx>
20#include <Aspect_GradientBackground.hxx>
b6bf4ec1 21#include <Aspect_FBConfig.hxx>
42cf5bc1 22#include <Aspect_FillMethod.hxx>
87432b82 23#include <Quantity_Color.hxx>
42cf5bc1 24#include <Aspect_GradientFillMethod.hxx>
25#include <Aspect_TypeOfResize.hxx>
42cf5bc1 26#include <Aspect_Drawable.hxx>
49582f9d 27#include <Standard.hxx>
28#include <Standard_Transient.hxx>
29#include <Standard_Type.hxx>
30#include <TCollection_AsciiString.hxx>
8693dfd0 31
32class Aspect_DisplayConnection;
42cf5bc1 33
25e59720 34DEFINE_STANDARD_HANDLE(Aspect_Window, Standard_Transient)
42cf5bc1 35
36//! Defines a window.
25e59720 37class Aspect_Window : public Standard_Transient
42cf5bc1 38{
39
40public:
8693dfd0 41
42cf5bc1 42 //! Modifies the window background.
43 Standard_EXPORT void SetBackground (const Aspect_Background& ABack);
87432b82 44
42cf5bc1 45 //! Modifies the window background.
46 Standard_EXPORT void SetBackground (const Quantity_Color& color);
8693dfd0 47
42cf5bc1 48 //! Modifies the window gradient background.
49 Standard_EXPORT void SetBackground (const Aspect_GradientBackground& ABackground);
8693dfd0 50
42cf5bc1 51 //! Modifies the window gradient background.
52 Standard_EXPORT void SetBackground (const Quantity_Color& theFirstColor, const Quantity_Color& theSecondColor, const Aspect_GradientFillMethod theFillMethod);
8693dfd0 53
42cf5bc1 54 //! Opens the window <me>.
55 Standard_EXPORT virtual void Map() const = 0;
8693dfd0 56
42cf5bc1 57 //! Closes the window <me>.
58 Standard_EXPORT virtual void Unmap() const = 0;
8693dfd0 59
42cf5bc1 60 //! Apply the resizing to the window <me>.
1a5007a9 61 Standard_EXPORT virtual Aspect_TypeOfResize DoResize() = 0;
8693dfd0 62
42cf5bc1 63 //! Apply the mapping change to the window <me>.
64 //! and returns TRUE if the window is mapped at screen.
65 Standard_EXPORT virtual Standard_Boolean DoMapping() const = 0;
8693dfd0 66
42cf5bc1 67 //! Returns the window background.
68 Standard_EXPORT Aspect_Background Background() const;
8693dfd0 69
42cf5bc1 70 //! Returns the current image background fill mode.
71 Standard_EXPORT Aspect_FillMethod BackgroundFillMethod() const;
8693dfd0 72
42cf5bc1 73 //! Returns the window gradient background.
74 Standard_EXPORT Aspect_GradientBackground GradientBackground() const;
8693dfd0 75
42cf5bc1 76 //! Returns True if the window <me> is opened
77 //! and False if the window is closed.
78 Standard_EXPORT virtual Standard_Boolean IsMapped() const = 0;
8693dfd0 79
42cf5bc1 80 //! Returns True if the window <me> is virtual
81 Standard_EXPORT Standard_Boolean IsVirtual() const;
8693dfd0 82
42cf5bc1 83 //! Setup the virtual state
84 Standard_EXPORT void SetVirtual (const Standard_Boolean theVirtual);
8693dfd0 85
42cf5bc1 86 //! Returns The Window RATIO equal to the physical
87 //! WIDTH/HEIGHT dimensions
ee2be2a8 88 Standard_EXPORT virtual Standard_Real Ratio() const = 0;
8693dfd0 89
42cf5bc1 90 //! Returns The Window POSITION in PIXEL
91 Standard_EXPORT virtual void Position (Standard_Integer& X1, Standard_Integer& Y1, Standard_Integer& X2, Standard_Integer& Y2) const = 0;
8693dfd0 92
42cf5bc1 93 //! Returns The Window SIZE in PIXEL
94 Standard_EXPORT virtual void Size (Standard_Integer& Width, Standard_Integer& Height) const = 0;
8693dfd0 95
42cf5bc1 96 //! Returns native Window handle (HWND on Windows, Window with Xlib, and so on)
97 Standard_EXPORT virtual Aspect_Drawable NativeHandle() const = 0;
8693dfd0 98
42cf5bc1 99 //! Returns parent of native Window handle (HWND on Windows, Window with Xlib, and so on)
100 Standard_EXPORT virtual Aspect_Drawable NativeParentHandle() const = 0;
101
b6bf4ec1 102 //! Returns native Window FB config (GLXFBConfig on Xlib)
103 Standard_EXPORT virtual Aspect_FBConfig NativeFBConfig() const = 0;
42cf5bc1 104
49582f9d 105 //! Sets window title.
106 virtual void SetTitle (const TCollection_AsciiString& theTitle) { (void )theTitle; }
107
8693dfd0 108 //! Invalidate entire window content.
109 //!
110 //! Implementation is expected to allow calling this method from non-GUI thread,
111 //! e.g. by queuing exposure event into window message queue or in other thread-safe manner.
112 //!
113 //! Optional display argument should be passed when called from non-GUI thread
114 //! on platforms implementing thread-unsafe connections to display.
115 //! NULL can be passed instead otherwise.
116 virtual void InvalidateContent (const Handle(Aspect_DisplayConnection)& theDisp) { (void )theDisp; }
117
25e59720 118 DEFINE_STANDARD_RTTIEXT(Aspect_Window,Standard_Transient)
42cf5bc1 119
120protected:
121
42cf5bc1 122 //! Initializes the datas of a Window.
123 Standard_EXPORT Aspect_Window();
124
87432b82 125protected:
126
42cf5bc1 127 Aspect_Background MyBackground;
128 Aspect_GradientBackground MyGradientBackground;
129 Aspect_FillMethod MyBackgroundFillMethod;
130 Standard_Boolean MyIsVirtual;
131
42cf5bc1 132};
133
42cf5bc1 134#endif // _Aspect_Window_HeaderFile