41 m_bMouseInside =
false;
47 uiWindow::~uiWindow(
void)
51 void uiWindow::move(laPoint3 ptNewPos,
unsigned nHReference,
unsigned nVReference)
58 laSettings *s = laSystemIntegrator::getSettings();
59 ptParentSz.x( s->graphics_resolution_w );
60 ptParentSz.y( s->graphics_resolution_h );
64 ptParentSz.x(
_pParent->getSize().x() - 2*
_pParent->getDecorationSize().x() );
65 ptParentSz.y(
_pParent->getSize().y() - 2*
_pParent->getDecorationSize().y() );
76 _ptPos.x( (ptParentSz.x() - getSize().x()) - ptNewPos.x() );
79 _ptPos.x( (ptParentSz.x() - getSize().x())/2.0 - ptNewPos.x() );
91 _ptPos.y( (ptParentSz.y() - getSize().y()) - ptNewPos.y() );
94 _ptPos.y( (ptParentSz.y() - getSize().y())/2.0 - ptNewPos.y() );
101 ASSERT(_pPointer,
"Nil pointer");
102 ASSERT(_pSkin,
"Nil skin");
108 _ptPointerOldPos = _pPointer->_ptPos;
117 fp->readObj(&pos, M_FALSE);
118 fp->readObj(&sz, M_FALSE);
132 ASSERT(_pPointer,
"Nil pointer");
138 bool bInside =
false;
141 if( (pos.x() <= _pPointer->_ptPos.x()) && (pos.y() <= _pPointer->_ptPos.y()) &&
142 (pos.x()+
_ptSize.x() >= _pPointer->_ptPos.x()) && (pos.y()+
_ptSize.y() >= _pPointer->_ptPos.y()) )
148 if( (bInside==
true) && (m_bMouseInside==
false) ) this->onMouseIn();
149 if( (bInside==
false) && (m_bMouseInside==
true) ) this->onMouseOut();
152 if( (bInside==
true) && (m_bMouseInside==
true) )
154 _ptPointerOffest += ( _pPointer->_ptPos - _ptPointerOldPos );
156 if( (_ptPointerOffest.lenght() >= CUI__WINDOW_DRAGSTEP) )
159 _ptPointerOffest = laPoint3();
165 _ptPointerOffest = laPoint3();
168 _ptPointerOldPos = _pPointer->_ptPos;
171 m_bMouseInside = bInside;
176 if((in::mouse_b0())&&(!r)) this->onDown(0);
177 if((in::mouse_b1())&&(!l)) this->onDown(1);
179 if((!in::mouse_b0())&&(r)) this->onUp(0);
180 if((!in::mouse_b1())&&(l)) this->onUp(1);
194 return ( posParent +
getPos() );
210 void uiWindow::onMouseIn()
215 void uiWindow::onMouseOut()
220 void uiWindow::onMouseMove(laPoint3 ptRelativePos)
225 void uiWindow::onClick(
unsigned nButton)
235 void uiWindow::onDown(
unsigned nButton)
240 void uiWindow::onUp(
unsigned nButton)
244 this->onClick(nButton);
laPoint3 _ptPos
Windos position (relative to parent)
#define M_AB
Text align bottom.
virtual void load(class laFileParser *fp)
Load a dialog layout form .cui file.
virtual void move(laPoint3 ptNewPos, unsigned nHReference=M_AL, unsigned nVReference=M_AT)
Change window position.
#define M_AM
Text align middle.
#define M_AL
Text align left.
#define M_AT
Text align top.
#define M_AR
Text align right.
laPoint3 _ptSize
Window size.
bool _bVisible
Window visibility flag.
uiWindow * _pParent
Pointer to parent window, if any.
laPoint3 getAbsolutePos()
Get absolute window position.
uiWindow(void)
Class constructor.
virtual void create(laPoint3 pos, laPoint3 size)
Create new empty window.
#define M_AC
Text align center.
laPoint3 getRelativePointerPos()
Get mouse pointer position relative to window position.
bool _bEnabled
Window interactivity flag.
virtual void reply()
Handle input message.
virtual void draw()
Display the window.
laPoint3 getPos()
Get relative window position with regard to parent.
virtual void onCommand(unsigned long uID, unsigned long nCmd)
Command event handler.
virtual void kill()
Discard window and all children.