-//
-// 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.
+ *
+ */
#include <dali-toolkit/public-api/controls/control-impl.h>
-#include <boost/thread/tss.hpp>
#include <stack>
#include <dali/integration-api/debug.h>
-#include "dali-toolkit/internal/controls/style-change-processor.h"
#include "dali-toolkit/internal/controls/relayout-controller.h"
#include "dali-toolkit/internal/controls/relayout-helper.h"
#include "dali-toolkit/public-api/focus-manager/keyinput-focus-manager.h"
#include "dali-toolkit/public-api/focus-manager/keyboard-focus-manager.h"
#include <dali-toolkit/public-api/controls/control.h>
+#include <dali-toolkit/public-api/styling/style-manager.h>
+#include <dali-toolkit/internal/styling/style-manager-impl.h>
+
namespace Dali
{
mIsKeyboardNavigationSupported(false),
mIsKeyboardFocusGroup(false),
mKeyEventSignalV2(),
- mBackground( NULL )
+ mBackground( NULL ),
+ mFlags( Control::CONTROL_BEHAVIOUR_NONE )
{
}
// Background
Background* mBackground; ///< Only create the background if we use it
+ ControlBehaviour mFlags; ///< Flags passed in from constructor
+
// Properties - these need to be members of Internal::Control::Impl as they need to functions within this class.
static PropertyRegistration PROPERTY_1;
static PropertyRegistration PROPERTY_2;
Toolkit::Control Control::New()
{
// Create the implementation, temporarily owned on stack
- IntrusivePtr<Control> controlImpl = new Control( false );
+ IntrusivePtr<Control> controlImpl = new Control( CONTROL_BEHAVIOUR_NONE );
// Pass ownership to handle
Toolkit::Control handle( *controlImpl );
Control::~Control()
{
- if( mImpl->mInitialized )
- {
- // Unregister only if control has been initialized.
- Internal::StyleChangeProcessor::Unregister( this );
- }
delete mImpl;
}
void Control::Initialize()
{
- // Register with the style change processor so we are informed when the default style changes
- Internal::StyleChangeProcessor::Register( this );
// Calling deriving classes
OnInitialize();
+ if( mImpl->mFlags & REQUIRES_STYLE_CHANGE_SIGNALS )
+ {
+ Toolkit::StyleManager styleManager = Toolkit::StyleManager::Get();
+
+ // Register for style changes
+ styleManager.StyleChangeSignal().Connect( this, &ControlImpl::DoStyleChange );
+ }
+
mImpl->mInitialized = true;
}
return Actor();
}
+void Control::OnThemeChange( Toolkit::StyleManager styleManager )
+{
+ GetImpl( styleManager ).ApplyThemeStyle( GetOwner() );
+}
+
void Control::OnPinch(PinchGesture pinch)
{
if (pinch.state == Gesture::Started)
return false; // Accessibility pan gesture is not handled by default
}
+bool Control::OnAccessibilityTouch(const TouchEvent& touchEvent)
+{
+ return false; // Accessibility touch event is not handled by default
+}
+
bool Control::OnAccessibilityValueChange(bool isIncrease)
{
return false; // Accessibility value change action is not handled by default
{
bool ret = false;
+ if( object && (actionName == Toolkit::Control::ACTION_CONTROL_ACTIVATED) )
+ {
+ Toolkit::Control control = Toolkit::Control::DownCast( BaseHandle( object ) );
+ if( control )
+ {
+ // if cast succeeds there is an implementation so no need to check
+ control.GetImplementation().OnActivated();
+ }
+ }
+
return ret;
}
-void Control::DoActivatedAction(const PropertyValueContainer& attributes)
+void Control::DoStyleChange( Toolkit::StyleManager styleManager, StyleChange change )
{
- OnActivated();
+ if( change.themeChange )
+ {
+ OnThemeChange( styleManager );
+ }
+ else if( change.defaultFontChange || change.defaultFontSizeChange )
+ {
+ // This OnStyleChange(StyleChange change ) is deprecated, use OnFontChange instead
+ OnStyleChange( change );
+
+ OnFontChange( change.defaultFontChange, change.defaultFontSizeChange );
+ }
}
Toolkit::Control::KeyEventSignalV2& Control::KeyEventSignal()
{
}
+Control::Control( ControlBehaviour behaviourFlags )
+: CustomActorImpl( behaviourFlags & REQUIRES_TOUCH_EVENTS ),
+ mImpl(new Impl(*this))
+{
+ mImpl->mFlags = behaviourFlags;
+}
+
} // namespace Internal
} // namespace Toolkit