From 0e726a568446023fb88b9160a9f7a0a85658ff4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Duval?= Date: Mon, 22 May 2006 10:35:01 +0000 Subject: [PATCH] fixed message delivering record control in media preferences for auich is now working correctly git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17530 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/interface/OptionControl.cpp | 42 +++++++++++----------------- src/kits/interface/OptionPopUp.cpp | 2 ++ 2 files changed, 18 insertions(+), 26 deletions(-) diff --git a/src/kits/interface/OptionControl.cpp b/src/kits/interface/OptionControl.cpp index af3bf6416a..e9012c0d63 100644 --- a/src/kits/interface/OptionControl.cpp +++ b/src/kits/interface/OptionControl.cpp @@ -1,31 +1,19 @@ -//----------------------------------------------------------------------------- -// Copyright (c) 2003-2004 Stefano Ceccherini -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the "Software"), -// to deal in the Software without restriction, including without limitation -// the rights to use, copy, modify, merge, publish, distribute, sublicense, -// and/or sell copies of the Software, and to permit persons to whom the -// Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. -// -// File Name: OptionControl.cpp -// Description: An abstract base class for option controls. -//------------------------------------------------------------------------------ +/* + * Copyright 2003-2006, Haiku, Inc. + * Distributed under the terms of the MIT license. + * + * Authors: + * Stefano Ceccherini (burton666@libero.it) + * Jerome Duval + * + * Description: An abstract base class for option controls. + */ + #include #include + /*! \brief Creates and initializes a BOptionControl. \param frame The control's frame rectangle. \param name The control's name. @@ -62,8 +50,10 @@ BOptionControl::MessageReceived(BMessage *message) case B_OPTION_CONTROL_VALUE: { int32 value; - if (message->FindInt32("be:value", &value) == B_OK) - SetValue(value); + if (message->FindInt32("be:value", &value) == B_OK) { + SetValue(value); + Invoke(); + } break; } default: diff --git a/src/kits/interface/OptionPopUp.cpp b/src/kits/interface/OptionPopUp.cpp index a1f95d1de9..837776a7e9 100644 --- a/src/kits/interface/OptionPopUp.cpp +++ b/src/kits/interface/OptionPopUp.cpp @@ -166,6 +166,7 @@ BOptionPopUp::AddOptionAt(const char *name, int32 value, int32 index) } menu->AddItem(newItem, index); + newItem->SetTarget(this); // We didnt' have any items before, so select the newly added one if (numItems == 0) @@ -185,6 +186,7 @@ BOptionPopUp::AllAttached() if (menu != NULL) { float labelWidth = _mField->StringWidth(_mField->Label()); _mField->SetDivider(labelWidth + kLabelSpace); + menu->SetTargetForItems(this); } }