-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://floralicense.org/license/
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
// CLASS HEADER
-
#include "button-impl.h"
+// EXTERNAL INCLUDES
+#include <dali/public-api/events/touch-event.h>
+#include <dali/public-api/object/type-registry.h>
+
namespace
{
const char* const PROPERTY_DIMMED = "dimmed";
TypeRegistration typeRegistration( typeid(Toolkit::Button), typeid(Toolkit::Control), Create );
SignalConnectorType signalConnector1( typeRegistration, Toolkit::Button::SIGNAL_CLICKED, &Button::DoConnectSignal );
+SignalConnectorType signalConnector2( typeRegistration, Toolkit::Button::SIGNAL_TOGGLED, &Button::DoConnectSignal );
PropertyRegistration property1( typeRegistration, "dimmed", Toolkit::Button::PROPERTY_DIMMED, Property::BOOLEAN, &Button::SetProperty, &Button::GetProperty );
} // unnamed namespace
Button::Button()
-: Control( ControlBehaviour( REQUIRES_TOUCH_EVENTS | REQUIRES_THEME_CHANGE_SIGNALS ) ),
+: Control( ControlBehaviour( REQUIRES_TOUCH_EVENTS | REQUIRES_STYLE_CHANGE_SIGNALS ) ),
mState( ButtonUp ),
mDimmed( false ),
mPainter( NULL )
return mClickedSignalV2;
}
+Toolkit::Button::ToggledSignalV2& Button::ToggledSignal()
+{
+ return mToggledSignalV2;
+}
+
bool Button::DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor )
{
Dali::BaseHandle handle( object );
{
button.ClickedSignal().Connect( tracker, functor );
}
+ else if( Dali::Toolkit::Button::SIGNAL_TOGGLED == signalName )
+ {
+ button.ToggledSignal().Connect( tracker, functor );
+ }
else
{
// signalName does not match any signal
// Do nothing.
}
-void Button::OnStageDisconnection()
+void Button::OnControlStageDisconnection()
{
- if( ButtonUp != mState )
- {
- OnTouchPointLeave(); // Notification for derived classes.
- mState = ButtonUp;
- }
+ OnButtonStageDisconnection(); // Notification for derived classes.
+ mState = ButtonUp;
}
void Button::SetProperty( BaseObject* object, Property::Index index, const Property::Value& value )