sptk2 logo
SPTK Home Page
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
sptk::CWindowShape Class Reference

Window non-rectangular shape support. More...

#include <CWindowShape.h>

Inheritance diagram for sptk::CWindowShape:
sptk::CWindow sptk::CDialog sptk::CPopupWindow sptk::CAskDialog sptk::CFileDialog sptk::CSpellChecker sptk::CDBDropDownList sptk::CPopupCalendar sptk::CInputDialog sptk::CMessageDialog sptk::CDirOpenDialog sptk::CFileOpenDialog sptk::CFileSaveDialog sptk::CEditorSpellChecker

Public Member Functions

 CWindowShape (sptk::CWindow *window)
 Constructor. More...
 
virtual ~CWindowShape ()
 Destructor.
 
bool shapeResizing ()
 Returns true if the window is resizing as a result of border drag. More...
 

Protected Member Functions

int mouseZone (int mouseX, int mouseY) const
 Computes mouse zone from window coordinates. More...
 
void changeSize (int mouseX, int mouseY)
 Resizes the window based on mouse zone and mouse screen coordinates. More...
 
virtual int shapeCursorHandle (int event)
 Changes the window cursor based on the mouse position in the window. More...
 
void initShapeExtension ()
 Initializes shape extension. More...
 
bool borderCleared () const
 Returns true if border was cleared for the shape.
 
void shapeApply ()
 Sets the shape to the window during window->draw()
 
void resizingShape (int w, int h)
 Calls resizeShape() from inside CWindow::resize()
 
virtual void shapeResize (int w, int h)
 Shape resize. More...
 

Protected Attributes

int m_resizingZone {0}
 
int m_pushedX {0}
 
int m_pushedY {0}
 
std::vector< CShapePointm_shapePoints
 
bool m_shapeChanged {true}
 
int m_borderWidth {6}
 
bool m_borderCleared {false}
 
bool m_shapeExtension {false}
 

Detailed Description

Window non-rectangular shape support.

Window shape is defined with the array of points that should be modified at every resize of the window. The derived window should modify the shape points array by ovewriting shapeResize() method. The window resize support is activated only if window resizable() is true.

Constructor & Destructor Documentation

◆ CWindowShape()

sptk::CWindowShape::CWindowShape ( sptk::CWindow window)
explicit

Constructor.

Parameters
windowsptk::CWindow*, window to change shape

Member Function Documentation

◆ changeSize()

void sptk::CWindowShape::changeSize ( int  mouseX,
int  mouseY 
)
protected

Resizes the window based on mouse zone and mouse screen coordinates.

Parameters
mouseXint, mouse x-coordinate in the screen
mouseYint, mouse y-coordinate in the screen

◆ initShapeExtension()

void sptk::CWindowShape::initShapeExtension ( )
protected

Initializes shape extension.

Allows window to use shape extension. Should be called before the window is first shown.

◆ mouseZone()

int sptk::CWindowShape::mouseZone ( int  mouseX,
int  mouseY 
) const
protected

Computes mouse zone from window coordinates.

Parameters
mouseXint, mouse x-coordinate in the window
mouseYint, mouse y-coordinate in the window

◆ shapeCursorHandle()

virtual int sptk::CWindowShape::shapeCursorHandle ( int  event)
protectedvirtual

Changes the window cursor based on the mouse position in the window.

Designed to emulate cursor changes on the window border for shaped windows. Should be uncoditionally called inside handle() for the window.

◆ shapeResize()

virtual void sptk::CWindowShape::shapeResize ( int  w,
int  h 
)
inlineprotectedvirtual

Shape resize.

This method should be overwritten in the derived class to adapt m_shapePoints[] to the window size.

◆ shapeResizing()

bool sptk::CWindowShape::shapeResizing ( )
inline

Returns true if the window is resizing as a result of border drag.

Can be used to simplified drawing during the resize

Member Data Documentation

◆ m_borderCleared

bool sptk::CWindowShape::m_borderCleared {false}
protected

Is no border flag set for the window?

◆ m_borderWidth

int sptk::CWindowShape::m_borderWidth {6}
protected

Shape border width, the default is 6

◆ m_pushedX

int sptk::CWindowShape::m_pushedX {0}
protected

X coordinate of the last FL_PUSH event

◆ m_pushedY

int sptk::CWindowShape::m_pushedY {0}
protected

Y coordinate of the last FL_PUSH event

◆ m_resizingZone

int sptk::CWindowShape::m_resizingZone {0}
protected

Resizing mouse zone where mouse was pushed

◆ m_shapeChanged

bool sptk::CWindowShape::m_shapeChanged {true}
protected

Is the shape size changed?

◆ m_shapeExtension

bool sptk::CWindowShape::m_shapeExtension {false}
protected

Is the shape extension activated?

◆ m_shapePoints

std::vector<CShapePoint> sptk::CWindowShape::m_shapePoints
protected

Vector of points defining window shape


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

Fri Oct 14 2022 09:58:41: SPTK 5.4.1