* Coding style cleanup.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26756 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2008-08-03 15:42:32 +00:00
parent 59e13a3f06
commit 3a83c7b181
2 changed files with 291 additions and 290 deletions
+171 -167
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright 2001-2005, Haiku. * Copyright 2001-2008, Haiku.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
* *
* Authors: * Authors:
@@ -7,28 +7,29 @@
* Stephan Aßmus <[email protected]> * Stephan Aßmus <[email protected]>
*/ */
/** Base class for window decorators */ /*! Base class for window decorators */
#include "Decorator.h" #include "Decorator.h"
#include "DrawingEngine.h"
#include <Region.h>
#include <stdio.h> #include <stdio.h>
#include <Region.h>
#include "DrawingEngine.h"
/*! \brief Constructor
Does general initialization of internal data members and creates a colorset
object.
/*!
\brief Constructor
\param rect Size of client area \param rect Size of client area
\param wlook style of window look. See Window.h \param wlook style of window look. See Window.h
\param wfeel style of window feel. See Window.h \param wfeel style of window feel. See Window.h
\param wflags various window flags. See Window.h \param wflags various window flags. See Window.h
Does general initialization of internal data members and creates a colorset
object.
*/ */
Decorator::Decorator(DesktopSettings& settings, BRect rect, Decorator::Decorator(DesktopSettings& settings, BRect rect, window_look look,
window_look look, uint32 flags) uint32 flags)
: :
fDrawingEngine(NULL), fDrawingEngine(NULL),
fDrawState(), fDrawState(),
@@ -63,8 +64,7 @@ Decorator::~Decorator()
} }
/*! /*! \brief Assigns a display driver to the decorator
\brief Assigns a display driver to the decorator
\param driver A valid DrawingEngine object \param driver A valid DrawingEngine object
*/ */
void void
@@ -73,24 +73,23 @@ Decorator::SetDrawingEngine(DrawingEngine* engine)
fDrawingEngine = engine; fDrawingEngine = engine;
// lots of subclasses will depend on the driver for text support, so call // lots of subclasses will depend on the driver for text support, so call
// _DoLayout() after we have it // _DoLayout() after we have it
if (fDrawingEngine) { if (fDrawingEngine)
_DoLayout(); _DoLayout();
}
} }
/*! /*! \brief Sets the decorator's window flags
\brief Sets the decorator's window flags
\param flags New value for the flags
While this call will not update the screen, it will affect how future While this call will not update the screen, it will affect how future
updates work and immediately affects input handling. updates work and immediately affects input handling.
\param flags New value for the flags
*/ */
void void
Decorator::SetFlags(uint32 flags, BRegion* updateRegion) Decorator::SetFlags(uint32 flags, BRegion* updateRegion)
{ {
// we're nice to our subclasses - we make sure B_NOT_{H|V|}_RESIZABLE are in sync // we're nice to our subclasses - we make sure B_NOT_{H|V|}_RESIZABLE
// (it's only a semantical simplification, not a necessity) // are in sync (it's only a semantical simplification, not a necessity)
if ((flags & (B_NOT_H_RESIZABLE | B_NOT_V_RESIZABLE)) if ((flags & (B_NOT_H_RESIZABLE | B_NOT_V_RESIZABLE))
== (B_NOT_H_RESIZABLE | B_NOT_V_RESIZABLE)) == (B_NOT_H_RESIZABLE | B_NOT_V_RESIZABLE))
flags |= B_NOT_RESIZABLE; flags |= B_NOT_RESIZABLE;
@@ -101,8 +100,7 @@ Decorator::SetFlags(uint32 flags, BRegion* updateRegion)
} }
/* /*! \brief Sets the decorator's font
\brief Sets the decorator's font
\param font The new font object to copy from \param font The new font object to copy from
*/ */
void void
@@ -113,8 +111,7 @@ Decorator::SetFont(ServerFont *font)
} }
/*! /*! \brief Sets the decorator's window look
\brief Sets the decorator's window look
\param look New value for the look \param look New value for the look
*/ */
void void
@@ -125,57 +122,56 @@ Decorator::SetLook(DesktopSettings& settings, window_look look,
} }
/*! /*! \brief Sets the close button's value.
\brief Sets the close button's value.
\param is_down Whether the button is down or not
Note that this does not update the button's look - it just updates the Note that this does not update the button's look - it just updates the
internal button value internal button value
\param is_down Whether the button is down or not
*/ */
void void
Decorator::SetClose(bool is_down) Decorator::SetClose(bool pressed)
{ {
if (is_down != fClosePressed) { if (pressed != fClosePressed) {
fClosePressed = is_down; fClosePressed = pressed;
DrawClose(); DrawClose();
} }
} }
/*! /*! \brief Sets the minimize button's value.
\brief Sets the minimize button's value.
\param is_down Whether the button is down or not
Note that this does not update the button's look - it just updates the Note that this does not update the button's look - it just updates the
internal button value internal button value
\param is_down Whether the button is down or not
*/ */
void void
Decorator::SetMinimize(bool is_down) Decorator::SetMinimize(bool pressed)
{ {
if (is_down != fMinimizePressed) { if (pressed != fMinimizePressed) {
fMinimizePressed = is_down; fMinimizePressed = pressed;
DrawMinimize(); DrawMinimize();
} }
} }
/*! /*! \brief Sets the zoom button's value.
\brief Sets the zoom button's value.
\param is_down Whether the button is down or not
Note that this does not update the button's look - it just updates the Note that this does not update the button's look - it just updates the
internal button value internal button value
\param is_down Whether the button is down or not
*/ */
void void
Decorator::SetZoom(bool is_down) Decorator::SetZoom(bool pressed)
{ {
if (is_down != fZoomPressed) { if (pressed != fZoomPressed) {
fZoomPressed = is_down; fZoomPressed = pressed;
DrawZoom(); DrawZoom();
} }
} }
/*! /*! \brief Updates the value of the decorator title
\brief Updates the value of the decorator title
\param string New title value \param string New title value
*/ */
void void
@@ -187,8 +183,7 @@ Decorator::SetTitle(const char* string, BRegion* updateRegion)
} }
/*! /*! \brief Returns the decorator's window look
\brief Returns the decorator's window look
\return the decorator's window look \return the decorator's window look
*/ */
window_look window_look
@@ -198,8 +193,7 @@ Decorator::Look() const
} }
/*! /*! \brief Returns the decorator's window flags
\brief Returns the decorator's window flags
\return the decorator's window flags \return the decorator's window flags
*/ */
uint32 uint32
@@ -209,8 +203,7 @@ Decorator::Flags() const
} }
/*! /*! \brief Returns the decorator's title
\brief Returns the decorator's title
\return the decorator's title \return the decorator's title
*/ */
const char* const char*
@@ -220,8 +213,7 @@ Decorator::Title() const
} }
/*! /*! \brief Returns the decorator's border rectangle
\brief Returns the decorator's border rectangle
\return the decorator's border rectangle \return the decorator's border rectangle
*/ */
BRect BRect
@@ -231,8 +223,7 @@ Decorator::BorderRect() const
} }
/*! /*! \brief Returns the decorator's tab rectangle
\brief Returns the decorator's tab rectangle
\return the decorator's tab rectangle \return the decorator's tab rectangle
*/ */
BRect BRect
@@ -241,8 +232,8 @@ Decorator::TabRect() const
return fTabRect; return fTabRect;
} }
/*!
\brief Returns the value of the close button /*! \brief Returns the value of the close button
\return true if down, false if up \return true if down, false if up
*/ */
bool bool
@@ -251,8 +242,8 @@ Decorator::GetClose()
return fClosePressed; return fClosePressed;
} }
/*!
\brief Returns the value of the minimize button /*! \brief Returns the value of the minimize button
\return true if down, false if up \return true if down, false if up
*/ */
bool bool
@@ -261,8 +252,8 @@ Decorator::GetMinimize()
return fMinimizePressed; return fMinimizePressed;
} }
/*!
\brief Returns the value of the zoom button /*! \brief Returns the value of the zoom button
\return true if down, false if up \return true if down, false if up
*/ */
bool bool
@@ -271,59 +262,61 @@ Decorator::GetZoom()
return fZoomPressed; return fZoomPressed;
} }
// GetSizeLimits
void void
Decorator::GetSizeLimits(int32* minWidth, int32* minHeight, Decorator::GetSizeLimits(int32* minWidth, int32* minHeight, int32* maxWidth,
int32* maxWidth, int32* maxHeight) const int32* maxHeight) const
{ {
} }
/*!
\brief Changes the focus value of the decorator /*! \brief Changes the focus value of the decorator
\param is_active True if active, false if not
While this call will not update the screen, it will affect how future While this call will not update the screen, it will affect how future
updates work. updates work.
\param active True if active, false if not
*/ */
void void
Decorator::SetFocus(bool is_active) Decorator::SetFocus(bool active)
{ {
fIsFocused = is_active; fIsFocused = active;
_SetFocus(); _SetFocus();
// TODO: maybe it would be cleaner to handle the redraw here. // TODO: maybe it would be cleaner to handle the redraw here.
} }
//-------------------------------------------------------------------------
// Virtual Methods
//-------------------------------------------------------------------------
/*! // #pragma mark - virtual methods
\brief Returns the "footprint" of the entire window, including decorator
\param region Region to be changed to represent the window's screen footprint
/*! \brief Returns the "footprint" of the entire window, including decorator
This function is required by all subclasses. This function is required by all subclasses.
\param region Region to be changed to represent the window's screen
footprint
*/ */
void void
Decorator::GetFootprint(BRegion *region) Decorator::GetFootprint(BRegion *region)
{ {
} }
/*!
\brief Performs hit-testing for the decorator
\return The type of area clicked
Clicked is called whenever it has been determined that the window has received a /*! \brief Performs hit-testing for the decorator
mouse click. The default version returns DEC_NONE. A subclass may use any or all
of them. Clicked is called whenever it has been determined that the window has
received a mouse click. The default version returns DEC_NONE. A subclass
may use any or all of them.
Click type : Action taken by the server Click type : Action taken by the server
- \c DEC_NONE : Do nothing - \c DEC_NONE : Do nothing
- \c DEC_ZOOM : Handles the zoom button (setting states, etc) - \c DEC_ZOOM : Handles the zoom button (setting states, etc)
- \c DEC_CLOSE : Handles the close button (setting states, etc) - \c DEC_CLOSE : Handles the close button (setting states, etc)
- \c DEC_MINIMIZE : Handles the minimize button (setting states, etc) - \c DEC_MINIMIZE : Handles the minimize button (setting states, etc)
- \c DEC_TAB : Currently unused - \c DEC_TAB : Currently unused
- \c DEC_DRAG : Moves the window to the front and prepares to move the window - \c DEC_DRAG : Moves the window to the front and prepares to move the
window
- \c DEC_MOVETOBACK : Moves the window to the back of the stack - \c DEC_MOVETOBACK : Moves the window to the back of the stack
- \c DEC_MOVETOFRONT : Moves the window to the front of the stack - \c DEC_MOVETOFRONT : Moves the window to the front of the stack
- \c DEC_SLIDETAB : Initiates tab-sliding - \c DEC_SLIDETAB : Initiates tab-sliding
@@ -339,22 +332,24 @@ Decorator::GetFootprint(BRegion *region)
- \c DEC_RESIZE_RB - \c DEC_RESIZE_RB
This function is required by all subclasses. This function is required by all subclasses.
\return The type of area clicked
*/ */
click_type click_type
Decorator::Clicked(BPoint pt, int32 buttons, int32 modifiers) Decorator::Clicked(BPoint point, int32 buttons, int32 modifiers)
{ {
return DEC_NONE; return DEC_NONE;
} }
/*!
\brief Moves the decorator frame and all default rectangles /*! \brief Moves the decorator frame and all default rectangles
\param x X Offset
\param y y Offset
If a subclass implements this method, be sure to call Decorator::MoveBy If a subclass implements this method, be sure to call Decorator::MoveBy
to ensure that internal members are also updated. All members of the Decorator to ensure that internal members are also updated. All members of the
class are automatically moved in this method Decorator class are automatically moved in this method
\param x X Offset
\param y y Offset
*/ */
void void
Decorator::MoveBy(float x, float y) Decorator::MoveBy(float x, float y)
@@ -362,36 +357,38 @@ Decorator::MoveBy(float x, float y)
MoveBy(BPoint(x, y)); MoveBy(BPoint(x, y));
} }
/*!
\brief Moves the decorator frame and all default rectangles /*! \brief Moves the decorator frame and all default rectangles
\param pt Point containing the offsets
If a subclass implements this method, be sure to call Decorator::MoveBy If a subclass implements this method, be sure to call Decorator::MoveBy
to ensure that internal members are also updated. All members of the Decorator to ensure that internal members are also updated. All members of the
class are automatically moved in this method Decorator class are automatically moved in this method
\param offset BPoint containing the offsets
*/ */
void void
Decorator::MoveBy(BPoint pt) Decorator::MoveBy(BPoint offset)
{ {
fZoomRect.OffsetBy(pt); fZoomRect.OffsetBy(offset);
fCloseRect.OffsetBy(pt); fCloseRect.OffsetBy(offset);
fMinimizeRect.OffsetBy(pt); fMinimizeRect.OffsetBy(offset);
fMinimizeRect.OffsetBy(pt); fMinimizeRect.OffsetBy(offset);
fTabRect.OffsetBy(pt); fTabRect.OffsetBy(offset);
fFrame.OffsetBy(pt); fFrame.OffsetBy(offset);
fResizeRect.OffsetBy(pt); fResizeRect.OffsetBy(offset);
fBorderRect.OffsetBy(pt); fBorderRect.OffsetBy(offset);
} }
/*!
\brief Resizes the decorator frame /*! \brief Resizes the decorator frame
\param dx x offset
\param dy y offset
This is a required function for subclasses to implement - the default does nothing. This is a required function for subclasses to implement - the default does
Note that window resize flags should be followed and fFrame should be resized nothing. Note that window resize flags should be followed and fFrame should
accordingly. It would also be a wise idea to ensure that the window's rectangles be resized accordingly. It would also be a wise idea to ensure that the
are not inverted. window's rectangles are not inverted.
\param x x offset
\param y y offset
*/ */
void void
Decorator::ResizeBy(float x, float y, BRegion* dirty) Decorator::ResizeBy(float x, float y, BRegion* dirty)
@@ -414,19 +411,20 @@ Decorator::GetSettings(BMessage* settings) const
} }
/*! /*! \brief Updates the decorator's look in the area \a rect
\brief Updates the decorator's look in the area r
\param r The area to update.
The default version updates all areas which intersect the frame and tab. The default version updates all areas which intersect the frame and tab.
\param rect The area to update.
*/ */
void void
Decorator::Draw(BRect r) Decorator::Draw(BRect rect)
{ {
_DrawFrame(r & fFrame); _DrawFrame(rect & fFrame);
_DrawTab(r & fTabRect); _DrawTab(rect & fTabRect);
} }
//! Forces a complete decorator update //! Forces a complete decorator update
void void
Decorator::Draw() Decorator::Draw()
@@ -435,6 +433,7 @@ Decorator::Draw()
_DrawTab(fTabRect); _DrawTab(fTabRect);
} }
//! Draws the close button //! Draws the close button
void void
Decorator::DrawClose() Decorator::DrawClose()
@@ -442,6 +441,7 @@ Decorator::DrawClose()
_DrawClose(fCloseRect); _DrawClose(fCloseRect);
} }
//! draws the frame //! draws the frame
void void
Decorator::DrawFrame() Decorator::DrawFrame()
@@ -449,13 +449,15 @@ Decorator::DrawFrame()
_DrawFrame(fFrame); _DrawFrame(fFrame);
} }
//! draws the minimize button //! draws the minimize button
void void
Decorator::DrawMinimize(void) Decorator::DrawMinimize()
{ {
_DrawTab(fMinimizeRect); _DrawTab(fMinimizeRect);
} }
//! draws the tab, title, and buttons //! draws the tab, title, and buttons
void void
Decorator::DrawTab() Decorator::DrawTab()
@@ -467,16 +469,18 @@ Decorator::DrawTab()
_DrawClose(fCloseRect); _DrawClose(fCloseRect);
} }
// draws the title
//! draws the title
void void
Decorator::DrawTitle() Decorator::DrawTitle()
{ {
_DrawTitle(fTabRect); _DrawTitle(fTabRect);
} }
//! draws the zoom button //! draws the zoom button
void void
Decorator::DrawZoom(void) Decorator::DrawZoom()
{ {
_DrawZoom(fZoomRect); _DrawZoom(fZoomRect);
} }
@@ -491,89 +495,89 @@ Decorator::UIColor(color_which which)
} }
/*!
\brief Provides the number of characters that will fit in the given width
\param width Maximum number of pixels the title can be
\return the number of characters that will fit in the given width
*/
//! Function for calculating layout for the decorator //! Function for calculating layout for the decorator
void void
Decorator::_DoLayout() Decorator::_DoLayout()
{ {
} }
/*!
\brief Actually draws the frame /*! \brief Actually draws the frame
\param r Area of the frame to update \param rect Area of the frame to update
*/ */
void void
Decorator::_DrawFrame(BRect r) Decorator::_DrawFrame(BRect rect)
{ {
} }
/*!
\brief Actually draws the tab /*! \brief Actually draws the tab
\param r Area of the tab to update
This function is called when the tab itself needs drawn. Other items, like the This function is called when the tab itself needs drawn. Other items,
window title or buttons, should not be drawn here. like the window title or buttons, should not be drawn here.
\param rect Area of the tab to update
*/ */
void void
Decorator::_DrawTab(BRect r) Decorator::_DrawTab(BRect rect)
{ {
} }
/*!
\brief Actually draws the close button /*! \brief Actually draws the close button
\param r Area of the button to update
Unless a subclass has a particularly large button, it is probably
Unless a subclass has a particularly large button, it is probably unnecessary unnecessary to check the update rectangle.
to check the update rectangle.
\param rect Area of the button to update
*/ */
void void
Decorator::_DrawClose(BRect r) Decorator::_DrawClose(BRect rect)
{ {
} }
/*!
\brief Actually draws the title /*! \brief Actually draws the title
\param r area of the title to update
The main tasks for this function are to ensure that the decorator draws
The main tasks for this function are to ensure that the decorator draws the title the title only in its own area and drawing the title itself.
only in its own area and drawing the title itself. Using B_OP_COPY for drawing Using B_OP_COPY for drawing the title is recommended because of the marked
the title is recommended because of the marked performance hit of the other performance hit of the other drawing modes, but it is not a requirement.
drawing modes, but it is not a requirement.
\param rect area of the title to update
*/ */
void void
Decorator::_DrawTitle(BRect r) Decorator::_DrawTitle(BRect rect)
{ {
} }
/*!
\brief Actually draws the zoom button /*! \brief Actually draws the zoom button
\param r Area of the button to update
Unless a subclass has a particularly large button, it is probably unnecessary Unless a subclass has a particularly large button, it is probably
to check the update rectangle. unnecessary to check the update rectangle.
\param rect Area of the button to update
*/ */
void void
Decorator::_DrawZoom(BRect r) Decorator::_DrawZoom(BRect rect)
{ {
} }
/*! /*!
\brief Actually draws the minimize button \brief Actually draws the minimize button
\param r Area of the button to update
Unless a subclass has a particularly large button, it is probably unnecessary Unless a subclass has a particularly large button, it is probably
to check the update rectangle. unnecessary to check the update rectangle.
\param rect Area of the button to update
*/ */
void void
Decorator::_DrawMinimize(BRect r) Decorator::_DrawMinimize(BRect rect)
{ {
} }
//! Hook function called when the decorator changes focus //! Hook function called when the decorator changes focus
void void
Decorator::_SetFocus() Decorator::_SetFocus()
+120 -123
View File
@@ -1,13 +1,13 @@
/* /*
* Copyright 2001-2005, Haiku. * Copyright 2001-2008, Haiku.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
* *
* Authors: * Authors:
* DarkWyrm <[email protected]> * DarkWyrm <[email protected]>
* Stephan Aßmus <[email protected]> * Stephan Aßmus <[email protected]>
*/ */
#ifndef _DECORATOR_H_ #ifndef DECORATOR_H
#define _DECORATOR_H_ #define DECORATOR_H
#include <Rect.h> #include <Rect.h>
@@ -23,7 +23,7 @@ class ServerFont;
class BRegion; class BRegion;
typedef enum { enum click_type {
DEC_NONE = 0, DEC_NONE = 0,
DEC_ZOOM, DEC_ZOOM,
DEC_CLOSE, DEC_CLOSE,
@@ -42,125 +42,122 @@ typedef enum {
CLICK_RESIZE_RT, CLICK_RESIZE_RT,
CLICK_RESIZE_LB, CLICK_RESIZE_LB,
CLICK_RESIZE_RB CLICK_RESIZE_RB
} click_type;
class Decorator {
public:
Decorator(DesktopSettings& settings, BRect rect,
window_look look, uint32 flags);
virtual ~Decorator();
void SetDrawingEngine(DrawingEngine *driver);
inline DrawingEngine* GetDrawingEngine() const
{ return fDrawingEngine; }
void SetFont(ServerFont *font);
virtual void SetLook(DesktopSettings& settings,
window_look look, BRegion* updateRegion = NULL);
virtual void SetFlags(uint32 flags, BRegion* updateRegion = NULL);
void SetClose(bool pressed);
void SetMinimize(bool pressed);
void SetZoom(bool pressed);
virtual void SetTitle(const char* string, BRegion* updateRegion = NULL);
window_look Look() const;
uint32 Flags() const;
const char* Title() const;
// we need to know its border(frame). WinBorder's fFrame rect
// must expand to include Decorator borders. Otherwise we can't
// draw the border. We also add TabRect because I feel we'll need it
BRect BorderRect() const;
BRect TabRect() const;
bool GetClose();
bool GetMinimize();
bool GetZoom();
virtual void GetSizeLimits(int32* minWidth, int32* minHeight,
int32* maxWidth, int32* maxHeight) const;
void SetFocus(bool focussed);
bool IsFocus()
{ return fIsFocused; };
virtual void GetFootprint(BRegion *region);
virtual click_type Clicked(BPoint pt, int32 buttons,
int32 modifiers);
void MoveBy(float x, float y);
virtual void MoveBy(BPoint pt);
void ResizeBy(float x, float y, BRegion* dirty);
virtual void ResizeBy(BPoint pt, BRegion* dirty) = 0;
/*! \return true if tab location updated, false if out of bounds or unsupported */
virtual bool SetTabLocation(float location, BRegion* updateRegion = NULL)
{ (void)updateRegion; return false; }
virtual float TabLocation() const
{ return 0.0; }
virtual bool SetSettings(const BMessage& settings,
BRegion* updateRegion = NULL);
virtual bool GetSettings(BMessage* settings) const;
virtual void Draw(BRect r);
virtual void Draw();
virtual void DrawClose();
virtual void DrawFrame();
virtual void DrawMinimize();
virtual void DrawTab();
virtual void DrawTitle();
virtual void DrawZoom();
rgb_color UIColor(color_which which);
protected:
int32 _TitleWidth() const
{ return fTitle.CountChars(); }
virtual void _DoLayout();
virtual void _DrawFrame(BRect r);
virtual void _DrawTab(BRect r);
virtual void _DrawClose(BRect r);
virtual void _DrawTitle(BRect r);
virtual void _DrawZoom(BRect r);
virtual void _DrawMinimize(BRect r);
virtual void _SetFocus();
DrawingEngine* fDrawingEngine;
DrawState fDrawState;
window_look fLook;
uint32 fFlags;
BRect fZoomRect;
BRect fCloseRect;
BRect fMinimizeRect;
BRect fTabRect;
BRect fFrame;
BRect fResizeRect;
BRect fBorderRect;
private:
bool fClosePressed : 1;
bool fZoomPressed : 1;
bool fMinimizePressed : 1;
bool fIsFocused : 1;
BString fTitle;
}; };
// add-on stuff class Decorator {
//typedef float get_version(void); public:
//typedef Decorator* create_decorator(DesktopSettings& desktopSettings, BRect rect, Decorator(DesktopSettings& settings, BRect rect,
// window_look look, uint32 flags); window_look look, uint32 flags);
virtual ~Decorator();
#endif /* _DECORATOR_H_ */ void SetDrawingEngine(DrawingEngine *driver);
inline DrawingEngine* GetDrawingEngine() const
{ return fDrawingEngine; }
void SetFont(ServerFont *font);
virtual void SetLook(DesktopSettings& settings, window_look look,
BRegion* updateRegion = NULL);
virtual void SetFlags(uint32 flags,
BRegion* updateRegion = NULL);
void SetClose(bool pressed);
void SetMinimize(bool pressed);
void SetZoom(bool pressed);
virtual void SetTitle(const char* string,
BRegion* updateRegion = NULL);
window_look Look() const;
uint32 Flags() const;
const char* Title() const;
BRect BorderRect() const;
BRect TabRect() const;
bool GetClose();
bool GetMinimize();
bool GetZoom();
virtual void GetSizeLimits(int32* minWidth, int32* minHeight,
int32* maxWidth, int32* maxHeight) const;
void SetFocus(bool focussed);
bool IsFocus()
{ return fIsFocused; };
virtual void GetFootprint(BRegion *region);
virtual click_type Clicked(BPoint where, int32 buttons,
int32 modifiers);
void MoveBy(float x, float y);
virtual void MoveBy(BPoint offset);
void ResizeBy(float x, float y, BRegion* dirty);
virtual void ResizeBy(BPoint offset, BRegion* dirty) = 0;
/*! \return true if tab location updated, false if out of bounds
or unsupported
*/
virtual bool SetTabLocation(float location,
BRegion* /*updateRegion*/ = NULL)
{ return false; }
virtual float TabLocation() const
{ return 0.0; }
virtual bool SetSettings(const BMessage& settings,
BRegion* updateRegion = NULL);
virtual bool GetSettings(BMessage* settings) const;
virtual void Draw(BRect rect);
virtual void Draw();
virtual void DrawClose();
virtual void DrawFrame();
virtual void DrawMinimize();
virtual void DrawTab();
virtual void DrawTitle();
virtual void DrawZoom();
rgb_color UIColor(color_which which);
protected:
int32 _TitleWidth() const
{ return fTitle.CountChars(); }
virtual void _DoLayout();
virtual void _DrawFrame(BRect rect);
virtual void _DrawTab(BRect rect);
virtual void _DrawClose(BRect rect);
virtual void _DrawTitle(BRect rect);
virtual void _DrawZoom(BRect rect);
virtual void _DrawMinimize(BRect rect);
virtual void _SetFocus();
DrawingEngine* fDrawingEngine;
DrawState fDrawState;
window_look fLook;
uint32 fFlags;
BRect fZoomRect;
BRect fCloseRect;
BRect fMinimizeRect;
BRect fTabRect;
BRect fFrame;
BRect fResizeRect;
BRect fBorderRect;
private:
bool fClosePressed : 1;
bool fZoomPressed : 1;
bool fMinimizePressed : 1;
bool fIsFocused : 1;
BString fTitle;
};
#endif // DECORATOR_H