Open CASCADE Technology Reference Manual 8.0.0
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Protected Attributes
Xw_Window Class Reference

This class defines XLib window intended for creation of OpenGL context. More...

#include <Xw_Window.hxx>

Inheritance diagram for Xw_Window:
Inheritance graph
[legend]

Public Member Functions

 Xw_Window (const occ::handle< Aspect_DisplayConnection > &theXDisplay, const char *const theTitle, const int thePxLeft, const int thePxTop, const int thePxWidth, const int thePxHeight)
 Creates a XLib window defined by his position and size in pixels. Throws exception if window can not be created or Display do not support GLX extension.
 
 Xw_Window (const occ::handle< Aspect_DisplayConnection > &theXDisplay, const Aspect_Drawable theXWin, const Aspect_FBConfig theFBConfig=nullptr)
 Creates a wrapper over existing Window handle.
 
 ~Xw_Window () override
 Destroys the Window and all resources attached to it.
 
void Map () const override
 Opens the window <me>
 
void Unmap () const override
 Closes the window <me>
 
Aspect_TypeOfResize DoResize () override
 Applies the resizing to the window <me>
 
bool DoMapping () const override
 Apply the mapping change to the window <me>
 
bool IsMapped () const override
 Returns True if the window <me> is opened.
 
double Ratio () const override
 Returns The Window RATIO equal to the physical WIDTH/HEIGHT dimensions.
 
void Position (int &X1, int &Y1, int &X2, int &Y2) const override
 Returns The Window POSITION in PIXEL.
 
void Size (int &theWidth, int &theHeight) const override
 Returns The Window SIZE in PIXEL.
 
Aspect_Drawable XWindow () const
 
Aspect_Drawable NativeHandle () const override
 
Aspect_Drawable NativeParentHandle () const override
 
Aspect_FBConfig NativeFBConfig () const override
 
void SetTitle (const TCollection_AsciiString &theTitle) override
 Sets window title.
 
void InvalidateContent (const occ::handle< Aspect_DisplayConnection > &theDisp) override
 Invalidate entire window content through generation of Expose event. This method does not aggregate multiple calls into single event - dedicated event will be sent on each call. When NULL display connection is specified, the connection specified on window creation will be used. Sending exposure messages from non-window thread would require dedicated display connection opened specifically for this working thread to avoid race conditions, since Xlib display connection is not thread-safe by default.
 
virtual bool ProcessMessage (Aspect_WindowInputListener &theListener, XEvent &theMsg)
 Process a single window message.
 
- Public Member Functions inherited from Aspect_Window
bool IsVirtual () const
 Returns True if the window <me> is virtual.
 
void SetVirtual (const bool theVirtual)
 Setup the virtual state.
 
NCollection_Vec2< intTopLeft () const
 Returns window top-left corner.
 
NCollection_Vec2< intDimensions () const
 Returns window dimensions.
 
const occ::handle< Aspect_DisplayConnection > & DisplayConnection () const
 Returns connection to Display or NULL.
 
Aspect_Background Background () const
 Returns the window background.
 
Aspect_FillMethod BackgroundFillMethod () const
 Returns the current image background fill mode.
 
Aspect_GradientBackground GradientBackground () const
 Returns the window gradient background.
 
void SetBackground (const Aspect_Background &theBack)
 Modifies the window background.
 
void SetBackground (const Quantity_Color &theColor)
 Modifies the window background.
 
void SetBackground (const Aspect_GradientBackground &theBackground)
 Modifies the window gradient background.
 
void SetBackground (const Quantity_Color &theFirstColor, const Quantity_Color &theSecondColor, const Aspect_GradientFillMethod theFillMethod)
 Modifies the window gradient background.
 
virtual double DevicePixelRatio () const
 Return device pixel ratio (logical to backing store scale factor).
 
virtual NCollection_Vec2< doubleConvertPointToBacking (const NCollection_Vec2< double > &thePnt) const
 Convert point from logical units into backing store units.
 
virtual NCollection_Vec2< doubleConvertPointFromBacking (const NCollection_Vec2< double > &thePnt) const
 Convert point from backing store units to logical units.
 
void DumpJson (Standard_OStream &theOStream, int theDepth=-1) const
 Dumps the content of me into the stream.
 
- Public Member Functions inherited from Standard_Transient
 Standard_Transient ()
 Empty constructor.
 
 Standard_Transient (const Standard_Transient &)
 Copy constructor – does nothing.
 
Standard_Transientoperator= (const Standard_Transient &)
 Assignment operator, needed to avoid copying reference counter.
 
virtual ~Standard_Transient ()=default
 Destructor must be virtual.
 
virtual const opencascade::handle< Standard_Type > & DynamicType () const
 Returns a type descriptor about this object.
 
bool IsInstance (const opencascade::handle< Standard_Type > &theType) const
 Returns a true value if this is an instance of Type.
 
bool IsInstance (const char *const theTypeName) const
 Returns a true value if this is an instance of TypeName.
 
bool IsKind (const opencascade::handle< Standard_Type > &theType) const
 Returns true if this is an instance of Type or an instance of any class that inherits from Type. Note that multiple inheritance is not supported by OCCT RTTI mechanism.
 
bool IsKind (const char *const theTypeName) const
 Returns true if this is an instance of TypeName or an instance of any class that inherits from TypeName. Note that multiple inheritance is not supported by OCCT RTTI mechanism.
 
Standard_TransientThis () const
 Returns non-const pointer to this object (like const_cast). For protection against creating handle to objects allocated in stack or call from constructor, it will raise exception Standard_ProgramError if reference counter is zero.
 
int GetRefCount () const noexcept
 Get the reference counter of this object.
 
void IncrementRefCounter () noexcept
 Increments the reference counter of this object. Uses relaxed memory ordering since incrementing only requires atomicity, not synchronization with other memory operations.
 
int DecrementRefCounter () noexcept
 Decrements the reference counter of this object; returns the decremented value. Uses release ordering for the decrement to ensure all writes to the object are visible before the count reaches zero. An acquire fence is added only when the count reaches zero, ensuring proper synchronization before deletion. This is more efficient than using acq_rel for every decrement.
 
virtual void Delete () const
 Memory deallocator for transient classes.
 

Static Public Member Functions

static Aspect_VKey VirtualKeyFromNative (unsigned long theKey)
 Convert X11 virtual key (KeySym) into Aspect_VKey.
 
- Static Public Member Functions inherited from Standard_Transient
static constexpr const charget_type_name ()
 Returns a type descriptor about this object.
 
static const opencascade::handle< Standard_Type > & get_type_descriptor ()
 Returns type descriptor of Standard_Transient class.
 

Protected Attributes

Aspect_Drawable myXWindow
 XLib window handle.
 
Aspect_FBConfig myFBConfig
 GLXFBConfig.
 
int myXLeft
 left position in pixels
 
int myYTop
 top position in pixels
 
int myXRight
 right position in pixels
 
int myYBottom
 bottom position in pixels
 
bool myIsOwnWin
 flag to indicate own window handle (to be deallocated on destruction)
 
- Protected Attributes inherited from Aspect_Window
occ::handle< Aspect_DisplayConnectionmyDisplay
 Display connection.
 
Aspect_Background MyBackground
 
Aspect_GradientBackground MyGradientBackground
 
Aspect_FillMethod MyBackgroundFillMethod
 
bool MyIsVirtual
 

Additional Inherited Members

- Public Types inherited from Standard_Transient
typedef void base_type
 Returns a type descriptor about this object.
 
- Protected Member Functions inherited from Aspect_Window
 Aspect_Window ()
 Initializes the data of a Window.
 

Detailed Description

This class defines XLib window intended for creation of OpenGL context.

Constructor & Destructor Documentation

◆ Xw_Window() [1/2]

Xw_Window::Xw_Window ( const occ::handle< Aspect_DisplayConnection > & theXDisplay,
const char *const theTitle,
const int thePxLeft,
const int thePxTop,
const int thePxWidth,
const int thePxHeight )

Creates a XLib window defined by his position and size in pixels. Throws exception if window can not be created or Display do not support GLX extension.

◆ Xw_Window() [2/2]

Xw_Window::Xw_Window ( const occ::handle< Aspect_DisplayConnection > & theXDisplay,
const Aspect_Drawable theXWin,
const Aspect_FBConfig theFBConfig = nullptr )

Creates a wrapper over existing Window handle.

◆ ~Xw_Window()

Xw_Window::~Xw_Window ( )
override

Destroys the Window and all resources attached to it.

Member Function Documentation

◆ DoMapping()

bool Xw_Window::DoMapping ( ) const
inlineoverridevirtual

Apply the mapping change to the window <me>

Implements Aspect_Window.

◆ DoResize()

Aspect_TypeOfResize Xw_Window::DoResize ( )
overridevirtual

Applies the resizing to the window <me>

Implements Aspect_Window.

◆ InvalidateContent()

void Xw_Window::InvalidateContent ( const occ::handle< Aspect_DisplayConnection > & theDisp)
overridevirtual

Invalidate entire window content through generation of Expose event. This method does not aggregate multiple calls into single event - dedicated event will be sent on each call. When NULL display connection is specified, the connection specified on window creation will be used. Sending exposure messages from non-window thread would require dedicated display connection opened specifically for this working thread to avoid race conditions, since Xlib display connection is not thread-safe by default.

Reimplemented from Aspect_Window.

◆ IsMapped()

bool Xw_Window::IsMapped ( ) const
overridevirtual

Returns True if the window <me> is opened.

Implements Aspect_Window.

◆ Map()

void Xw_Window::Map ( ) const
overridevirtual

Opens the window <me>

Implements Aspect_Window.

◆ NativeFBConfig()

Aspect_FBConfig Xw_Window::NativeFBConfig ( ) const
inlineoverridevirtual
Returns
native Window FB config (GLXFBConfig on Xlib)

Implements Aspect_Window.

◆ NativeHandle()

Aspect_Drawable Xw_Window::NativeHandle ( ) const
inlineoverridevirtual
Returns
native Window handle

Implements Aspect_Window.

◆ NativeParentHandle()

Aspect_Drawable Xw_Window::NativeParentHandle ( ) const
inlineoverridevirtual
Returns
parent of native Window handle

Implements Aspect_Window.

◆ Position()

void Xw_Window::Position ( int & X1,
int & Y1,
int & X2,
int & Y2 ) const
overridevirtual

Returns The Window POSITION in PIXEL.

Implements Aspect_Window.

◆ ProcessMessage()

virtual bool Xw_Window::ProcessMessage ( Aspect_WindowInputListener & theListener,
XEvent & theMsg )
virtual

Process a single window message.

Parameters
[in]

out] theListener listener to redirect message

Parameters
[in]

out] theMsg message to process

Returns
TRUE if message has been processed

◆ Ratio()

double Xw_Window::Ratio ( ) const
overridevirtual

Returns The Window RATIO equal to the physical WIDTH/HEIGHT dimensions.

Implements Aspect_Window.

◆ SetTitle()

void Xw_Window::SetTitle ( const TCollection_AsciiString & theTitle)
overridevirtual

Sets window title.

Reimplemented from Aspect_Window.

◆ Size()

void Xw_Window::Size ( int & theWidth,
int & theHeight ) const
overridevirtual

Returns The Window SIZE in PIXEL.

Implements Aspect_Window.

◆ Unmap()

void Xw_Window::Unmap ( ) const
overridevirtual

Closes the window <me>

Implements Aspect_Window.

◆ VirtualKeyFromNative()

static Aspect_VKey Xw_Window::VirtualKeyFromNative ( unsigned long theKey)
static

Convert X11 virtual key (KeySym) into Aspect_VKey.

◆ XWindow()

Aspect_Drawable Xw_Window::XWindow ( ) const
inline
Returns
native Window handle

Field Documentation

◆ myFBConfig

Aspect_FBConfig Xw_Window::myFBConfig
protected

GLXFBConfig.

◆ myIsOwnWin

bool Xw_Window::myIsOwnWin
protected

flag to indicate own window handle (to be deallocated on destruction)

◆ myXLeft

int Xw_Window::myXLeft
protected

left position in pixels

◆ myXRight

int Xw_Window::myXRight
protected

right position in pixels

◆ myXWindow

Aspect_Drawable Xw_Window::myXWindow
protected

XLib window handle.

◆ myYBottom

int Xw_Window::myYBottom
protected

bottom position in pixels

◆ myYTop

int Xw_Window::myYTop
protected

top position in pixels


The documentation for this class was generated from the following file: