* the decorator knows best which region to update when changing the title, so
it must now fill the updateRegion parameter of SetTitle(). * WinBorder::SetName() is now greatly simplified and achieves better results due to that. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14923 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -57,13 +57,13 @@ class Decorator {
|
|||||||
void SetFeel(int32 wfeel);
|
void SetFeel(int32 wfeel);
|
||||||
void SetFont(ServerFont *font);
|
void SetFont(ServerFont *font);
|
||||||
void SetLook(int32 wlook);
|
void SetLook(int32 wlook);
|
||||||
|
|
||||||
void SetClose(bool is_down);
|
|
||||||
void SetMinimize(bool is_down);
|
|
||||||
void SetZoom(bool is_down);
|
|
||||||
|
|
||||||
virtual void SetTitle(const char *string);
|
void SetClose(bool pressed);
|
||||||
|
void SetMinimize(bool pressed);
|
||||||
|
void SetZoom(bool pressed);
|
||||||
|
|
||||||
|
virtual void SetTitle(const char* string, BRegion* updateRegion = NULL);
|
||||||
|
|
||||||
int32 GetLook() const;
|
int32 GetLook() const;
|
||||||
int32 GetFeel() const;
|
int32 GetFeel() const;
|
||||||
int32 GetFlags() const;
|
int32 GetFlags() const;
|
||||||
|
|||||||
@@ -190,18 +190,20 @@ Decorator::SetZoom(bool is_down)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\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
|
||||||
Decorator::SetTitle(const char *string)
|
Decorator::SetTitle(const char* string, BRegion* updateRegion)
|
||||||
{
|
{
|
||||||
fTitle.SetTo(string);
|
fTitle.SetTo(string);
|
||||||
_DoLayout();
|
_DoLayout();
|
||||||
// TODO: redraw?
|
// TODO: redraw?
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\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
|
||||||
|
|||||||
@@ -72,18 +72,44 @@ DefaultDecorator::DefaultDecorator(DesktopSettings& settings, BRect rect,
|
|||||||
rect.left, rect.top, rect.right, rect.bottom));
|
rect.left, rect.top, rect.right, rect.bottom));
|
||||||
}
|
}
|
||||||
|
|
||||||
DefaultDecorator::~DefaultDecorator(void)
|
|
||||||
|
DefaultDecorator::~DefaultDecorator()
|
||||||
{
|
{
|
||||||
STRACE(("DefaultDecorator: ~DefaultDecorator()\n"));
|
STRACE(("DefaultDecorator: ~DefaultDecorator()\n"));
|
||||||
delete [] fFrameColors;
|
delete [] fFrameColors;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
DefaultDecorator::SetTitle(const char* string, BRegion* updateRegion)
|
||||||
|
{
|
||||||
|
BRect rect = GetTabRect();
|
||||||
|
|
||||||
|
Decorator::SetTitle(string);
|
||||||
|
|
||||||
|
if (updateRegion == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
BRect updatedRect = GetTabRect();
|
||||||
|
if (rect.left > updatedRect.left)
|
||||||
|
rect.left = updatedRect.left;
|
||||||
|
if (rect.right < updatedRect.right)
|
||||||
|
rect.right = updatedRect.right;
|
||||||
|
|
||||||
|
rect.bottom++;
|
||||||
|
// the border will look differently when the title is adjacent
|
||||||
|
|
||||||
|
updateRegion->Set(rect);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
DefaultDecorator::MoveBy(float x, float y)
|
DefaultDecorator::MoveBy(float x, float y)
|
||||||
{
|
{
|
||||||
MoveBy(BPoint(x,y));
|
MoveBy(BPoint(x,y));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
DefaultDecorator::MoveBy(BPoint pt)
|
DefaultDecorator::MoveBy(BPoint pt)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -22,6 +22,8 @@ public:
|
|||||||
int32 look, int32 feel, int32 flags);
|
int32 look, int32 feel, int32 flags);
|
||||||
virtual ~DefaultDecorator();
|
virtual ~DefaultDecorator();
|
||||||
|
|
||||||
|
virtual void SetTitle(const char* string, BRegion* updateRegion = NULL);
|
||||||
|
|
||||||
virtual void MoveBy(float x, float y);
|
virtual void MoveBy(float x, float y);
|
||||||
virtual void MoveBy(BPoint pt);
|
virtual void MoveBy(BPoint pt);
|
||||||
virtual void ResizeBy(float x, float y);
|
virtual void ResizeBy(float x, float y);
|
||||||
|
|||||||
@@ -289,20 +289,14 @@ WinBorder::SetName(const char* name)
|
|||||||
// and redraw it.
|
// and redraw it.
|
||||||
|
|
||||||
if (fDecorator) {
|
if (fDecorator) {
|
||||||
// before the change
|
BRegion updateRegion;
|
||||||
BRegion invalid(fDecorator->GetTabRect());
|
fDecorator->SetTitle(name, &updateRegion);
|
||||||
|
|
||||||
fDecorator->SetTitle(name);
|
|
||||||
|
|
||||||
// after the change
|
|
||||||
invalid.Include(fDecorator->GetTabRect());
|
|
||||||
|
|
||||||
// TODO: still doesn't look good (visually), but at least it works
|
|
||||||
fRebuildDecRegion = true;
|
fRebuildDecRegion = true;
|
||||||
GetRootLayer()->MarkForRebuild(invalid);
|
GetRootLayer()->MarkForRebuild(updateRegion);
|
||||||
GetRootLayer()->TriggerRebuild();
|
GetRootLayer()->TriggerRebuild();
|
||||||
|
|
||||||
GetRootLayer()->MarkForRedraw(invalid);
|
GetRootLayer()->MarkForRedraw(updateRegion);
|
||||||
GetRootLayer()->TriggerRedraw();
|
GetRootLayer()->TriggerRedraw();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -443,7 +437,7 @@ WinBorder::MouseDown(const BMessage *msg)
|
|||||||
action = DEC_DRAG;
|
action = DEC_DRAG;
|
||||||
|
|
||||||
// set decorator internals
|
// set decorator internals
|
||||||
switch(action) {
|
switch (action) {
|
||||||
case DEC_CLOSE:
|
case DEC_CLOSE:
|
||||||
fIsClosing = true;
|
fIsClosing = true;
|
||||||
fDecorator->SetClose(true);
|
fDecorator->SetClose(true);
|
||||||
|
|||||||
Reference in New Issue
Block a user