#include <dali-toolkit-test-suite-utils.h>
#include <dali-toolkit/dali-toolkit.h>
+#include <dali-toolkit/devel-api/controls/buttons/button-devel.h>
#include <dali-toolkit/devel-api/visuals/visual-properties-devel.h>
#include <dali-toolkit/devel-api/visuals/text-visual-properties.h>
return true;
}
+static const char* TEST_IMAGE_ONE = TEST_RESOURCE_DIR "/gallery-small-1.jpg";
+const Vector2 TEST_IMAGE_SIZE = Vector2( 66.0f, 66.0f );
+
+
} // namespace
void checkbox_button_startup(void)
END_TEST;
}
+
+int UtcDaliCheckBoxSetLabelPadding(void)
+{
+ tet_infoline("UtcDaliCheckBoxSetLabelPadding\n");
+
+ ToolkitTestApplication application;
+
+ CheckBoxButton checkBox = CheckBoxButton::New();
+
+ Property::Map propertyMap;
+
+ propertyMap.Add( Toolkit::Visual::Property::TYPE, Toolkit::DevelVisual::TEXT )
+ .Add( Toolkit::TextVisual::Property::TEXT, "activate" )
+ .Add( Toolkit::TextVisual::Property::POINT_SIZE, 15.0f );
+
+ checkBox.SetProperty( Toolkit::DevelButton::Property::LABEL, propertyMap );
+
+ application.SendNotification();
+ application.Render();
+
+ Vector3 orginalSize = checkBox.GetNaturalSize();
+
+ checkBox.SetProperty( Toolkit::DevelButton::Property::LABEL_PADDING, Vector4( 10.0f, 10.0f, 10.0f, 10.0f ) );
+
+ application.SendNotification();
+ application.Render();
+
+ Vector3 paddingAddedSize = checkBox.GetNaturalSize();
+
+ DALI_TEST_EQUALS( checkBox.GetProperty<Vector4>( Toolkit::DevelButton::Property::LABEL_PADDING ), Vector4( 10.0f, 10.0f, 10.0f, 10.0f ), Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+
+ tet_infoline("Comparing original size of button with just text and button size with text and padding\n");
+
+ DALI_TEST_EQUALS( orginalSize.width +10.0f + 10.0f , paddingAddedSize.width, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+
+ DALI_TEST_EQUALS( orginalSize.height +10.0f + 10.0f , paddingAddedSize.height, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+
+ END_TEST;
+}
+
+int UtcDaliCheckBoxSetForegroundPadding(void)
+{
+ tet_infoline("UtcDaliCheckBoxSetForegroundPadding\n");
+
+ ToolkitTestApplication application;
+
+ CheckBoxButton checkBox = CheckBoxButton::New();
+
+ Property::Map propertyMap;
+
+ propertyMap.Add( Toolkit::Visual::Property::TYPE, Toolkit::DevelVisual::TEXT )
+ .Add( Toolkit::TextVisual::Property::TEXT, "activate" )
+ .Add( Toolkit::TextVisual::Property::POINT_SIZE, 15.0f );
+
+ checkBox.SetProperty( Toolkit::DevelButton::Property::LABEL, propertyMap );
+ checkBox.SetProperty( Toolkit::DevelButton::Property::LABEL_PADDING, Vector4( 5.0f, 5.0f, 5.0f, 5.0f ) );
+
+ application.SendNotification();
+ application.Render();
+
+ tet_printf( "Button RelayoutSize with text(%f,%f)\n", checkBox.GetNaturalSize().width, checkBox.GetNaturalSize().height );
+
+ TestPlatformAbstraction& platform = application.GetPlatform();
+ platform.SetClosestImageSize( TEST_IMAGE_SIZE );
+
+ checkBox.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_VISUAL, TEST_IMAGE_ONE );
+ checkBox.SetProperty( Toolkit::DevelButton::Property::SELECTED_VISUAL, TEST_IMAGE_ONE );
+
+
+ application.SendNotification();
+ application.Render();
+
+ Vector3 preVisualPaddingSize = checkBox.GetNaturalSize();
+
+ tet_printf( "Button RelayoutSize with text and icon (%f,%f)\n", checkBox.GetNaturalSize().width, checkBox.GetNaturalSize().height );
+
+ checkBox.SetProperty( Toolkit::DevelButton::Property::VISUAL_PADDING, Vector4( 25.0f, 25.0f, 25.0f, 25.0f ) );
+
+ application.SendNotification();
+ application.Render();
+
+ Vector3 paddingAddedSize = checkBox.GetNaturalSize();
+
+ tet_printf( "Button RelayoutSize with text, icon and padding (%f,%f)\n", checkBox.GetNaturalSize().width, checkBox.GetNaturalSize().height );
+
+ DALI_TEST_EQUALS( checkBox.GetProperty<Vector4>( Toolkit::DevelButton::Property::VISUAL_PADDING ), Vector4( 25.0f, 25.0f, 25.0f, 25.0f ), Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+
+ tet_infoline("Comparing original size of button before adding padding to visual foreground\n");
+
+ DALI_TEST_GREATER( paddingAddedSize.width, preVisualPaddingSize.width , TEST_LOCATION );
+
+ tet_infoline("Text and Visual are side by side, visual height and padding must be greater than text height and padding for this test\n");
+
+ DALI_TEST_GREATER( paddingAddedSize.height, preVisualPaddingSize.height , TEST_LOCATION );
+
+ END_TEST;
+}
develapicontrolsdir = $(develapidir)/controls
develapibloomviewdir = $(develapicontrolsdir)/bloom-view
develapibubbleemitterdir = $(develapicontrolsdir)/bubble-effect
+develapibuttonsdir = $(develapicontrolsdir)/buttons
develapieffectsviewdir = $(develapicontrolsdir)/effects-view
develapigaussianblurviewdir = $(develapicontrolsdir)/gaussian-blur-view
develapimagnifierdir = $(develapicontrolsdir)/magnifier
develapicontrols_HEADERS = $(devel_api_controls_header_files)
develapibloomview_HEADERS = $(devel_api_bloom_view_header_files)
develapibubbleemitter_HEADERS = $(devel_api_bubble_emitter_header_files)
+develapibuttons_HEADERS = $(devel_api_buttons_header_files)
develapibuilder_HEADERS = $(devel_api_builder_header_files)
develapieffectsview_HEADERS = $(devel_api_effects_view_header_files)
develapifocusmanager_HEADERS = $(devel_api_focus_manager_header_files)
--- /dev/null
+#ifndef __DALI_TOOLKIT_BUTTON_DEVEL_H__
+#define __DALI_TOOLKIT_BUTTON_DEVEL_H__
+
+/*
+ * Copyright (c) 2016 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.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/public-api/controls/buttons/button.h>
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+namespace DevelButton
+{
+/**
+ *
+ * @section ButtonProperties Properties
+ * |%Property enum |String name |Type |Writable|Animatable|
+ * |-------------------------------------------------------|----------------------------------------|--------------|--------|----------|
+ * | Property::DISABLED | disabled | BOOLEAN | Y | N |
+ * | Property::AUTO_REPEATING | autoRepeating | BOOLEAN | Y | N |
+ * | Property::INITIAL_AUTO_REPEATING_DELAY | initialAutoRepeatingDelay | FLOAT | Y | N |
+ * | Property::NEXT_AUTO_REPEATING_DELAY | nextAutoRepeatingDelay | FLOAT | Y | N |
+ * | Property::TOGGLABLE | togglable | BOOLEAN | Y | N |
+ * | Property::SELECTED | selected | BOOLEAN | Y | N |
+ * | Property::LABEL | label | MAP | Y | N |
+ * | Property::UNSELECTED_STATE_VISUAL | unselectedVisual | MAP | Y | N |
+ * | Property::SELECTED_VISUAL | selectedVisual | MAP | Y | N |
+ * | Property::DISABLED_SELECTED_VISUAL | disabledSelectedVisual | MAP | Y | N |
+ * | Property::DISABLED_UNSELECTED_VISUAL | disabledUnselectedVisual | MAP | Y | N |
+ * | Property::UNSELECTED_BACKGROUND_VISUAL | unselectedBackgroundVisual | MAP | Y | N |
+ * | Property::SELECTED_BACKGROUND_VISUAL | selectedBackgroundVisual | MAP | Y | N |
+ * | Property::DISABLED_UNSELECTED_BACKGROUND_VISUAL | disabledUnselectedBackgroundVisual | MAP | Y | N |
+ * | Property::DISABLED_SELECTED_BACKGROUND_VISUAL | disabledSelectedBackgroundVisual | MAP | Y | N |
+ * | Property::LABEL_RELATIVE_ALIGNMENT | labelRelativeAlignment | STRING | Y | N |
+ * -------------------------------------------------------------------------------------------------------------------------------------
+ *
+ *
+ */
+
+ namespace Property
+ {
+ enum Type
+ {
+ DISABLED = Dali::Toolkit::Button::Property::DISABLED,
+ AUTO_REPEATING = Dali::Toolkit::Button::Property::AUTO_REPEATING,
+ INITIAL_AUTO_REPEATING_DELAY = Dali::Toolkit::Button::Property::INITIAL_AUTO_REPEATING_DELAY,
+ NEXT_AUTO_REPEATING_DELAY = Dali::Toolkit::Button::Property:: NEXT_AUTO_REPEATING_DELAY,
+ TOGGLABLE = Dali::Toolkit::Button::Property::TOGGLABLE,
+ SELECTED = Dali::Toolkit::Button::Property::SELECTED,
+ UNSELECTED_STATE_IMAGE = Dali::Toolkit::Button::Property::UNSELECTED_STATE_IMAGE,
+ SELECTED_STATE_IMAGE = Dali::Toolkit::Button::Property::SELECTED_STATE_IMAGE,
+ DISABLED_STATE_IMAGE = Dali::Toolkit::Button::Property::DISABLED_STATE_IMAGE,
+ UNSELECTED_COLOR = Dali::Toolkit::Button::Property::UNSELECTED_COLOR,
+ SELECTED_COLOR = Dali::Toolkit::Button::Property::SELECTED_COLOR,
+ LABEL = Dali::Toolkit::Button::Property::LABEL,
+ LABEL_TEXT = Dali::Toolkit::Button::Property::LABEL_TEXT,
+
+ /**
+ * @brief name "unselectedVisual", type string if it is a url, map otherwise
+ * @details Sets the unselected button foreground/icon visual
+ */
+ UNSELECTED_VISUAL = LABEL_TEXT + 1,
+
+ /**
+ * @brief name "selectedImage", type string if it is a url, map otherwise
+ * @details Sets the selected button foreground/icon visual
+ * @SINCE_1_2.18
+ */
+ SELECTED_VISUAL,
+
+ /**
+ * @brief name "disabledSelectedVisual", type string if it is a url, map otherwise
+ * @details Sets the disabled selected state foreground/icon button visual
+ */
+ DISABLED_SELECTED_VISUAL,
+
+ /**
+ * @brief name "disabledUnSelectedVisual", type string if it is a url, map otherwise
+ * @details Sets the disabled unselected state foreground/icon visual
+ */
+ DISABLED_UNSELECTED_VISUAL,
+
+ /**
+ * @brief name "unselectedBackgroundVisual", type string if it is a url, map otherwise
+ * @details Sets the disabled in the unselected state background, button visual
+ */
+ UNSELECTED_BACKGROUND_VISUAL,
+
+ /**
+ * @brief name "selectedBackgroundVisual", type string if it is a url, map otherwise
+ * @details Sets the selected background button visual
+ */
+ SELECTED_BACKGROUND_VISUAL,
+
+ /**
+ * @brief name "disabledUnselectedBackgroundVisual", type string if it is a url, map otherwise
+ * @details Sets the disabled while unselected background button visual
+ */
+ DISABLED_UNSELECTED_BACKGROUND_VISUAL,
+
+ /**
+ * @brief name "disabledSelectedBackgroundVisual", type string if it is a url, map otherwise
+ * @details Sets the disabled while selected background button visual
+ */
+ DISABLED_SELECTED_BACKGROUND_VISUAL,
+
+ /**
+ * @brief name "labelRelativeAlignment", type STRING
+ * @details Sets the position of the the label in relation to the foreground/icon if both present
+ */
+ LABEL_RELATIVE_ALIGNMENT,
+
+ /**
+ * @brief name "labelPadding", type Vector4
+ * @details Sets the padding around the text
+ */
+ LABEL_PADDING,
+
+ /**
+ * @brief name "visualPadding", type Vector4
+ * @details Sets the padding around the foreground visual
+ */
+ VISUAL_PADDING
+ };
+ } // namespace Property
+
+} // namespace DevelButton
+
+} // namespace Toolkit
+
+} // namespace Dali
+
+#endif // __DALI_TOOLKIT_BUTTON_DEVEL_H__
devel_api_bubble_emitter_header_files = \
$(devel_api_src_dir)/controls/bubble-effect/bubble-emitter.h
+devel_api_buttons_header_files = \
+ $(devel_api_src_dir)/controls/buttons/button-devel.h
+
devel_api_builder_header_files = \
$(devel_api_src_dir)/builder/builder.h \
$(devel_api_src_dir)/builder/json-parser.h \
#include <dali/public-api/object/type-registry.h>
#include <dali/public-api/object/type-registry-helper.h>
#include <dali/public-api/size-negotiation/relayout-container.h>
+#include <dali/devel-api/object/property-helper-devel.h>
#include <dali/devel-api/scripting/scripting.h>
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/controls/text-controls/text-label.h>
#include <dali-toolkit/public-api/controls/image-view/image-view.h>
#include <dali-toolkit/public-api/visuals/color-visual-properties.h>
-#include <dali-toolkit/devel-api/visuals/visual-properties-devel.h>
#include <dali-toolkit/public-api/visuals/image-visual-properties.h>
#include <dali-toolkit/devel-api/align-enums.h>
#include <dali-toolkit/devel-api/controls/control-depth-index-ranges.h>
+#include <dali-toolkit/devel-api/controls/buttons/button-devel.h>
#include <dali-toolkit/devel-api/visual-factory/visual-factory.h>
#include <dali-toolkit/devel-api/visuals/text-visual-properties.h>
#include <dali-toolkit/devel-api/visuals/visual-properties-devel.h>
DALI_PROPERTY_REGISTRATION( Toolkit, Button, "selectedColor", VECTOR4, SELECTED_COLOR ) // Deprecated property
DALI_PROPERTY_REGISTRATION( Toolkit, Button, "label", MAP, LABEL )
DALI_PROPERTY_REGISTRATION( Toolkit, Button, "labelText", STRING, LABEL_TEXT ) // Deprecated property
-DALI_PROPERTY_REGISTRATION( Toolkit, Button, "unselectedVisual", MAP, UNSELECTED_VISUAL )
-DALI_PROPERTY_REGISTRATION( Toolkit, Button, "selectedVisual", MAP, SELECTED_VISUAL )
-DALI_PROPERTY_REGISTRATION( Toolkit, Button, "disabledSelectedVisual", MAP, DISABLED_SELECTED_VISUAL )
-DALI_PROPERTY_REGISTRATION( Toolkit, Button, "disabledUnselectedVisual", MAP, DISABLED_UNSELECTED_VISUAL )
-DALI_PROPERTY_REGISTRATION( Toolkit, Button, "unselectedBackgroundVisual", MAP, UNSELECTED_BACKGROUND_VISUAL )
-DALI_PROPERTY_REGISTRATION( Toolkit, Button, "selectedBackgroundVisual", MAP, SELECTED_BACKGROUND_VISUAL )
-DALI_PROPERTY_REGISTRATION( Toolkit, Button, "disabledUnselectedBackgroundVisual", MAP, DISABLED_UNSELECTED_BACKGROUND_VISUAL )
-DALI_PROPERTY_REGISTRATION( Toolkit, Button, "disabledSelectedBackgroundVisual", MAP, DISABLED_SELECTED_BACKGROUND_VISUAL )
-DALI_PROPERTY_REGISTRATION( Toolkit, Button, "labelRelativeAlignment", STRING, LABEL_RELATIVE_ALIGNMENT )
+DALI_DEVEL_PROPERTY_REGISTRATION( Toolkit, Button, "unselectedVisual", MAP, UNSELECTED_VISUAL )
+DALI_DEVEL_PROPERTY_REGISTRATION( Toolkit, Button, "selectedVisual", MAP, SELECTED_VISUAL )
+DALI_DEVEL_PROPERTY_REGISTRATION( Toolkit, Button, "disabledSelectedVisual", MAP, DISABLED_SELECTED_VISUAL )
+DALI_DEVEL_PROPERTY_REGISTRATION( Toolkit, Button, "disabledUnselectedVisual", MAP, DISABLED_UNSELECTED_VISUAL )
+DALI_DEVEL_PROPERTY_REGISTRATION( Toolkit, Button, "unselectedBackgroundVisual", MAP, UNSELECTED_BACKGROUND_VISUAL )
+DALI_DEVEL_PROPERTY_REGISTRATION( Toolkit, Button, "selectedBackgroundVisual", MAP, SELECTED_BACKGROUND_VISUAL )
+DALI_DEVEL_PROPERTY_REGISTRATION( Toolkit, Button, "disabledUnselectedBackgroundVisual", MAP, DISABLED_UNSELECTED_BACKGROUND_VISUAL )
+DALI_DEVEL_PROPERTY_REGISTRATION( Toolkit, Button, "disabledSelectedBackgroundVisual", MAP, DISABLED_SELECTED_BACKGROUND_VISUAL )
+DALI_DEVEL_PROPERTY_REGISTRATION( Toolkit, Button, "labelRelativeAlignment", STRING, LABEL_RELATIVE_ALIGNMENT )
+DALI_DEVEL_PROPERTY_REGISTRATION( Toolkit, Button, "labelPadding", VECTOR4, LABEL_PADDING )
+DALI_DEVEL_PROPERTY_REGISTRATION( Toolkit, Button, "visualPadding", VECTOR4, VISUAL_PADDING )
// Signals:
DALI_SIGNAL_REGISTRATION( Toolkit, Button, "pressed", SIGNAL_PRESSED )
const Property::Index GET_VISUAL_INDEX_FOR_STATE[][Button::STATE_COUNT] =
{
- { Toolkit::Button::Property::UNSELECTED_BACKGROUND_VISUAL, Toolkit::Button::Property::UNSELECTED_VISUAL },
- { Toolkit::Button::Property::SELECTED_BACKGROUND_VISUAL, Toolkit::Button::Property::SELECTED_VISUAL },
- { Toolkit::Button::Property::DISABLED_UNSELECTED_BACKGROUND_VISUAL, Toolkit::Button::Property::DISABLED_UNSELECTED_VISUAL },
- { Toolkit::Button::Property::DISABLED_SELECTED_BACKGROUND_VISUAL, Toolkit::Button::Property::DISABLED_SELECTED_VISUAL }
+ { Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, Toolkit::DevelButton::Property::UNSELECTED_VISUAL },
+ { Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, Toolkit::DevelButton::Property::SELECTED_VISUAL },
+ { Toolkit::DevelButton::Property::DISABLED_UNSELECTED_BACKGROUND_VISUAL, Toolkit::DevelButton::Property::DISABLED_UNSELECTED_VISUAL },
+ { Toolkit::DevelButton::Property::DISABLED_SELECTED_BACKGROUND_VISUAL, Toolkit::DevelButton::Property::DISABLED_SELECTED_VISUAL }
};
/**
case Toolkit::Button::Property::UNSELECTED_STATE_IMAGE: // Legacy Tizen 3.0
{
- GetImplementation( button ).CreateVisualsForComponent( Toolkit::Button::Property::UNSELECTED_VISUAL, value, DepthIndex::CONTENT );
+ GetImplementation( button ).CreateVisualsForComponent( Toolkit::DevelButton::Property::UNSELECTED_VISUAL, value, DepthIndex::CONTENT );
break;
}
case Toolkit::Button::Property::DISABLED_STATE_IMAGE: // Legacy Tizen 3.0
{
- GetImplementation( button ).CreateVisualsForComponent( Toolkit::Button::Property::DISABLED_UNSELECTED_VISUAL, value, DepthIndex::CONTENT );
+ GetImplementation( button ).CreateVisualsForComponent( Toolkit::DevelButton::Property::DISABLED_UNSELECTED_VISUAL, value, DepthIndex::CONTENT );
break;
}
case Toolkit::Button::Property::SELECTED_STATE_IMAGE: // Legacy Tizen 3.0
{
- GetImplementation( button ).CreateVisualsForComponent( Toolkit::Button::Property::SELECTED_VISUAL, value, DepthIndex::CONTENT );
+ GetImplementation( button ).CreateVisualsForComponent( Toolkit::DevelButton::Property::SELECTED_VISUAL, value, DepthIndex::CONTENT );
break;
}
- case Toolkit::Button::Property::UNSELECTED_VISUAL:
- case Toolkit::Button::Property::SELECTED_VISUAL:
- case Toolkit::Button::Property::DISABLED_SELECTED_VISUAL:
- case Toolkit::Button::Property::DISABLED_UNSELECTED_VISUAL:
+ case Toolkit::DevelButton::Property::UNSELECTED_VISUAL:
+ case Toolkit::DevelButton::Property::SELECTED_VISUAL:
+ case Toolkit::DevelButton::Property::DISABLED_SELECTED_VISUAL:
+ case Toolkit::DevelButton::Property::DISABLED_UNSELECTED_VISUAL:
{
GetImplementation( button ).CreateVisualsForComponent( index, value, DepthIndex::CONTENT );
break;
}
- case Toolkit::Button::Property::UNSELECTED_BACKGROUND_VISUAL:
- case Toolkit::Button::Property::SELECTED_BACKGROUND_VISUAL:
- case Toolkit::Button::Property::DISABLED_SELECTED_BACKGROUND_VISUAL:
- case Toolkit::Button::Property::DISABLED_UNSELECTED_BACKGROUND_VISUAL:
+ case Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL:
+ case Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL:
+ case Toolkit::DevelButton::Property::DISABLED_SELECTED_BACKGROUND_VISUAL:
+ case Toolkit::DevelButton::Property::DISABLED_UNSELECTED_BACKGROUND_VISUAL:
{
GetImplementation( button ).CreateVisualsForComponent( index , value, DepthIndex::BACKGROUND);
break;
case Toolkit::Button::Property::UNSELECTED_COLOR:
{
DALI_LOG_WARNING("[%s] Using deprecated Property Button::Property::UNSELECTED_COLOR instead use Button::Property::UNSELECTED_BACKGROUND_VISUAL\n", __FUNCTION__);
- GetImplementation( button ).SetColor( value.Get< Vector4 >(), Toolkit::Button::Property::UNSELECTED_BACKGROUND_VISUAL );
+ GetImplementation( button ).SetColor( value.Get< Vector4 >(), Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL );
break;
}
case Toolkit::Button::Property::SELECTED_COLOR:
{
DALI_LOG_WARNING("[%s] Using deprecated Property Button::Property::SELECTED_COLOR instead use Button::Property::SELECTED_BACKGROUND_VISUAL\n", __FUNCTION__);
- GetImplementation( button ).SetColor( value.Get< Vector4 >(), Toolkit::Button::Property::SELECTED_BACKGROUND_VISUAL );
+ GetImplementation( button ).SetColor( value.Get< Vector4 >(), Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL );
break;
}
break;
}
- case Toolkit::Button::Property::LABEL_RELATIVE_ALIGNMENT:
+ case Toolkit::DevelButton::Property::LABEL_RELATIVE_ALIGNMENT:
{
Button::Align labelAlignment(END);
Scripting::GetEnumeration< Button::Align> ( value.Get< std::string >().c_str(),
labelAlignment );
GetImplementation( button ).SetLabelAlignment( labelAlignment );
+ GetImplementation( button ).RelayoutRequest();
+ break;
+ }
+
+ case Toolkit::DevelButton::Property::LABEL_PADDING:
+ {
+ Vector4 padding ( value.Get< Vector4 >() );
+ GetImplementation( button ).SetLabelPadding( Padding( padding.x, padding.y, padding.z, padding.w ) );
+ break;
+ }
+
+ case Toolkit::DevelButton::Property::VISUAL_PADDING:
+ {
+ Vector4 padding ( value.Get< Vector4 >() );
+ GetImplementation( button ).SetForegroundPadding( Padding( padding.x, padding.y, padding.z, padding.w ) );
+ GetImplementation( button ).RelayoutRequest();
break;
}
}
case Toolkit::Button::Property::UNSELECTED_STATE_IMAGE:
{
- value = GetImplementation( button ).GetUrlForImageVisual( Toolkit::Button::Property::UNSELECTED_VISUAL );
+ value = GetImplementation( button ).GetUrlForImageVisual( Toolkit::DevelButton::Property::UNSELECTED_VISUAL );
break;
}
case Toolkit::Button::Property::SELECTED_STATE_IMAGE:
{
- value = GetImplementation( button ).GetUrlForImageVisual( Toolkit::Button::Property::SELECTED_VISUAL );
+ value = GetImplementation( button ).GetUrlForImageVisual( Toolkit::DevelButton::Property::SELECTED_VISUAL );
break;
}
case Toolkit::Button::Property::DISABLED_STATE_IMAGE:
{
- value = GetImplementation( button ).GetUrlForImageVisual( Toolkit::Button::Property::DISABLED_UNSELECTED_VISUAL );
+ value = GetImplementation( button ).GetUrlForImageVisual( Toolkit::DevelButton::Property::DISABLED_UNSELECTED_VISUAL );
break;
}
- case Toolkit::Button::Property::UNSELECTED_VISUAL:
- case Toolkit::Button::Property::SELECTED_VISUAL:
- case Toolkit::Button::Property::DISABLED_SELECTED_VISUAL:
- case Toolkit::Button::Property::DISABLED_UNSELECTED_VISUAL:
- case Toolkit::Button::Property::UNSELECTED_BACKGROUND_VISUAL:
- case Toolkit::Button::Property::SELECTED_BACKGROUND_VISUAL:
- case Toolkit::Button::Property::DISABLED_SELECTED_BACKGROUND_VISUAL:
- case Toolkit::Button::Property::DISABLED_UNSELECTED_BACKGROUND_VISUAL:
+ case Toolkit::DevelButton::Property::UNSELECTED_VISUAL:
+ case Toolkit::DevelButton::Property::SELECTED_VISUAL:
+ case Toolkit::DevelButton::Property::DISABLED_SELECTED_VISUAL:
+ case Toolkit::DevelButton::Property::DISABLED_UNSELECTED_VISUAL:
+ case Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL:
+ case Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL:
+ case Toolkit::DevelButton::Property::DISABLED_SELECTED_BACKGROUND_VISUAL:
+ case Toolkit::DevelButton::Property::DISABLED_UNSELECTED_BACKGROUND_VISUAL:
case Toolkit::Button::Property::LABEL:
{
Property::Map visualProperty;
break;
}
- case Toolkit::Button::Property::LABEL_RELATIVE_ALIGNMENT:
+ case Toolkit::DevelButton::Property::LABEL_RELATIVE_ALIGNMENT:
{
const char* alignment = Scripting::GetEnumerationName< Button::Align >( GetImplementation( button ).GetLabelAlignment(),
ALIGNMENT_STRING_TABLE,
break;
}
+
+ case Toolkit::DevelButton::Property::LABEL_PADDING:
+ {
+ Padding padding = GetImplementation( button ).GetLabelPadding();
+ value = Vector4( padding.x, padding.y, padding.top, padding.bottom);
+ break;
+ }
+
+ case Toolkit::DevelButton::Property::VISUAL_PADDING:
+ {
+ Padding padding = GetImplementation( button ).GetForegroundPadding();
+ value = Vector4( padding.x, padding.y, padding.top, padding.bottom);
+ }
}
}
// Legacy code needed whilst Color can be set by direct Property setting ( deprecated ) instead of setting a Visual
void Button::SetColor( const Vector4& color, Property::Index visualIndex )
{
- if ( visualIndex == Toolkit::Button::Property::SELECTED_BACKGROUND_VISUAL )
+ if ( visualIndex == Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL )
{
mSelectedColor = color;
}
{
if( !filename.empty() )
{
- CreateVisualsForComponent( Toolkit::Button::Property::UNSELECTED_VISUAL, filename, DepthIndex::CONTENT );
+ CreateVisualsForComponent( Toolkit::DevelButton::Property::UNSELECTED_VISUAL, filename, DepthIndex::CONTENT );
}
}
{
if( !filename.empty() )
{
- CreateVisualsForComponent( Toolkit::Button::Property::UNSELECTED_BACKGROUND_VISUAL, filename, DepthIndex::BACKGROUND );
+ CreateVisualsForComponent( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, filename, DepthIndex::BACKGROUND );
}
}
{
if( !filename.empty() )
{
- CreateVisualsForComponent( Toolkit::Button::Property::SELECTED_VISUAL, filename, DepthIndex::CONTENT );
+ CreateVisualsForComponent( Toolkit::DevelButton::Property::SELECTED_VISUAL, filename, DepthIndex::CONTENT );
}
}
{
if( !filename.empty() )
{
- CreateVisualsForComponent( Toolkit::Button::Property::SELECTED_BACKGROUND_VISUAL, filename, DepthIndex::BACKGROUND );
+ CreateVisualsForComponent( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, filename, DepthIndex::BACKGROUND );
}
}
{
if( !filename.empty() )
{
- CreateVisualsForComponent( Toolkit::Button::Property::DISABLED_UNSELECTED_BACKGROUND_VISUAL, filename, DepthIndex::BACKGROUND );
+ CreateVisualsForComponent( Toolkit::DevelButton::Property::DISABLED_UNSELECTED_BACKGROUND_VISUAL, filename, DepthIndex::BACKGROUND );
}
}
{
if( !filename.empty() )
{
- CreateVisualsForComponent( Toolkit::Button::Property::DISABLED_UNSELECTED_VISUAL, filename, DepthIndex::CONTENT );
+ CreateVisualsForComponent( Toolkit::DevelButton::Property::DISABLED_UNSELECTED_VISUAL, filename, DepthIndex::CONTENT );
}
}
{
if( !filename.empty() )
{
- CreateVisualsForComponent( Toolkit::Button::Property::DISABLED_SELECTED_VISUAL, filename, DepthIndex::CONTENT );
+ CreateVisualsForComponent( Toolkit::DevelButton::Property::DISABLED_SELECTED_VISUAL, filename, DepthIndex::CONTENT );
}
}
Actor Button::GetButtonImage() const
{
DALI_LOG_WARNING("Button::GetButtonImage @DEPRECATED_1_0.50\n");
- Actor imageView = Toolkit::ImageView::New( GetUrlForImageVisual( Toolkit::Button::Property::UNSELECTED_VISUAL ) );
+ Actor imageView = Toolkit::ImageView::New( GetUrlForImageVisual( Toolkit::DevelButton::Property::UNSELECTED_VISUAL ) );
return imageView;
}
Actor Button::GetSelectedImage() const
{
DALI_LOG_WARNING("Button::GetSelectedImage @DEPRECATED_1_0.50\n");
- Actor imageView = Toolkit::ImageView::New( GetUrlForImageVisual( Toolkit::Button::Property::SELECTED_VISUAL ) );
+ Actor imageView = Toolkit::ImageView::New( GetUrlForImageVisual( Toolkit::DevelButton::Property::SELECTED_VISUAL ) );
return imageView;
}
// INTERNAL INCLUDES
#include <dali-toolkit/devel-api/visual-factory/visual-base.h>
-#include <dali-toolkit/public-api/controls/buttons/button.h>
+#include <dali-toolkit/devel-api/controls/buttons/button-devel.h>
#include <dali-toolkit/public-api/controls/control-impl.h>
namespace Dali
#include <dali-toolkit/public-api/controls/text-controls/text-label.h>
#include <dali-toolkit/devel-api/controls/control-depth-index-ranges.h>
#include <dali-toolkit/devel-api/visual-factory/visual-factory.h>
+#include <dali-toolkit/devel-api/controls/buttons/button-devel.h>
#if defined(DEBUG_ENABLED)
extern Debug::Filter* gLogButtonFilter;
{
case Toolkit::PushButton::Property::UNSELECTED_ICON:
{
- pushButtonImpl.CreateVisualsForComponent( Toolkit::Button::Property::UNSELECTED_VISUAL, value, DepthIndex::CONTENT );
+ pushButtonImpl.CreateVisualsForComponent( Toolkit::DevelButton::Property::UNSELECTED_VISUAL, value, DepthIndex::CONTENT );
break;
}
case Toolkit::PushButton::Property::SELECTED_ICON:
{
- pushButtonImpl.CreateVisualsForComponent( Toolkit::Button::Property::SELECTED_VISUAL, value, DepthIndex::CONTENT );
+ pushButtonImpl.CreateVisualsForComponent( Toolkit::DevelButton::Property::SELECTED_VISUAL, value, DepthIndex::CONTENT );
break;
}
case Toolkit::PushButton::Property::ICON_ALIGNMENT:
*
* 'Visual' describes not just traditional images like png, bmp but refers to whatever is used to show the button, it could be a color, gradient or some other kind of renderer.
*
- * The button's appearance can be modified by setting properties for the various images.
+ * The button's appearance can be modified by setting properties for the various visuals/images.
*
* It is not mandatory to set all visuals. A button could be defined only by setting its \e background visual or by setting its \e background and \e selected visuals.
*
- * The \e button visual is shown over the \e background visual..
+ * The \e button visual is shown over the \e background visual.
* When pressed the unselected visuals are replaced by the \e selected visual. The text label is always placed on the top of all images.
*
* When the button is disabled, \e background, \e button and \e selected visuals are replaced by their \e disabled visuals.
*
-
- *
- * @brief A control which renders a short text string.
- *
- * Text labels are lightweight, non-editable and do not respond to user input.
- *
- *
- * @section ButtonProperties Properties
- * |%Property enum |String name |Type |Writable|Animatable|
- * |-------------------------------------------------------|----------------------------------------|--------------|--------|----------|
- * | Property::DISABLED | disabled | BOOLEAN | Y | N |
- * | Property::AUTO_REPEATING | autoRepeating | BOOLEAN | Y | N |
- * | Property::INITIAL_AUTO_REPEATING_DELAY | initialAutoRepeatingDelay | FLOAT | Y | N |
- * | Property::NEXT_AUTO_REPEATING_DELAY | nextAutoRepeatingDelay | FLOAT | Y | N |
- * | Property::TOGGLABLE | togglable | BOOLEAN | Y | N |
- * | Property::SELECTED | selected | BOOLEAN | Y | N |
- * | Property::LABEL | label | MAP | Y | N |
- * | Property::UNSELECTED_STATE_VISUAL | unselectedVisual | MAP | Y | N |
- * | Property::SELECTED_VISUAL | selectedVisual | MAP | Y | N |
- * | Property::DISABLED_SELECTED_VISUAL | disabledSelectedVisual | MAP | Y | N |
- * | Property::DISABLED_UNSELECTED_VISUAL | disabledUnselectedVisual | MAP | Y | N |
- * | Property::UNSELECTED_BACKGROUND_VISUAL | unselectedBackgroundVisual | MAP | Y | N |
- * | Property::SELECTED_BACKGROUND_VISUAL | selectedBackgroundVisual | MAP | Y | N |
- * | Property::DISABLED_UNSELECTED_BACKGROUND_VISUAL | disabledUnselectedBackgroundVisual | MAP | Y | N |
- * | Property::DISABLED_SELECTED_BACKGROUND_VISUAL | disabledSelectedBackgroundVisual | MAP | Y | N |
- * | Property::LABEL_RELATIVE_ALIGNMENT | labelRelativeAlignment | STRING | Y | N |
- * -------------------------------------------------------------------------------------------------------------------------------------
- *
- * Note, *_VISUAL properties of type MAP can also be passed a uri of type STRING
*
* Signals
* | %Signal Name | Method |
* @brief name "labelText", type std::string
* @SINCE_1_0.0
*/
- LABEL_TEXT,
-
- /**
- * @brief name "unselectedVisual", type string if it is a url, map otherwise
- * @details Sets the unselected button foreground/icon visual
- * @SINCE_1_2.XX
- */
- UNSELECTED_VISUAL,
-
- /**
- * @brief name "selectedImage", type string if it is a url, map otherwise
- * @details Sets the selected button foreground/icon visual
- * @SINCE_1_2.XX
- */
- SELECTED_VISUAL,
-
- /**
- * @brief name "disabledSelectedVisual", type string if it is a url, map otherwise
- * @details Sets the disabled selected state foreground/icon button visual
- * @SINCE_1_2.XX
- */
- DISABLED_SELECTED_VISUAL,
-
- /**
- * @brief name "disabledUnSelectedVisual", type string if it is a url, map otherwise
- * @details Sets the disabled unselected state foreground/icon visual
- * @SINCE_1_2.XX
- */
- DISABLED_UNSELECTED_VISUAL,
-
- /**
- * @brief name "unselectedBackgroundVisual", type string if it is a url, map otherwise
- * @details Sets the disabled in the unselected state background, button visual
- * @SINCE_1_2.XX
- */
- UNSELECTED_BACKGROUND_VISUAL,
-
- /**
- * @brief name "selectedBackgroundVisual", type string if it is a url, map otherwise
- * @details Sets the selected background button visual
- * @SINCE_1_2.XX
- */
- SELECTED_BACKGROUND_VISUAL,
-
- /**
- * @brief name "disabledUnselectedBackgroundVisual", type string if it is a url, map otherwise
- * @details Sets the disabled while unselected background button visual
- * @SINCE_1_2.XX
- */
- DISABLED_UNSELECTED_BACKGROUND_VISUAL,
-
- /**
- * @brief name "disabledSelectedBackgroundVisual", type string if it is a url, map otherwise
- * @details Sets the disabled while selected background button visual
- * @SINCE_1_2.XX
- */
- DISABLED_SELECTED_BACKGROUND_VISUAL,
-
- /**
- * @brief name "labelRelativeAlignment", type STRING
- * @details Sets the position of the the label in relation to the foreground/icon if both present
- * @SINCE_1_2.XX
- */
- LABEL_RELATIVE_ALIGNMENT,
+ LABEL_TEXT
};
};
void SetUnselectedImage( const std::string& filename ) DALI_DEPRECATED_API;
/**
- * @DEPRECATED_1_1.32 Use styling
- * Use Property::UNSELECTED_BACKGROUND_VISUAL
+ * @DEPRECATED_1_1.32 Use styling Set Control::Property::BACKGROUND which is same as un-selected background
+ * Or use DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL
*
- * @brief Sets the unselected background image.
+ * @brief Sets the background image.
*
* @SINCE_1_0.0
* @param[in] filename The background image.
void SetSelectedImage( const std::string& filename ) DALI_DEPRECATED_API;
/**
- * @DEPRECATED_1_2.32 Use styling file
- * Use Property::SELECTED_BACKGROUND_VISUAL
+ * @DEPRECATED_1_1.32 Set Control::Property::BACKGROUND which is same as un-selected background
+ * Or use DevelButton::Property::SELECTED_BACKGROUND_VISUAL
*
* @brief Sets the selected background image.
*
void SetSelectedBackgroundImage( const std::string& filename ) DALI_DEPRECATED_API;
/**
- * @DEPRECATED_1_1.32 Use styling file
- * Use Property::DISABLED_SELECTED_BACKGROUND_VISUAL
+ * @DEPRECATED_1_1.32 Only able to set Property::DISABLED_STATE_IMAGE
+ * Or use DevelButton::Property::DISABLED_SELECTED_BACKGROUND_VISUAL
*
* @brief Sets the disabled background image.
*
void SetDisabledImage( const std::string& filename ) DALI_DEPRECATED_API;
/**
- * @DEPRECATED_1_1.32 Use styling file
- * Use Property::DISABLED_SELECTED_VISUAL
+ * @DEPRECATED_1_1.32 Use Property::DISABLED_STATE_IMAGE which provides same disabled image for un/selected
+ * Or DevelButton::Property::DISABLED_SELECTED_VISUAL to disable selected visual.
*
* @brief Sets the disabled selected button image.
*
"Button":
{
"initialAutoRepeatingDelay":2.0,
- "nextAutoRepeatingDelay":0.9,
- "label":
- {
- "visualType": "TEXT",
- "horizontalAlignment": "CENTER",
- "pointSize" : 15.0, // Point size must always be provided to Text Visual
- "verticalAlignment": "CENTER"
- }
+ "nextAutoRepeatingDelay":0.9
// Note: Visuals added to Button will be used in all derived buttons unless overridden.
},
"PushButton":
"autoRepeating":false,
"togglable":false,
"labelPadding":[ 12.0, 12.0, 12.0, 12.0 ],
+ "label":
+ {
+ "visualType": "TEXT",
+ "horizontalAlignment": "CENTER",
+ "pointSize" : 15.0, // Point size must always be provided to Text Visual
+ "verticalAlignment": "CENTER"
+ },
"unselectedBackgroundVisual":
{
"visualType": "IMAGE",
"CheckBoxButton":
{
"styles":["Button"],
+ "labelPadding":[ 12.0, 12.0, 0.0, 0.0 ],
+ "label":
+ {
+ "visualType": "TEXT",
+ "pointSize" : 15.0, // Point size must always be provided to Text Visual
+ "verticalAlignment": "CENTER"
+ },
"unselectedBackgroundVisual":
{
"visualType": "IMAGE",
"RadioButton":
{
"styles":["Button"],
+ "labelPadding":[ 12.0, 12.0, 0.0, 0.0 ],
+ "label":
+ {
+ "visualType": "TEXT",
+ "pointSize" : 15.0, // Point size must always be provided to Text Visual
+ "verticalAlignment": "CENTER"
+ },
"unselectedBackgroundVisual":
{
"visualType": "IMAGE",
"Button":
{
"initialAutoRepeatingDelay":2.0,
- "nextAutoRepeatingDelay":0.9,
- "label":
- {
- "visualType": "TEXT",
- "horizontalAlignment": "CENTER",
- "pointSize" : 15.0, // Point size must always be provided to Text Visual
- "verticalAlignment": "CENTER"
- }
+ "nextAutoRepeatingDelay":0.9
// Note: Visuals added to Button will be used in all derived buttons unless overridden.
},
"PushButton":
"autoRepeating":false,
"togglable":false,
"labelPadding":[ 12.0, 12.0, 12.0, 12.0 ],
+ "label":
+ {
+ "visualType": "TEXT",
+ "horizontalAlignment": "CENTER",
+ "pointSize" : 15.0, // Point size must always be provided to Text Visual
+ "verticalAlignment": "CENTER"
+ },
"unselectedBackgroundVisual":
{
"visualType": "IMAGE",
"CheckBoxButton":
{
"styles":["Button"],
+ "labelPadding":[ 12.0, 12.0, 0.0, 0.0 ],
+ "label":
+ {
+ "visualType": "TEXT",
+ "pointSize" : 15.0, // Point size must always be provided to Text Visual
+ "verticalAlignment": "CENTER"
+ },
"unselectedVisual":
{
"visualType": "IMAGE",
"RadioButton":
{
"styles":["Button"],
+ "labelPadding":[ 12.0, 12.0, 0.0, 0.0 ],
+ "label":
+ {
+ "visualType": "TEXT",
+ "pointSize" : 15.0, // Point size must always be provided to Text Visual
+ "verticalAlignment": "CENTER"
+ },
"unselectedVisual":
{
"visualType": "IMAGE",
"Button":
{
"initialAutoRepeatingDelay":2.0,
- "nextAutoRepeatingDelay":0.9,
- "label":
- {
- "visualType": "TEXT",
- "horizontalAlignment": "CENTER",
- "pointSize" : 15.0, // Point size must always be provided to Text Visual
- "verticalAlignment": "CENTER"
- }
+ "nextAutoRepeatingDelay":0.9
// Note: Visuals added to Button will be used in all derived buttons unless overridden.
},
"PushButton":
"autoRepeating":false,
"togglable":false,
"labelPadding":[ 12.0, 12.0, 12.0, 12.0 ],
+ "label":
+ {
+ "visualType": "TEXT",
+ "horizontalAlignment": "CENTER",
+ "pointSize" : 15.0, // Point size must always be provided to Text Visual
+ "verticalAlignment": "CENTER"
+ },
"unselectedBackgroundVisual":
{
"visualType": "IMAGE",
"CheckBoxButton":
{
"styles":["Button"],
+ "labelPadding":[ 12.0, 12.0, 0.0, 0.0 ],
+ "label":
+ {
+ "visualType": "TEXT",
+ "pointSize" : 15.0, // Point size must always be provided to Text Visual
+ "verticalAlignment": "CENTER"
+ },
"unselectedVisual":
{
"visualType": "IMAGE",
"RadioButton":
{
"styles":["Button"],
+ "labelPadding":[ 12.0, 12.0, 0.0, 0.0 ],
+ "label":
+ {
+ "visualType": "TEXT",
+ "pointSize" : 15.0, // Point size must always be provided to Text Visual
+ "verticalAlignment": "CENTER"
+ },
"unselectedVisual":
{
"visualType": "IMAGE",