Pyro higlevel API
Classes | Public Member Functions | Friends | List of all members
os::Window Class Reference
Inheritance diagram for os::Window:
os::Looper os::Handler HandlerSelector InfoWin MountDialogWin NewDirWin os::Alert os::ColorRequester os::FileRequester os::FontRequester os::InputBox os::MenuWindow os::ProgressRequester os::Splash os::ToolTip RenameFileWin

Classes

class  Private
 

Public Member Functions

 Window (const Rect &cFrame, const String &cName, const String &cTitle, uint32 nFlags=0, uint32 nDesktopMask=CURRENT_DESKTOP)
 Initialize the window. More...
 
 ~Window ()
 Destruct a window. More...
 
virtual void FrameMoved (const Point &cDelta)
 
virtual void FrameSized (const Point &cDelta)
 
virtual void ScreenModeChanged (const IPoint &cNewRes, color_space eColorSpace)
 Called whenever the screenmode changes. More...
 
virtual void DesktopActivated (int nDesktop, bool bActive)
 Called whenever the desktop displaying the window will be activated or deactivated. More...
 
virtual void DesktopsChanged (uint32 nOldDesktops, uint32 nNewDesktops)
 
virtual void WindowsChanged ()
 Called whenever the currently shown windows change. More...
 
void SetFlags (uint32 nFlags)
 
uint32 GetFlags () const
 
void SetSizeLimits (const Point &cMinSize, const Point &cMaxSize)
 Limit the minimum and maximum window size. More...
 
void SetAlignment (const IPoint &cSize=IPoint(1, 1), const IPoint &cSizeOffset=IPoint(0, 0), const IPoint &cPos=IPoint(1, 1), const IPoint &cPosOffset=IPoint(0, 0))
 
void AddChild (View *pcChild, bool bAssignTabOrder=false)
 Add a view to the window. More...
 
void RemoveChild (View *pcChild)
 Remove a view from the window. More...
 
void MakeFocus (bool bFocus=true)
 Activate/Deactivate the window. More...
 
void Close ()
 
void Show (bool bMakeVisible=true)
 Hide/Unhide the window. More...
 
void Hide ()
 
bool IsVisible () const
 
void Start ()
 Unlock the window and start the looper thread. More...
 
void SetTitle (const String &cTitle)
 Change the window title. More...
 
String GetTitle (void) const
 Obtain the current window title. More...
 
void SetIcon (Bitmap *pcIcon)
 Change the window icon. More...
 
BitmapGetIcon (void) const
 Not longer supported. More...
 
void Flush ()
 Flush the windows render queue. More...
 
void Sync ()
 Flush the render queue, and wait til the rendering is done. More...
 
ViewFindView (const String &cName) const
 
ViewFindView (const Point &cPos) const
 Find the view covering a given position on the window. More...
 
ViewGetFocusChild (void) const
 
ViewSetFocusChild (View *pcChild)
 Activate a view. More...
 
void SetDefaultButton (View *pcView)
 Assign a default button. More...
 
ViewGetDefaultButton () const
 Return the view assigned as the default button. More...
 
void SetDefaultWheelView (View *pcView)
 
ViewGetDefaultWheelView () const
 
Rect GetFrame () const
 Get the windows position and size on the current desktop. More...
 
Rect GetBounds () const
 Get the window boundary. More...
 
void SetFrame (const Rect &cRect, bool bNotifyServer=true)
 Set the window's position and size. More...
 
void MoveBy (const Point &cDelta)
 Move the window relative to it's current position. More...
 
void MoveBy (float vDeltaX, float vDeltaY)
 Move the window relative to it's current position. More...
 
void MoveTo (const Point &cPos)
 Move the window to an absolute position. More...
 
void MoveTo (float x, float y)
 Move the window to an absolute position. More...
 
void CenterInWindow (Window *pcWin)
 Move the window to the centre of another window. More...
 
void CenterInScreen ()
 Move the window to the center of the screen. More...
 
void ResizeBy (const Point &cDelta)
 Resize the window relative to it's current size. More...
 
void ResizeBy (float vDeltaW, float vDeltaH)
 Resize the window relative to it's current size. More...
 
void ResizeTo (const Point &cSize)
 Resize the window to a new absolute size. More...
 
void ResizeTo (float w, float h)
 Resize the window to a new absolute size. More...
 
void SetShapeRegion (const Region &cReg)
 
void ClearShapeRegion ()
 
bool IsActive () const
 
int ToggleDepth ()
 
void AddShortcut (const ShortcutKey &cKey, Message *pcMsg)
 Add a keyboard shortcut. More...
 
void AddShortcut (const ShortcutKey &cKey, View *pcView)
 Add a keyboard shortcut. More...
 
void RemoveShortcut (const ShortcutKey &cKey)
 Remove a keyboard shortcut. More...
 
void DispatchMessage (Message *pcMessage, Handler *pcHandler)
 The loopers message handling callback. More...
 
- Public Member Functions inherited from os::Looper
 Looper (const String &cName, int nPriority=NORMAL_PRIORITY, int nPortSize=DEFAULT_PORT_SIZE)
 The looper constructor. More...
 
virtual ~Looper ()
 Looper destructor. More...
 
void SetName (const String &cName)
 Rename the looper. More...
 
String GetName () const
 Get the loopers name. More...
 
bool IsPublic () const
 See if the looper's message port is public. More...
 
void SetPublic (bool bPublic)
 Make port public/private. More...
 
port_id GetMsgPort () const
 Obtain the low-level message port used by this looper. More...
 
thread_id GetThread () const
 Obtain the thread id of the looper thread. More...
 
proc_id GetProcess () const
 Obtain the process ID of the loopers thread. More...
 
status_t Lock ()
 Lock the looper object. More...
 
status_t Lock (bigtime_t nTimeout)
 Lock the looper with a timeout. More...
 
status_t SafeLock ()
 Attempt to lock the looper. More...
 
status_t Unlock ()
 Unlock the looper. More...
 
void SetMutex (Locker *pcMutex)
 Set a custom mutex to be used by the looper. More...
 
LockerGetMutex () const
 Get a pointer to the loopers mutex. More...
 
int GetLockCount () const
 Obtain the number of locks held on the looper. More...
 
thread_id GetLockingThread () const
 Obtaing the owner of the looper lock. More...
 
bool IsLocked () const
 Check if the looper lock is owned by the calling thread. More...
 
virtual thread_id Run ()
 Start and unlock the looper. More...
 
int Wait () const
 Wait for the looper thread to die. More...
 
status_t PostMessage (uint32 nCode)
 Deliver a message to the looper. More...
 
status_t PostMessage (Message *pcMsg)
 Deliver a message to the looper. More...
 
status_t PostMessage (uint32 cCode, Handler *pcHandler, Handler *pcReplyTo=NULL)
 Deliver a message to the looper. More...
 
status_t PostMessage (Message *pcMsg, Handler *pcHandler, Handler *pcReplyTo=NULL)
 Deliver a message to the looper. More...
 
void SpoolMessages ()
 Drain the low-level message port. More...
 
MessageGetCurrentMessage () const
 Obtain the message currently being processed. More...
 
MessageDetachCurrentMessage ()
 Steal the current message. More...
 
virtual void Started ()
 Called by the looper thread before entering the message loop. More...
 
virtual bool Idle ()
 Hook called each time the message queue is drained. More...
 
MessageQueueGetMessageQueue () const
 Obtain the internal message queue used by the looper. More...
 
virtual bool OkToQuit ()
 Check if it is ok to break the loop. More...
 
virtual void Quit ()
 Unconditionally terminate the looper. More...
 
void Terminate ()
 Unconditionally terminate the looper. More...
 
void AddTimer (Handler *pcTarget, int nID, bigtime_t nTimeout, bool bOneShot=true)
 Add a timer to the looper. More...
 
bool RemoveTimer (Handler *pcTarget, int nID)
 Delete a timer. More...
 
const handler_mapGetHandlerMap () const
 Get the internal handler list. More...
 
void AddHandler (Handler *pcHandler)
 Add a handler to the looper. More...
 
bool RemoveHandler (Handler *pcHandler)
 Remove a handler previously added by AddHandler() More...
 
HandlerFindHandler (const String &cName) const
 Search the looper for a named handler. More...
 
int GetHandlerCount () const
 Obtain the count of handlers added to this looper. More...
 
void SetDefaultHandler (Handler *pcHandler)
 Set the default target for incomming messages. More...
 
HandlerGetDefaultHandler () const
 Obtain the default handler for the looper. More...
 
void AddCommonFilter (MessageFilter *pcFilter)
 
void RemoveCommonFilter (MessageFilter *pcFilter)
 
const MsgFilterListGetCommonFilterList () const
 
- Public Member Functions inherited from os::Handler
 Handler (const String &cName)
 Construct a handler. More...
 
virtual ~Handler ()
 Destructor. More...
 
virtual void TimerTick (int nID)
 Timer dispatch member. More...
 
virtual void HandleMessage (Message *pcMessage)
 Handle a message targeted at this handler. More...
 
String GetName () const
 Get the handlers name. More...
 
void SetName (const String &cName)
 Rename the handler. More...
 
LooperGetLooper () const
 Get a pointer to the looper this handler belongs to. More...
 
void SetNextHandler (Handler *pcNextHandler)
 Set a handler that should handle messages this handler is not interrested in. More...
 
HandlerGetNextHandler () const
 Get the next handler in a handler chain. More...
 
void AddFilter (MessageFilter *pcFilter)
 
void RemoveFilter (MessageFilter *pcFilter)
 
const MsgFilterListGetFilterList () const
 
const uint32 GetToken ()
 Get the handlers token. More...
 

Friends

class View
 
class Bitmap
 
class MenuItem
 
class ScreenOutput
 

Additional Inherited Members

- Public Types inherited from os::Looper
typedef std::map< int, Handler * > handler_map
 
- Static Public Member Functions inherited from os::Looper
static LooperGetLooperForThread (thread_id hThread)
 
- Protected Member Functions inherited from os::Looper
bool FilterMessage (Message *pcMsg, Handler **ppcTarget, std::list< MessageFilter * > *pcFilterList)
 

Detailed Description

Description:
See Also
Author
Kurt Skauen (kurt@.nosp@m.athe.nosp@m.os.cx)

Constructor & Destructor Documentation

Window::Window ( const Rect cFrame,
const String cName,
const String cTitle,
uint32  nFlags = 0,
uint32  nDesktopMask = CURRENT_DESKTOP 
)
Description:
The window contructor initialize the local object, and initiate the windows connection to the appserver. The window is invisible and locked when the contructor returns. The first call to Show() will unlock the widow, start the looper thread and make it visible. If you want the windows looper to start handling messages before the window is made visible, you can call Start(). This will unlock the window, and start the looper thread without making the window visible. Simply calling Run()/Unlock() will not work, since the internal state of the Window will not be updated.
Parameters
cFrame- The size and position of the window.
See Also
Show(), Start(), Looper::Lock(), Looper::Unlock()
Author
Kurt Skauen (kurt@.nosp@m.athe.nosp@m.os.cx)

References os::Rect::Bounds(), os::Application::GetInstance(), os::Looper::GetMsgPort(), os::Window::Private::m_bIsRunning, os::Window::Private::m_hLayerPort, os::Window::Private::m_hReplyPort, os::Window::Private::m_nFlags, os::Window::Private::m_nRndBufSize, os::Window::Private::m_pcMenuBar, os::Window::Private::m_pcTopView, and os::Window::Private::m_psRenderPkt.

Window::~Window ( )
Description:
The window destructor will delete all View's still atached to it, and shut down the connection to the appserver.
See Also
Window::Window()
Author
Kurt Skauen (kurt@.nosp@m.athe.nosp@m.os.cx)

Member Function Documentation

void Window::AddChild ( View pcChild,
bool  bAssignTabOrder = false 
)
Description:
AddChild() add a view to the windows top-view. The view's View::AttachedToWindow() and View::AllAttached() will be called to let the view know about it's new status.

If bAssignTabOrder is true, the view will be assigned a tab order making it possible to activate the view with the keyboard.

Note:
The window share the tab-order counter with the View class.

When the window is later closed, it will automatically delete all remaining child views.

Parameters
pcChild- The View to add to the window.
bAssignTabOrder- If true the view will be assigned a tab-order one higher than the previously added view.
Returns
See Also
RemoveChild(), View::AddChild(), View::AttachedToWindow(), View::SetTabOrder()
Author
Kurt Skauen (kurt@.nosp@m.athe.nosp@m.os.cx)

References os::View::AddChild(), and os::Window::Private::m_pcTopView.

Referenced by os::Bitmap::AddChild(), os::Alert::Alert(), os::FileRequester::FileRequester(), os::InputBox::InputBox(), os::MenuWindow::MenuWindow(), os::ProgressRequester::ProgressRequester(), os::Splash::Splash(), and os::ToolTip::ToolTip().

void Window::AddShortcut ( const ShortcutKey cKey,
Message pcMsg 
)
Description:
Adds a keyboard shortcut to this window. When the keyboard event occurs, a message is sent to the window's message handler. Normally you should not need to use this method directly, menus and widgets will automatically register their shortcuts.
Parameters
cKey- The keyboard event that triggers the shortcut.
pcMsg- Message to send to this window (automatically deleted).
See Also
RemoveShortcut()
Author
Henrik Isaksson (henri.nosp@m.k@is.nosp@m.aksso.nosp@m.n.tk)

References os::ShortcutKey::IsValid(), os::Window::Private::m_cShortcuts, and RemoveShortcut().

Referenced by os::View::AttachedToWindow(), os::FileRequester::FileRequester(), os::View::SetShortcut(), and os::View::SetShortcutFromLabel().

void Window::AddShortcut ( const ShortcutKey cKey,
View pcView 
)
Description:
Adds a keyboard shortcut to this window. When the keyboard event occurs, the assigned View's KeyDown event handler is called. Normally you should not need to use this method directly, menus and widgets will automatically register their shortcuts.
Parameters
cKey- The keyboard event that triggers the shortcut.
pcView- View to send the shortcut to.
See Also
RemoveShortcut()
Author
Henrik Isaksson (henri.nosp@m.k@is.nosp@m.aksso.nosp@m.n.tk)

References os::ShortcutKey::IsValid(), os::Window::Private::m_cShortcuts, and RemoveShortcut().

void Window::CenterInScreen ( )
Description:
This method moves the window to the center of the screen.
See Also
MoveTo(), MoveBy(), ResizeBy(), ResizeTo(), SetFrame()
Author
Rick Caudill

References GetBounds(), os::Desktop::GetResolution(), os::Rect::Height(), MoveTo(), os::Rect::Width(), os::IPoint::x, and os::IPoint::y.

Referenced by os::Splash::Go(), os::InputBox::InputBox(), and os::RegistrarManager::Launch().

void Window::CenterInWindow ( Window pcWin)
Description:
Move the window so the centre of the window is in the centre of the the given window.
Parameters
pcWin- The Window to center in.
See Also
MoveTo(), MoveBy(), ResizeBy(), ResizeTo(), SetFrame()
Author
Rick Caudill

References GetBounds(), GetFrame(), os::Rect::Height(), os::Rect::left, MoveTo(), os::Rect::top, and os::Rect::Width().

Referenced by os::FileRequester::HandleMessage(), os::IconDirectoryView::HandleMessage(), and os::RegistrarManager::Launch().

void Window::ClearShapeRegion ( )
Description:
Note:
Warning:
Parameters
\return
Error codes:
Since
0.3.7
See Also
SetShapeRegion(), os::View::ClearShapeRegion()
Author
Kurt Skauen (kurt@.nosp@m.athe.nosp@m.os.cx)

References os::View::ClearShapeRegion(), and os::Window::Private::m_pcTopView.

void os::Window::Close ( )
inline
void Window::DesktopActivated ( int  nDesktop,
bool  bActive 
)
virtual
Description:
DesktopActivated( int nDesktop, bool bActive ) will be called when the desktop displaying the window will be activated or deactivated.
Parameters
nDesktop- Now activated desktop if bActive is true. Otherwise the old desktop.
bActive- True if the desktop is activated.
Author
Kurt Skauen (kurt@.nosp@m.athe.nosp@m.os.cx)

Referenced by DispatchMessage().

void Window::DesktopsChanged ( uint32  nOldDesktops,
uint32  nNewDesktops 
)
virtual
void Window::DispatchMessage ( Message pcMsg,
Handler pcHandler 
)
virtual
Description:
When a message arrives, the looper extract's it from the queue and call this member with the message as a parameter. The default implementation will attempt to pass the message on to a Handler through it's os::Handler::HandleMessage() member. The Handler that should receive the message is selected as follows:
If the message targets a specific Handler, that Handler will receive the message. DispatchMessage() can determine wether the message had a final destination by examining the pcHandler argument. If not NULL it points at the handler targeted by the message.
If the message destination however is not fully qualified DispatchMessage() attempts to pass the message on to the Default handler (as set through the SetDefaultHandler()).
If there is no final destination and no default handler the Looper will handle the message itself by calling its own version of HandleMessage() (The looper is itself a os::Handler)
Not all messages are passed on to a handler. If the message code is M_QUIT the Looper::OkToQuit() member is called instead and if it return true looper object will be deleted and the looper thread terminated.
If you would like to handle certain messages directly by the looper, bypassing the normal scheduling you can overload DispatchMessage() to process messages before they are passed on to any handler. If you do so, you should call the loopers version of DispatchMessage() for each message you don't know how to handle.
Please note however that you should very rarly overload this member. It is normaly better to overload the HandleMessage() member and let the looper handle the message as any other handlers if you want to pass messages to the looper itself.
Note
The looper is locked when DispatchMessage() is called.
Never do any lengthy operations in any hook members that are called from the looper thread if the looper is involved with the GUI (for example if the looper is a os::Window). The looper will not be able to dispatch messages until the hook returns so spending a long time in this member will make the GUI feel unresponsive.
Parameters
pcMsg- Pointer to the received messge. Note that this message will be deleted when DispatchMessage() returns, unless detatched from the looper through DetachCurrentMessage().
pcHandler- Pointer to the handler targeted by this message. If the message was not targeted at any spesific handler this argument is NULL.
See Also
SetDefaultHandler(), GetDefaultHandler(), PostMessage(), GetCurrentMessage()
DetachCurrentMessage(), Handler::HandleMessage()
Author
Kurt Skauen (kurt@.nosp@m.athe.nosp@m.os.cx)

Reimplemented from os::Looper.

References os::View::ConvertFromScreen(), DesktopActivated(), os::Looper::DispatchMessage(), os::Message::FindBool(), os::Message::FindInt32(), os::Message::FindIPoint(), os::MessageQueue::FindMessage(), os::Message::FindMessage(), os::Message::FindPoint(), os::Message::FindPointer(), os::Message::FindRect(), os::Message::FindString(), FindView(), Flush(), os::View::FontChanged(), os::Message::GetCode(), GetFocusChild(), os::View::GetFont(), os::Looper::GetMessageQueue(), os::View::GetTabOrder(), os::Rect::IsValid(), os::View::KeyDown(), os::View::KeyUp(), os::MessageQueue::Lock(), os::Window::Private::m_bDidScrollRect, TopView::m_bKeyDownRejected, os::Window::Private::m_cMousePos, os::M_DESKTOP_ACTIVATED, os::M_FONT_CHANGED, os::Window::Private::m_hLayerPort, os::M_KEY_DOWN, os::M_KEY_UP, os::M_MOUSE_DOWN, os::M_MOUSE_MOVED, os::M_MOUSE_UP, os::Window::Private::m_nButtons, os::Window::Private::m_nMouseMoveRun, os::Window::Private::m_nMouseTransition, os::M_PAINT, os::Window::Private::m_pcDefaultButton, os::Window::Private::m_pcDefaultWheelView, os::Window::Private::m_pcLastMouseView, os::Window::Private::m_pcTopView, os::M_SCREENMODE_CHANGED, os::M_WHEEL_MOVED, os::M_WINDOW_ACTIVATED, os::M_WINDOW_FRAME_CHANGED, os::M_WINDOWS_CHANGED, os::View::MakeFocus(), os::View::MouseDown(), os::View::MouseUp(), os::View::Paint(), QUAL_SHIFT, ScreenModeChanged(), SetFrame(), os::Looper::SpoolMessages(), Sync(), os::MessageQueue::Unlock(), VK_ENTER, os::View::WheelMoved(), and WindowsChanged().

View* os::Window::FindView ( const String cName) const
inline
View * Window::FindView ( const Point cPos) const
Description:
FindView( const Point& cPos ) will do a reqursive search through all attached view's to find the topmost view covering the given point. If no view is intersecting the point NULL is returned.
Returns
Pointer to the View, or NULL.
See Also
FindView( const char* pzName )
Author
Kurt Skauen (kurt@.nosp@m.athe.nosp@m.os.cx)

References os::View::GetChildAt(), os::Rect::LeftTop(), and os::Window::Private::m_pcTopView.

void Window::Flush ( void  )
Description:
When a view is rendering graphics, the render commands is buffered in the window, and sendt to the appserver in batches to reduce the overhead of message passing. When the View::Paint() member is called by the system, the render queue will be automatically flushed when View::Paint() returnes. If the view however desides to render anything between paint messages, the render queue must be flushed manually to execute the rendering.
Note:
Flush() do not guarantee that the pixels are indead on-screen when it returns, it only guarantee that the rendering will take place as soon as possible. If you want to make sure all the pixels is rendered, you must use Sync() instead.
See Also
Sync(), Bitmap::Sync(), Bitmap::Flush(), View::Flush(), View::Sync()
Author
Kurt Skauen (kurt@.nosp@m.athe.nosp@m.os.cx)

References os::Locker::Lock(), os::Window::Private::m_cRenderLock, os::Window::Private::m_hLayerPort, os::Window::Private::m_nRndBufSize, os::Window::Private::m_psRenderPkt, and os::Locker::Unlock().

Referenced by os::Alert::Alert(), DispatchMessage(), os::Bitmap::Flush(), os::View::Flush(), SetAlignment(), SetFlags(), SetFrame(), and SetSizeLimits().

void Window::FrameMoved ( const Point cDelta)
virtual

Referenced by TopView::FrameMoved().

void Window::FrameSized ( const Point cDelta)
virtual

Reimplemented in os::FileRequester.

Referenced by TopView::FrameSized().

Rect Window::GetBounds ( void  ) const
Description:
Same as GetFrame() except that the rectangle is moved so the left/top corner is located at 0,0.
Returns
The windows boundary.
See Also
GetFrame(), SetFrame()
Author
Kurt Skauen (kurt@.nosp@m.athe.nosp@m.os.cx)

References os::View::GetBounds(), and os::Window::Private::m_pcTopView.

Referenced by os::Alert::Alert(), CenterInScreen(), CenterInWindow(), os::FileRequester::FileRequester(), os::ProgressRequester::ProgressRequester(), and os::ToolTip::ToolTip().

View * Window::GetDefaultButton ( ) const
Description:
Return the pointer last set through SetDefaultButton() or NULL if not default button is assigned. Note that this is a os::View pointer, and if you want to call any os::Button spesific member you must static_cast it to a os::Button. If you are not 100% sure that the View is in fact a os::Button, you should use dynamic_cast, and test the result before touching it.
Returns
Pointer to the default button, or NULL if no default button is assigned.
See Also
SetDefaultButton()
Author
Kurt Skauen (kurt@.nosp@m.athe.nosp@m.os.cx)

References os::Window::Private::m_pcDefaultButton.

Referenced by os::Button::Paint().

View * Window::GetDefaultWheelView ( ) const
uint32 Window::GetFlags ( ) const
View* os::Window::GetFocusChild ( void  ) const
inline
Rect Window::GetFrame ( ) const
Returns
The windows client rectangle.
See Also
SetFrame(), GetBounds()
Author
Kurt Skauen (kurt@.nosp@m.athe.nosp@m.os.cx)

References os::View::GetFrame(), and os::Window::Private::m_pcTopView.

Referenced by CenterInWindow(), and os::ImageButton::Paint().

Bitmap * Window::GetIcon ( void  ) const
Returns
Not longer supported.
See Also
SetIcon(), GetTitle()
Author
Arno Klenke (arno_.nosp@m.klen.nosp@m.ke@ya.nosp@m.hoo..nosp@m.de)
String Window::GetTitle ( void  ) const
Returns
A const pointer to the internal window title.
See Also
SetTitle()
Author
Kurt Skauen (kurt@.nosp@m.athe.nosp@m.os.cx)

References os::Window::Private::m_cTitle.

void os::Window::Hide ( )
inline
bool Window::IsActive ( ) const
bool Window::IsVisible ( ) const
void Window::MakeFocus ( bool  bFocus = true)
Description:
If bFocus is true the window will gain focus, and start receiving input events generated by the mouse and keyboard. If bFocus is false the window will lose focus to the window that previously had it.
Note:
The appserver keeps a small stack of previously active windows. When a window give up focus volunterly it will then pop one window off the stack and if the stack was not empty that window will receive focus.
Parameters
bFocus- True to activate the window, false to deactivate it.
See Also
View::MakeFocus(), SetFocusChild()
Author
Kurt Skauen (kurt@.nosp@m.athe.nosp@m.os.cx)

References os::Message::AddBool(), os::Window::Private::m_hLayerPort, and os::Looper::Messenger.

Referenced by os::Splash::Go(), os::Alert::Go(), os::IconDirectoryView::HandleMessage(), os::RegistrarManager::Launch(), and os::Splash::Quit().

void Window::MoveBy ( const Point cDelta)
Parameters
cDelta- The distance to move the window.
See Also
MoveTo(), ResizeBy(), ResizeTo(), SetFrame()
Author
Kurt Skauen (kurt@.nosp@m.athe.nosp@m.os.cx)

References os::Window::Private::m_pcTopView, and os::View::MoveBy().

void Window::MoveBy ( float  vDeltaX,
float  vDeltaY 
)
Parameters
nDeltaX- The horizontal distance to move the window.
nDeltaY- The vertical distance to move the window.
See Also
MoveTo(), ResizeBy(), ResizeTo(), SetFrame()
Author
Kurt Skauen (kurt@.nosp@m.athe.nosp@m.os.cx)

References os::Window::Private::m_pcTopView, and os::View::MoveBy().

void Window::MoveTo ( const Point cPos)
Description:
Move the window so the upper left corner of the client area is at the given position
Parameters
cPos- The new position
See Also
MoveBy(), ResizeBy(), ResizeTo(), SetFrame()
Author
Kurt Skauen (kurt@.nosp@m.athe.nosp@m.os.cx)

References os::Window::Private::m_pcTopView, and os::View::MoveTo().

Referenced by os::Alert::Alert(), CenterInScreen(), CenterInWindow(), and os::View::MouseMove().

void Window::MoveTo ( float  x,
float  y 
)
Description:
Move the window so the upper left corner of the client area is at the given position.
Parameters
x- The new horizontal position.
y- The new vertical position.
See Also
MoveBy(), ResizeBy(), ResizeTo(), SetFrame()
Author
Kurt Skauen (kurt@.nosp@m.athe.nosp@m.os.cx)

References os::Window::Private::m_pcTopView, and os::View::MoveTo().

void Window::RemoveChild ( View pcChild)
Description:
Unlink the view from the windows top-view and call the view's View::DetachedFromWindow() and View::AllDetached()
Parameters
pcChild- The view to remove.
See Also
AddChild(), View::RemoveChild()
Author
Kurt Skauen (kurt@.nosp@m.athe.nosp@m.os.cx)

References os::Window::Private::m_pcTopView, and os::View::RemoveChild().

Referenced by os::Bitmap::RemoveChild(), os::MenuWindow::ShutDown(), and os::MenuWindow::~MenuWindow().

void Window::RemoveShortcut ( const ShortcutKey cKey)
Description:
Remove a keyboard shortcut previously added by one of the AddShortcut() methods. Normally you should not need to use this method directly, menus and widgets will automatically unregister their shortcuts.
Parameters
cKey- The keyboard event that triggers the shortcut.
See Also
AddShortcut()
Author
Henrik Isaksson (henri.nosp@m.k@is.nosp@m.aksso.nosp@m.n.tk)

References os::ShortcutKey::IsValid(), os::Window::Private::m_cShortcuts, and SDF_DELETE.

Referenced by AddShortcut(), os::View::DetachedFromWindow(), os::View::SetShortcut(), and os::View::SetShortcutFromLabel().

void Window::ResizeBy ( const Point cDelta)
Parameters
cDelta- The distance to move the lower-right corner of the window.
See Also
ResizeTo(), MoveBy(), MoveTo(), SetFrame()
Author
Kurt Skauen (kurt@.nosp@m.athe.nosp@m.os.cx)

References os::Window::Private::m_pcTopView, and os::View::ResizeBy().

void Window::ResizeBy ( float  vDeltaW,
float  vDeltaH 
)
Parameters
nDeltaW- The horizontal distance to move the lower-right corner of the window.
nDeltaH- The vertical distance to move the lower-right corner of the window.
See Also
ResizeTo(), MoveBy(), MoveTo(), SetFrame()
Author
Kurt Skauen (kurt@.nosp@m.athe.nosp@m.os.cx)

References os::Window::Private::m_pcTopView, and os::View::ResizeBy().

void Window::ResizeTo ( const Point cSize)
void Window::ResizeTo ( float  w,
float  h 
)
Parameters
W- The new width of the windows client area.
W- The new heigth of the windows client area.
See Also
ResizeBy(), MoveBy(), MoveTo(), SetFrame()
Author
Kurt Skauen (kurt@.nosp@m.athe.nosp@m.os.cx)

References os::Window::Private::m_pcTopView, and os::View::ResizeTo().

void Window::ScreenModeChanged ( const IPoint cNewRes,
color_space  eColorSpace 
)
virtual
Description:
ScreenModeChanged( const IPoint & cNewRes, color_space eColorSpace ) will be called when the screenmode changes. This will also happen during a desktop change to the desktop displaying the window if both desktops use different screenmodes.
Parameters
cNewRes- New resolution.
eColorSpace- New colorspace.
Author
Kurt Skauen (kurt@.nosp@m.athe.nosp@m.os.cx)

Referenced by DispatchMessage().

void Window::SetAlignment ( const IPoint cSize = IPoint(1,1),
const IPoint cSizeOffset = IPoint(0,0),
const IPoint cPos = IPoint(1,1),
const IPoint cPosOffset = IPoint(0,0) 
)
void Window::SetDefaultButton ( View pcView)
Description:
Set the default button. The default button will receive KeyDown()/KeyUp() events generated by the <ENTER> key even when not having focus. Since the os::Button class will invoke itself when the <ENTER> key is hit, it will allow the user to activate the default button by simply hitting the <ENTER> key without making the button active first.
Parameters
pcView- Pointer to the View that should receive all events generated by the <ENTER> key. This will typically be an instance of the os::Button class.
See Also
GetDefaultButton(), os::Button, View::KeyUp(), View::KeyDown()
Author
Kurt Skauen (kurt@.nosp@m.athe.nosp@m.os.cx)

References os::Window::Private::m_pcDefaultButton.

Referenced by os::FileRequester::FileRequester(), and os::InputBox::InputBox().

void Window::SetDefaultWheelView ( View pcView)
void Window::SetFlags ( uint32  nFlags)
View * Window::SetFocusChild ( View pcView)
Description:
Give a view focus, or remove the focus from the current active view by passing in a NULL pointer. This has the same effect as calling pcView->MakeFocus(true).
Parameters
pcView- The View that should receive focus, or a NULL pointer to remove focus from the currently active view.
Returns
Pointer to the previously active view, or NULL if no view had focus.
See Also
View::MakeFocus()
Author
Kurt Skauen (kurt@.nosp@m.athe.nosp@m.os.cx)

References os::View::Activated(), FOCUS_STACK_SIZE, GetFocusChild(), os::Window::Private::m_apcFocusStack, and os::Looper::SetDefaultHandler().

Referenced by os::InputBox::InputBox(), and os::View::MakeFocus().

void Window::SetFrame ( const Rect cRect,
bool  bNotifyServer = true 
)
Description:
SetFrame() will set the windows client position and size on the current desktop.
Parameters
cRect- The new frame rectangle of the window's client area.
See Also
GetFrame(), GetBounds(), MoveBy(), MoveTo(), ResizeBy(), ResizeTo()
Author
Kurt Skauen (kurt@.nosp@m.athe.nosp@m.os.cx)

References Flush(), os::Window::Private::m_pcTopView, and os::View::SetFrame().

Referenced by DispatchMessage(), and os::FileRequester::FileRequester().

void Window::SetIcon ( Bitmap pcIcon)
Description:
SetIcon() will change the icon assigned to the window.
Note:
The Bitmap will be copied, so you can delete the bitmap afterwards,
Parameters
pcIconThe new window icon.
See Also
GetIcon(), SetTitle()
Author
Arno Klenke (arno_.nosp@m.klen.nosp@m.ke@ya.nosp@m.hoo..nosp@m.de)

References os::Message::AddInt32(), os::Window::Private::m_hLayerPort, and os::Looper::Messenger.

void Window::SetShapeRegion ( const Region cReg)
Description:
Note:
Warning:
Parameters
\return
Error codes:
Since
0.3.7
See Also
ClearShapeRegion(), os::View::SetShapeRegion()
Author
Kurt Skauen (kurt@.nosp@m.athe.nosp@m.os.cx)

References os::Window::Private::m_pcTopView, and os::View::SetShapeRegion().

void Window::SetSizeLimits ( const Point cMinSize,
const Point cMaxSize 
)
Description:
SetSizeLimits() sets the maximum and minimum size the window can be resized to by the user. The limits are not enforced by ResizeBy(), ResizeTo(), and SetFrame()
Note:
If you want to prevent the user from resizing the window at all it is normally better to set the WND_NOT_RESIZABLE flag in the constructor or with the SetFlags() member than to set the same size as minimum and maximum. Setting the WND_NOT_RESIZABLE flag will cause visual changes to notify the user that the window can not be resized.

Also think twice before making a window non-resizable it is normally better to make the window layout dynamic through the builtin layout engine.

Parameters
cMinSizeMinimum size in pixels.
cMaxSizeMaximum size in pixels.
See Also
SetFlags()
Author
Kurt Skauen (kurt@.nosp@m.athe.nosp@m.os.cx)

References os::Message::AddPoint(), Flush(), os::Window::Private::m_hLayerPort, and os::Looper::Messenger.

void Window::SetTitle ( const String cTitle)
void Window::Show ( bool  bMakeVisible = true)
Description:
 When a window is first constructed, it is not made visible on
 the screen. You must first call Show(true), The first time
 Show() is called it will also unlock the window, and start the
 looper thread if it is not done already by calling Start().

 You can nest calls to Show(false). It will then require the same
 numbers of Show(true) calls to make the window visible.
Note:
The Window visibility state is global across all desktops.
Parameters
bMakeVisible- Set to true to make the window visible, and false to hide it.
See Also
Start(), Window::Window()
Author
Kurt Skauen (kurt@.nosp@m.athe.nosp@m.os.cx)

References os::Window::Private::m_bIsRunning, os::Window::Private::m_pcTopView, os::Looper::Run(), and os::View::Show().

Referenced by os::Splash::Go(), os::Alert::Go(), os::ColorRequester::HandleMessage(), os::InputBox::HandleMessage(), os::IconDirectoryView::HandleMessage(), os::RegistrarManager::Launch(), MoveFileThread(), os::ColorRequester::OkToQuit(), os::InputBox::OkToQuit(), os::Menu::Open(), os::Splash::Quit(), os::FileRequester::Show(), os::ToolTip::ShowTip(), and os::Menu::Track().

void Window::Start ( void  )
Description:
If you whould like to unlock the window and start the looper thread without making the window visible, you can call Start() instead of Show(). This will invert the locking done by the contructor and make the looper run. It will also prevent Show() from doing the same when it is called later to make the window visible.
See Also
Show(), Window::Window()
Author
Kurt Skauen (kurt@.nosp@m.athe.nosp@m.os.cx)

References os::Window::Private::m_bIsRunning, os::Looper::Run(), and os::Looper::Unlock().

Referenced by os::View::SetToolTip().

void Window::Sync ( void  )
Description:
Sync() will like the Flush() member flush the render queue. The difference is that Sync() will wait for the appserver to finnish the rendering and send a reply informing that the rendering is done. This means that when Sync() returnes you have a guarante that all the previously issued rendering operations are indead executed.
Note:
Sync() is normally not used on normal windows, since it have a higher overhead than Flush(), and you normally dont need to wait for the appserver to finnish. It is only useful when the window is attached to a bitmap, and you want to assure that the rendering indead have taken place before you start using the bitmap.
See Also
Flush(), Bitmap::Sync(), Bitmap::Flush(), View::Sync(), View::Flush()
Author
Kurt Skauen (kurt@.nosp@m.athe.nosp@m.os.cx)

References os::Locker::Lock(), os::Window::Private::m_cRenderLock, os::Window::Private::m_hLayerPort, os::Window::Private::m_hReplyPort, os::Window::Private::m_nRndBufSize, os::Window::Private::m_psRenderPkt, and os::Locker::Unlock().

Referenced by os::Alert::Alert(), DispatchMessage(), os::View::RemoveChild(), os::Bitmap::Sync(), and os::View::Sync().

int Window::ToggleDepth ( void  )
void Window::WindowsChanged ( )
virtual
Description:
THIS METHOD WILL BE REMOVED IN ONE OF THE FUTURE SYLLABLE RELEASES. USE THE NEW EVENT INTERFACE INSTEAD.
Note:
This will only work if you have set the WND_SEND_WINDOWS_CHANGED flag.
Author
Kurt Skauen (kurt@.nosp@m.athe.nosp@m.os.cx)

Referenced by DispatchMessage().

Friends And Related Function Documentation

friend class Bitmap
friend
friend class MenuItem
friend
friend class ScreenOutput
friend
friend class View
friend