Icon-O-Matic: Fix window resizing bug
Previously, the window could not go any smaller than the current size after some changes were made to the icon such as adding a style. Fixes #4711 Also cleans up some code style. Change-Id: I4e7af98ac8afbea28a46d81b9de7aba6fc6c894a Reviewed-on: https://review.haiku-os.org/c/haiku/+/6836 Reviewed-by: Adrien Destugues <[email protected]> Reviewed-by: humdinger humdinger <[email protected]> Tested-by: Commit checker robot <[email protected]>
This commit is contained in:
@@ -1,9 +1,10 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2006-2007, Haiku.
|
* Copyright 2006-2007, 2023, Haiku.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
*
|
||||||
* Authors:
|
* Authors:
|
||||||
* Stephan Aßmus <[email protected]>
|
* Stephan Aßmus <[email protected]>
|
||||||
|
* Zardshard
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "StateView.h"
|
#include "StateView.h"
|
||||||
@@ -95,12 +96,15 @@ if (dynamic_cast<GradientControl*>(*target))
|
|||||||
StateView* fTarget;
|
StateView* fTarget;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// #pragma mark -
|
// #pragma mark -
|
||||||
|
|
||||||
// constructor
|
|
||||||
StateView::StateView(BRect frame, const char* name,
|
StateView::StateView(BRect frame, const char* name,
|
||||||
uint32 resizingMode, uint32 flags)
|
uint32 resizingMode, uint32 flags)
|
||||||
: BView(frame, name, resizingMode, flags),
|
: BView(frame, name, resizingMode, flags),
|
||||||
|
fStartingRect(frame),
|
||||||
|
|
||||||
fCurrentState(NULL),
|
fCurrentState(NULL),
|
||||||
fDropAnticipatingState(NULL),
|
fDropAnticipatingState(NULL),
|
||||||
|
|
||||||
@@ -117,15 +121,16 @@ StateView::StateView(BRect frame, const char* name,
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
// destructor
|
|
||||||
StateView::~StateView()
|
StateView::~StateView()
|
||||||
{
|
{
|
||||||
delete fEventFilter;
|
delete fEventFilter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// #pragma mark -
|
// #pragma mark -
|
||||||
|
|
||||||
// AttachedToWindow
|
|
||||||
void
|
void
|
||||||
StateView::AttachedToWindow()
|
StateView::AttachedToWindow()
|
||||||
{
|
{
|
||||||
@@ -134,7 +139,7 @@ StateView::AttachedToWindow()
|
|||||||
BView::AttachedToWindow();
|
BView::AttachedToWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
// DetachedFromWindow
|
|
||||||
void
|
void
|
||||||
StateView::DetachedFromWindow()
|
StateView::DetachedFromWindow()
|
||||||
{
|
{
|
||||||
@@ -143,14 +148,14 @@ StateView::DetachedFromWindow()
|
|||||||
BView::DetachedFromWindow();
|
BView::DetachedFromWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw
|
|
||||||
void
|
void
|
||||||
StateView::Draw(BRect updateRect)
|
StateView::Draw(BRect updateRect)
|
||||||
{
|
{
|
||||||
Draw(this, updateRect);
|
Draw(this, updateRect);
|
||||||
}
|
}
|
||||||
|
|
||||||
// MessageReceived
|
|
||||||
void
|
void
|
||||||
StateView::MessageReceived(BMessage* message)
|
StateView::MessageReceived(BMessage* message)
|
||||||
{
|
{
|
||||||
@@ -183,9 +188,10 @@ StateView::MessageReceived(BMessage* message)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// #pragma mark -
|
// #pragma mark -
|
||||||
|
|
||||||
// MouseDown
|
|
||||||
void
|
void
|
||||||
StateView::MouseDown(BPoint where)
|
StateView::MouseDown(BPoint where)
|
||||||
{
|
{
|
||||||
@@ -212,7 +218,7 @@ StateView::MouseDown(BPoint where)
|
|||||||
fLocker->WriteUnlock();
|
fLocker->WriteUnlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
// MouseMoved
|
|
||||||
void
|
void
|
||||||
StateView::MouseMoved(BPoint where, uint32 transit, const BMessage* dragMessage)
|
StateView::MouseMoved(BPoint where, uint32 transit, const BMessage* dragMessage)
|
||||||
{
|
{
|
||||||
@@ -250,7 +256,7 @@ StateView::MouseMoved(BPoint where, uint32 transit, const BMessage* dragMessage)
|
|||||||
fLocker->WriteUnlock();
|
fLocker->WriteUnlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
// MouseUp
|
|
||||||
void
|
void
|
||||||
StateView::MouseUp(BPoint where)
|
StateView::MouseUp(BPoint where)
|
||||||
{
|
{
|
||||||
@@ -280,9 +286,10 @@ StateView::MouseUp(BPoint where)
|
|||||||
fLocker->WriteUnlock();
|
fLocker->WriteUnlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// #pragma mark -
|
// #pragma mark -
|
||||||
|
|
||||||
// KeyDown
|
|
||||||
void
|
void
|
||||||
StateView::KeyDown(const char* bytes, int32 numBytes)
|
StateView::KeyDown(const char* bytes, int32 numBytes)
|
||||||
{
|
{
|
||||||
@@ -298,7 +305,7 @@ StateView::KeyDown(const char* bytes, int32 numBytes)
|
|||||||
BView::KeyDown(bytes, numBytes);
|
BView::KeyDown(bytes, numBytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
// KeyUp
|
|
||||||
void
|
void
|
||||||
StateView::KeyUp(const char* bytes, int32 numBytes)
|
StateView::KeyUp(const char* bytes, int32 numBytes)
|
||||||
{
|
{
|
||||||
@@ -327,7 +334,21 @@ StateView::Perform(perform_code code, void* data)
|
|||||||
|
|
||||||
// #pragma mark -
|
// #pragma mark -
|
||||||
|
|
||||||
// SetState
|
|
||||||
|
void
|
||||||
|
StateView::GetPreferredSize(float* width, float* height)
|
||||||
|
{
|
||||||
|
if (width != NULL)
|
||||||
|
*width = fStartingRect.Width();
|
||||||
|
|
||||||
|
if (height != NULL)
|
||||||
|
*height = fStartingRect.Height();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
StateView::SetState(ViewState* state)
|
StateView::SetState(ViewState* state)
|
||||||
{
|
{
|
||||||
@@ -344,7 +365,7 @@ StateView::SetState(ViewState* state)
|
|||||||
fCurrentState->Init();
|
fCurrentState->Init();
|
||||||
}
|
}
|
||||||
|
|
||||||
// UpdateStateCursor
|
|
||||||
void
|
void
|
||||||
StateView::UpdateStateCursor()
|
StateView::UpdateStateCursor()
|
||||||
{
|
{
|
||||||
@@ -353,7 +374,7 @@ StateView::UpdateStateCursor()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw
|
|
||||||
void
|
void
|
||||||
StateView::Draw(BView* into, BRect updateRect)
|
StateView::Draw(BView* into, BRect updateRect)
|
||||||
{
|
{
|
||||||
@@ -371,14 +392,14 @@ StateView::Draw(BView* into, BRect updateRect)
|
|||||||
fLocker->ReadUnlock();
|
fLocker->ReadUnlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
// MouseWheelChanged
|
|
||||||
bool
|
bool
|
||||||
StateView::MouseWheelChanged(BPoint where, float x, float y)
|
StateView::MouseWheelChanged(BPoint where, float x, float y)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// HandleKeyDown
|
|
||||||
bool
|
bool
|
||||||
StateView::HandleKeyDown(uint32 key, uint32 modifiers)
|
StateView::HandleKeyDown(uint32 key, uint32 modifiers)
|
||||||
{
|
{
|
||||||
@@ -404,7 +425,7 @@ StateView::HandleKeyDown(uint32 key, uint32 modifiers)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// HandleKeyUp
|
|
||||||
bool
|
bool
|
||||||
StateView::HandleKeyUp(uint32 key, uint32 modifiers)
|
StateView::HandleKeyUp(uint32 key, uint32 modifiers)
|
||||||
{
|
{
|
||||||
@@ -430,34 +451,34 @@ StateView::HandleKeyUp(uint32 key, uint32 modifiers)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// FilterMouse
|
|
||||||
void
|
void
|
||||||
StateView::FilterMouse(BPoint* where) const
|
StateView::FilterMouse(BPoint* where) const
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
// StateForDragMessage
|
|
||||||
ViewState*
|
ViewState*
|
||||||
StateView::StateForDragMessage(const BMessage* message)
|
StateView::StateForDragMessage(const BMessage* message)
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetCommandStack
|
|
||||||
void
|
void
|
||||||
StateView::SetCommandStack(::CommandStack* stack)
|
StateView::SetCommandStack(::CommandStack* stack)
|
||||||
{
|
{
|
||||||
fCommandStack = stack;
|
fCommandStack = stack;
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetLocker
|
|
||||||
void
|
void
|
||||||
StateView::SetLocker(RWLocker* locker)
|
StateView::SetLocker(RWLocker* locker)
|
||||||
{
|
{
|
||||||
fLocker = locker;
|
fLocker = locker;
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetUpdateTarget
|
|
||||||
void
|
void
|
||||||
StateView::SetUpdateTarget(BHandler* target, uint32 command)
|
StateView::SetUpdateTarget(BHandler* target, uint32 command)
|
||||||
{
|
{
|
||||||
@@ -465,7 +486,7 @@ StateView::SetUpdateTarget(BHandler* target, uint32 command)
|
|||||||
fUpdateCommand = command;
|
fUpdateCommand = command;
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetCatchAllEvents
|
|
||||||
void
|
void
|
||||||
StateView::SetCatchAllEvents(bool catchAll)
|
StateView::SetCatchAllEvents(bool catchAll)
|
||||||
{
|
{
|
||||||
@@ -480,7 +501,7 @@ StateView::SetCatchAllEvents(bool catchAll)
|
|||||||
_RemoveEventFilter();
|
_RemoveEventFilter();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Perform
|
|
||||||
status_t
|
status_t
|
||||||
StateView::Perform(Command* command)
|
StateView::Perform(Command* command)
|
||||||
{
|
{
|
||||||
@@ -494,23 +515,24 @@ StateView::Perform(Command* command)
|
|||||||
return B_NO_INIT;
|
return B_NO_INIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// #pragma mark -
|
// #pragma mark -
|
||||||
|
|
||||||
// _HandleKeyDown
|
|
||||||
bool
|
bool
|
||||||
StateView::_HandleKeyDown(uint32 key, uint32 modifiers)
|
StateView::_HandleKeyDown(uint32 key, uint32 modifiers)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// _HandleKeyUp
|
|
||||||
bool
|
bool
|
||||||
StateView::_HandleKeyUp(uint32 key, uint32 modifiers)
|
StateView::_HandleKeyUp(uint32 key, uint32 modifiers)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// _InstallEventFilter
|
|
||||||
void
|
void
|
||||||
StateView::_InstallEventFilter()
|
StateView::_InstallEventFilter()
|
||||||
{
|
{
|
||||||
@@ -526,6 +548,7 @@ StateView::_InstallEventFilter()
|
|||||||
Window()->AddCommonFilter(fEventFilter);
|
Window()->AddCommonFilter(fEventFilter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
StateView::_RemoveEventFilter()
|
StateView::_RemoveEventFilter()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2006-2007, Haiku.
|
* Copyright 2006-2007, 2023, Haiku.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
*
|
||||||
* Authors:
|
* Authors:
|
||||||
* Stephan Aßmus <[email protected]>
|
* Stephan Aßmus <[email protected]>
|
||||||
|
* Zardshard
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef STATE_VIEW_H
|
#ifndef STATE_VIEW_H
|
||||||
@@ -41,6 +42,8 @@ class StateView : public BView {
|
|||||||
virtual status_t Perform(perform_code code, void* data);
|
virtual status_t Perform(perform_code code, void* data);
|
||||||
// Avoids warning about hiding BView::Perform().
|
// Avoids warning about hiding BView::Perform().
|
||||||
|
|
||||||
|
virtual void GetPreferredSize(float* width, float* height);
|
||||||
|
|
||||||
// StateView interface
|
// StateView interface
|
||||||
void SetState(ViewState* state);
|
void SetState(ViewState* state);
|
||||||
void UpdateStateCursor();
|
void UpdateStateCursor();
|
||||||
@@ -84,6 +87,8 @@ class StateView : public BView {
|
|||||||
|
|
||||||
void _TriggerUpdate();
|
void _TriggerUpdate();
|
||||||
|
|
||||||
|
BRect fStartingRect;
|
||||||
|
|
||||||
ViewState* fCurrentState;
|
ViewState* fCurrentState;
|
||||||
ViewState* fDropAnticipatingState;
|
ViewState* fDropAnticipatingState;
|
||||||
// the drop anticipation state is some
|
// the drop anticipation state is some
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2006, Haiku.
|
* Copyright 2006, 2023, Haiku.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
*
|
||||||
* Authors:
|
* Authors:
|
||||||
* Stephan Aßmus <[email protected]>
|
* Stephan Aßmus <[email protected]>
|
||||||
|
* Zardshard
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "GradientControl.h"
|
#include "GradientControl.h"
|
||||||
@@ -21,7 +22,7 @@
|
|||||||
|
|
||||||
#include "GradientTransformable.h"
|
#include "GradientTransformable.h"
|
||||||
|
|
||||||
// constructor
|
|
||||||
GradientControl::GradientControl(BMessage* message, BHandler* target)
|
GradientControl::GradientControl(BMessage* message, BHandler* target)
|
||||||
: BView(BRect(0, 0, 259, 19), "gradient control", B_FOLLOW_NONE,
|
: BView(BRect(0, 0, 259, 19), "gradient control", B_FOLLOW_NONE,
|
||||||
B_WILL_DRAW | B_FRAME_EVENTS | B_NAVIGABLE),
|
B_WILL_DRAW | B_FRAME_EVENTS | B_NAVIGABLE),
|
||||||
@@ -40,7 +41,7 @@ GradientControl::GradientControl(BMessage* message, BHandler* target)
|
|||||||
SetLowColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
SetLowColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
||||||
}
|
}
|
||||||
|
|
||||||
// destructor
|
|
||||||
GradientControl::~GradientControl()
|
GradientControl::~GradientControl()
|
||||||
{
|
{
|
||||||
delete fGradient;
|
delete fGradient;
|
||||||
@@ -48,8 +49,9 @@ GradientControl::~GradientControl()
|
|||||||
delete fMessage;
|
delete fMessage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#if LIB_LAYOUT
|
#if LIB_LAYOUT
|
||||||
// layoutprefs
|
|
||||||
minimax
|
minimax
|
||||||
GradientControl::layoutprefs()
|
GradientControl::layoutprefs()
|
||||||
{
|
{
|
||||||
@@ -63,7 +65,7 @@ GradientControl::layoutprefs()
|
|||||||
return mpm;
|
return mpm;
|
||||||
}
|
}
|
||||||
|
|
||||||
// layout
|
|
||||||
BRect
|
BRect
|
||||||
GradientControl::layout(BRect frame)
|
GradientControl::layout(BRect frame)
|
||||||
{
|
{
|
||||||
@@ -71,9 +73,10 @@ GradientControl::layout(BRect frame)
|
|||||||
ResizeTo(frame.Width(), frame.Height());
|
ResizeTo(frame.Width(), frame.Height());
|
||||||
return Frame();
|
return Frame();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // LIB_LAYOUT
|
#endif // LIB_LAYOUT
|
||||||
|
|
||||||
// WindowActivated
|
|
||||||
void
|
void
|
||||||
GradientControl::WindowActivated(bool active)
|
GradientControl::WindowActivated(bool active)
|
||||||
{
|
{
|
||||||
@@ -81,7 +84,7 @@ GradientControl::WindowActivated(bool active)
|
|||||||
Invalidate();
|
Invalidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
// MakeFocus
|
|
||||||
void
|
void
|
||||||
GradientControl::MakeFocus(bool focus)
|
GradientControl::MakeFocus(bool focus)
|
||||||
{
|
{
|
||||||
@@ -96,7 +99,7 @@ GradientControl::MakeFocus(bool focus)
|
|||||||
BView::MakeFocus(focus);
|
BView::MakeFocus(focus);
|
||||||
}
|
}
|
||||||
|
|
||||||
// MouseDown
|
|
||||||
void
|
void
|
||||||
GradientControl::MouseDown(BPoint where)
|
GradientControl::MouseDown(BPoint where)
|
||||||
{
|
{
|
||||||
@@ -148,14 +151,14 @@ GradientControl::MouseDown(BPoint where)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// MouseUp
|
|
||||||
void
|
void
|
||||||
GradientControl::MouseUp(BPoint where)
|
GradientControl::MouseUp(BPoint where)
|
||||||
{
|
{
|
||||||
fDraggingStepIndex = -1;
|
fDraggingStepIndex = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// MouseMoved
|
|
||||||
void
|
void
|
||||||
GradientControl::MouseMoved(BPoint where, uint32 transit, const BMessage* dragMessage)
|
GradientControl::MouseMoved(BPoint where, uint32 transit, const BMessage* dragMessage)
|
||||||
{
|
{
|
||||||
@@ -191,7 +194,7 @@ GradientControl::MouseMoved(BPoint where, uint32 transit, const BMessage* dragMe
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// MessageReceived
|
|
||||||
void
|
void
|
||||||
GradientControl::MessageReceived(BMessage* message)
|
GradientControl::MessageReceived(BMessage* message)
|
||||||
{
|
{
|
||||||
@@ -232,7 +235,7 @@ GradientControl::MessageReceived(BMessage* message)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// KeyDown
|
|
||||||
void
|
void
|
||||||
GradientControl::KeyDown(const char* bytes, int32 numBytes)
|
GradientControl::KeyDown(const char* bytes, int32 numBytes)
|
||||||
{
|
{
|
||||||
@@ -316,7 +319,7 @@ GradientControl::KeyDown(const char* bytes, int32 numBytes)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw
|
|
||||||
void
|
void
|
||||||
GradientControl::Draw(BRect updateRect)
|
GradientControl::Draw(BRect updateRect)
|
||||||
{
|
{
|
||||||
@@ -436,7 +439,7 @@ GradientControl::Draw(BRect updateRect)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// FrameResized
|
|
||||||
void
|
void
|
||||||
GradientControl::FrameResized(float width, float height)
|
GradientControl::FrameResized(float width, float height)
|
||||||
{
|
{
|
||||||
@@ -447,7 +450,18 @@ GradientControl::FrameResized(float width, float height)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetGradient
|
|
||||||
|
void
|
||||||
|
GradientControl::GetPreferredSize(float* width, float* height)
|
||||||
|
{
|
||||||
|
if (width != NULL)
|
||||||
|
*width = 259;
|
||||||
|
|
||||||
|
if (height != NULL)
|
||||||
|
*height = 19;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
GradientControl::SetGradient(const ::Gradient* gradient)
|
GradientControl::SetGradient(const ::Gradient* gradient)
|
||||||
{
|
{
|
||||||
@@ -466,7 +480,7 @@ GradientControl::SetGradient(const ::Gradient* gradient)
|
|||||||
Invalidate();
|
Invalidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetCurrentStop
|
|
||||||
void
|
void
|
||||||
GradientControl::SetCurrentStop(const rgb_color& color)
|
GradientControl::SetCurrentStop(const rgb_color& color)
|
||||||
{
|
{
|
||||||
@@ -477,7 +491,7 @@ GradientControl::SetCurrentStop(const rgb_color& color)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetCurrentStop
|
|
||||||
bool
|
bool
|
||||||
GradientControl::GetCurrentStop(rgb_color* color) const
|
GradientControl::GetCurrentStop(rgb_color* color) const
|
||||||
{
|
{
|
||||||
@@ -490,7 +504,7 @@ GradientControl::GetCurrentStop(rgb_color* color) const
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetEnabled
|
|
||||||
void
|
void
|
||||||
GradientControl::SetEnabled(bool enabled)
|
GradientControl::SetEnabled(bool enabled)
|
||||||
{
|
{
|
||||||
@@ -506,7 +520,7 @@ GradientControl::SetEnabled(bool enabled)
|
|||||||
Invalidate();
|
Invalidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
// blend_colors
|
|
||||||
inline void
|
inline void
|
||||||
blend_colors(uint8* d, uint8 alpha, uint8 c1, uint8 c2, uint8 c3)
|
blend_colors(uint8* d, uint8 alpha, uint8 c1, uint8 c2, uint8 c3)
|
||||||
{
|
{
|
||||||
@@ -523,7 +537,7 @@ blend_colors(uint8* d, uint8 alpha, uint8 c1, uint8 c2, uint8 c3)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// _UpdateColors
|
|
||||||
void
|
void
|
||||||
GradientControl::_UpdateColors()
|
GradientControl::_UpdateColors()
|
||||||
{
|
{
|
||||||
@@ -605,7 +619,7 @@ GradientControl::_UpdateColors()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// _AllocBitmap
|
|
||||||
void
|
void
|
||||||
GradientControl::_AllocBitmap(int32 width, int32 height)
|
GradientControl::_AllocBitmap(int32 width, int32 height)
|
||||||
{
|
{
|
||||||
@@ -616,7 +630,7 @@ GradientControl::_AllocBitmap(int32 width, int32 height)
|
|||||||
fGradientBitmap = new BBitmap(BRect(0, 0, width - 1, height - 1), 0, B_RGB32);
|
fGradientBitmap = new BBitmap(BRect(0, 0, width - 1, height - 1), 0, B_RGB32);
|
||||||
}
|
}
|
||||||
|
|
||||||
// _GradientBitmapRect
|
|
||||||
BRect
|
BRect
|
||||||
GradientControl::_GradientBitmapRect() const
|
GradientControl::_GradientBitmapRect() const
|
||||||
{
|
{
|
||||||
@@ -628,7 +642,7 @@ GradientControl::_GradientBitmapRect() const
|
|||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
// _StepIndexFor
|
|
||||||
int32
|
int32
|
||||||
GradientControl::_StepIndexFor(BPoint where) const
|
GradientControl::_StepIndexFor(BPoint where) const
|
||||||
{
|
{
|
||||||
@@ -648,7 +662,7 @@ GradientControl::_StepIndexFor(BPoint where) const
|
|||||||
return index;
|
return index;
|
||||||
}
|
}
|
||||||
|
|
||||||
// _OffsetFor
|
|
||||||
float
|
float
|
||||||
GradientControl::_OffsetFor(BPoint where) const
|
GradientControl::_OffsetFor(BPoint where) const
|
||||||
{
|
{
|
||||||
@@ -659,7 +673,7 @@ GradientControl::_OffsetFor(BPoint where) const
|
|||||||
return offset;
|
return offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
// _UpdateCurrentColor
|
|
||||||
void
|
void
|
||||||
GradientControl::_UpdateCurrentColor() const
|
GradientControl::_UpdateCurrentColor() const
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2006-2007, Haiku.
|
* Copyright 2006-2007, 2023, Haiku.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
*
|
||||||
* Authors:
|
* Authors:
|
||||||
* Stephan Aßmus <[email protected]>
|
* Stephan Aßmus <[email protected]>
|
||||||
|
* Zardshard
|
||||||
*/
|
*/
|
||||||
#ifndef GRADIENT_CONTROL_H
|
#ifndef GRADIENT_CONTROL_H
|
||||||
#define GRADIENT_CONTROL_H
|
#define GRADIENT_CONTROL_H
|
||||||
@@ -59,6 +60,8 @@ class GradientControl :
|
|||||||
virtual void Draw(BRect updateRect);
|
virtual void Draw(BRect updateRect);
|
||||||
virtual void FrameResized(float width, float height);
|
virtual void FrameResized(float width, float height);
|
||||||
|
|
||||||
|
virtual void GetPreferredSize(float* width, float* height);
|
||||||
|
|
||||||
// GradientControl
|
// GradientControl
|
||||||
void SetGradient(const _ICON_NAMESPACE Gradient*
|
void SetGradient(const _ICON_NAMESPACE Gradient*
|
||||||
gradient);
|
gradient);
|
||||||
|
|||||||
Reference in New Issue
Block a user