BColorControl: SetValue and Invoke on color drop if enabled
Change-Id: I055750707ed625b21c6b4cf02faf2509f615e169 Reviewed-on: https://review.haiku-os.org/c/haiku/+/8845 Haiku-Format: Haiku-format Bot <[email protected]> Tested-by: Commit checker robot <[email protected]> Reviewed-by: waddlesplash <[email protected]>
This commit is contained in:
committed by
waddlesplash
parent
a6fee6a1ca
commit
012d90c553
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2001-2013 Haiku, Inc. All Rights Reserved.
|
||||
* Copyright 2001-2025 Haiku, Inc. All Rights Reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
@@ -363,6 +363,18 @@ BColorControl::AttachedToWindow()
|
||||
void
|
||||
BColorControl::MessageReceived(BMessage* message)
|
||||
{
|
||||
if (message->WasDropped() && IsEnabled()) {
|
||||
char* name;
|
||||
type_code type;
|
||||
rgb_color* color;
|
||||
ssize_t size;
|
||||
if (message->GetInfo(B_RGB_COLOR_TYPE, 0, &name, &type) == B_OK
|
||||
&& message->FindData(name, type, (const void**)&color, &size) == B_OK) {
|
||||
SetValue(*color);
|
||||
Invoke(message);
|
||||
}
|
||||
}
|
||||
|
||||
switch (message->what) {
|
||||
case kMsgColorEntered:
|
||||
{
|
||||
@@ -408,6 +420,7 @@ BColorControl::MessageReceived(BMessage* message)
|
||||
|
||||
default:
|
||||
BControl::MessageReceived(message);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user