const char* const PROPERTY_NAME_SCROLL_BAR_SHOW_DURATION = "scrollBarShowDuration";
const char* const PROPERTY_NAME_SCROLL_BAR_FADE_DURATION = "scrollBarFadeDuration";
const char* const PROPERTY_NAME_PIXEL_SIZE = "pixelSize";
+const char* const PROPERTY_NAME_LINE_COUNT = "lineCount";
const int DEFAULT_RENDERING_BACKEND = Dali::Toolkit::Text::DEFAULT_RENDERING_BACKEND;
DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_SCROLL_BAR_SHOW_DURATION ) == DevelTextEditor::Property::SCROLL_BAR_SHOW_DURATION );
DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_SCROLL_BAR_FADE_DURATION ) == DevelTextEditor::Property::SCROLL_BAR_FADE_DURATION );
DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_PIXEL_SIZE ) == DevelTextEditor::Property::PIXEL_SIZE );
+ DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_LINE_COUNT) == DevelTextEditor::Property::LINE_COUNT );
END_TEST;
}
END_TEST;
}
+int utcDaliTextEditorGetPropertyLinecountP(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline(" utcDaliTextEditorGetPropertyLinecount getting line count property");
+
+ int lineCount =0 ;
+
+ TextEditor editor = TextEditor::New();
+ editor.SetProperty( TextEditor::Property::POINT_SIZE, 10) ;
+ editor.SetProperty( TextEditor::Property::TEXT,
+ "TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST ");
+
+ Stage::GetCurrent().Add( editor );
+
+ editor.SetSize( 100.0f, 100.0f );
+ lineCount = editor.GetProperty<int>( DevelTextEditor::Property::LINE_COUNT );
+ DALI_TEST_EQUALS( lineCount, 14, TEST_LOCATION );
+
+ editor.SetSize( 50.0f, 100.0f );
+ lineCount = editor.GetProperty<int>( DevelTextEditor::Property::LINE_COUNT );
+ DALI_TEST_EQUALS( lineCount, 28, TEST_LOCATION );
+
+ END_TEST;
+}
* @brief The size of font in pixels.
* @details name "pixelSize", type float
*/
- PIXEL_SIZE
+ PIXEL_SIZE,
+
+ /**
+ * @brief The line count of text.
+ * @details name "lineCount", type int
+ * @note this property is read-only.
+ */
+ LINE_COUNT
};
} // namespace Property
* values FINISH_LOOP, IMMEDIATE, defualt FINISH_LOOP
*/
AUTO_SCROLL_STOP_MODE = OUTLINE + 4,
+
+ /*
+ * @brief The line count of text.
+ * @details name "lineCount", type int
+ * @node this property is read-only.
+ */
+ LINE_COUNT = OUTLINE + 5
};
} // namespace Property
DALI_DEVEL_PROPERTY_REGISTRATION( Toolkit, TextEditor, "scrollBarShowDuration", FLOAT, SCROLL_BAR_SHOW_DURATION )
DALI_DEVEL_PROPERTY_REGISTRATION( Toolkit, TextEditor, "scrollBarFadeDuration", FLOAT, SCROLL_BAR_FADE_DURATION )
DALI_DEVEL_PROPERTY_REGISTRATION( Toolkit, TextEditor, "pixelSize", FLOAT, PIXEL_SIZE )
+DALI_DEVEL_PROPERTY_REGISTRATION_READ_ONLY( Toolkit, TextEditor, "lineCount", INTEGER, LINE_COUNT )
DALI_SIGNAL_REGISTRATION( Toolkit, TextEditor, "textChanged", SIGNAL_TEXT_CHANGED )
DALI_SIGNAL_REGISTRATION( Toolkit, TextEditor, "inputStyleChanged", SIGNAL_INPUT_STYLE_CHANGED )
}
break;
}
+ case Toolkit::DevelTextEditor::Property::LINE_COUNT:
+ {
+ if( impl.mController )
+ {
+ float width = textEditor.GetProperty( Actor::Property::SIZE_WIDTH ).Get<float>();
+ value = impl.mController->GetLineCount( width );
+ }
+ break;
+ }
} //switch
}
DALI_DEVEL_PROPERTY_REGISTRATION( Toolkit, TextLabel, "pixelSize", FLOAT, PIXEL_SIZE )
DALI_DEVEL_PROPERTY_REGISTRATION( Toolkit, TextLabel, "ellipsis", BOOLEAN, ELLIPSIS )
DALI_DEVEL_PROPERTY_REGISTRATION( Toolkit, TextLabel, "autoScrollLoopDelay", FLOAT, AUTO_SCROLL_LOOP_DELAY )
-DALI_DEVEL_PROPERTY_REGISTRATION( Toolkit, TextLabel, "autoScrollStopMode", STRING, AUTO_SCROLL_STOP_MODE )
+DALI_DEVEL_PROPERTY_REGISTRATION( Toolkit, TextLabel, "autoScrollStopMode", STRING, AUTO_SCROLL_STOP_MODE )
+DALI_DEVEL_PROPERTY_REGISTRATION_READ_ONLY( Toolkit, TextLabel, "lineCount", INTEGER, LINE_COUNT )
DALI_TYPE_REGISTRATION_END()
}
break;
}
+ case Toolkit::DevelTextLabel::Property::LINE_COUNT:
+ {
+ if( impl.mController )
+ {
+ float width = label.GetProperty( Actor::Property::SIZE_WIDTH ).Get<float>();
+ value = impl.mController->GetLineCount( width );
+ }
+ break;
+ }
}
}
return layoutSize.height;
}
+int Controller::GetLineCount( float width )
+{
+ GetHeightForWidth( width );
+ int numberofLines = mImpl->mModel->GetNumberOfLines();
+ return numberofLines;
+}
+
const ModelInterface* const Controller::GetTextModel() const
{
return mImpl->mModel.Get();
float GetHeightForWidth( float width );
/**
+ * @brief Retrieves the text's number of lines for a given width.
+ * @param[in] width The width of the text's area.
+ * @ return The number of lines.
+ */
+ int GetLineCount( float width );
+
+ /**
* @brief Retrieves the text's model.
*
* @return A pointer to the text's model.