* 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:
parent
9a3090b0ed
commit
614de12d9c
@ -57,13 +57,13 @@ class Decorator {
|
||||
void SetFeel(int32 wfeel);
|
||||
void SetFont(ServerFont *font);
|
||||
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 GetFeel() const;
|
||||
int32 GetFlags() const;
|
||||
|
@ -190,18 +190,20 @@ Decorator::SetZoom(bool is_down)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
\brief Updates the value of the decorator title
|
||||
\param string New title value
|
||||
*/
|
||||
void
|
||||
Decorator::SetTitle(const char *string)
|
||||
Decorator::SetTitle(const char* string, BRegion* updateRegion)
|
||||
{
|
||||
fTitle.SetTo(string);
|
||||
_DoLayout();
|
||||
// TODO: redraw?
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
\brief Returns 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));
|
||||
}
|
||||
|
||||
DefaultDecorator::~DefaultDecorator(void)
|
||||
|
||||
DefaultDecorator::~DefaultDecorator()
|
||||
{
|
||||
STRACE(("DefaultDecorator: ~DefaultDecorator()\n"));
|
||||
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
|
||||
DefaultDecorator::MoveBy(float x, float y)
|
||||
{
|
||||
MoveBy(BPoint(x,y));
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
DefaultDecorator::MoveBy(BPoint pt)
|
||||
{
|
||||
|
@ -22,6 +22,8 @@ public:
|
||||
int32 look, int32 feel, int32 flags);
|
||||
virtual ~DefaultDecorator();
|
||||
|
||||
virtual void SetTitle(const char* string, BRegion* updateRegion = NULL);
|
||||
|
||||
virtual void MoveBy(float x, float y);
|
||||
virtual void MoveBy(BPoint pt);
|
||||
virtual void ResizeBy(float x, float y);
|
||||
|
@ -289,20 +289,14 @@ WinBorder::SetName(const char* name)
|
||||
// and redraw it.
|
||||
|
||||
if (fDecorator) {
|
||||
// before the change
|
||||
BRegion invalid(fDecorator->GetTabRect());
|
||||
BRegion updateRegion;
|
||||
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;
|
||||
GetRootLayer()->MarkForRebuild(invalid);
|
||||
GetRootLayer()->MarkForRebuild(updateRegion);
|
||||
GetRootLayer()->TriggerRebuild();
|
||||
|
||||
GetRootLayer()->MarkForRedraw(invalid);
|
||||
GetRootLayer()->MarkForRedraw(updateRegion);
|
||||
GetRootLayer()->TriggerRedraw();
|
||||
}
|
||||
}
|
||||
@ -443,7 +437,7 @@ WinBorder::MouseDown(const BMessage *msg)
|
||||
action = DEC_DRAG;
|
||||
|
||||
// set decorator internals
|
||||
switch(action) {
|
||||
switch (action) {
|
||||
case DEC_CLOSE:
|
||||
fIsClosing = true;
|
||||
fDecorator->SetClose(true);
|
||||
|
Loading…
Reference in New Issue
Block a user