static Editfield *create(Evas_Object *parent, const char *guideText);
/**
+ * @brief Set entry multiline state.
+ * @param[in] isMultiline Whether entry is multiline
+ */
+ void setMultiline(bool isMultiline);
+
+ /**
* @brief Set entry guide text.
* @param[in] guideText Text to be displayed when entry is empty
*/
static void onFocused(Evas_Object *layout, Evas_Object *entry, void *eventInfo);
static void onUnfocused(Evas_Object *layout, Evas_Object *entry, void *eventInfo);
static void onClearPressed(Evas_Object *entry, Evas_Object *button, void *eventInfo);
-
};
}
return layout;
}
+void Editfield::setMultiline(bool isMultiline)
+{
+ elm_entry_single_line_set(getEntry(), !isMultiline);
+ elm_entry_scrollable_set(getEntry(), !isMultiline);
+ elm_entry_line_wrap_set(getEntry(), isMultiline ? ELM_WRAP_MIXED : ELM_WRAP_NONE);
+}
+
void Editfield::setGuideText(const char *guideText)
{
elm_object_translatable_part_text_set(getEntry(), "elm.guide", guideText);
--- /dev/null
+/*
+ * Copyright (c) 2015-2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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.
+ *
+ */
+
+#ifndef CONTACTS_INPUT_CONTACT_NOTE_FIELD_ITEM_H
+#define CONTACTS_INPUT_CONTACT_NOTE_FIELD_ITEM_H
+
+#include "Contacts/Input/ContactFieldItem.h"
+#include "Contacts/Input/ContactTextFieldControl.h"
+
+namespace Contacts
+{
+ namespace Input
+ {
+ /**
+ * @brief Genlist item representing FieldNote field.
+ */
+ class ContactNoteFieldItem : public ContactFieldItem
+ {
+ public:
+ /**
+ * @see ContactFieldItem::ContactFieldItem()
+ */
+ ContactNoteFieldItem(Model::ContactObject &object);
+ virtual ~ContactNoteFieldItem() override;
+
+ private:
+ virtual Evas_Object *getContent(Evas_Object *parent, const char *part) override;
+ virtual void onInserted() override;
+ virtual void onUnrealized() override;
+ void onFieldControlResized(Evas *e, Evas_Object *obj, void *eventInfo);
+
+ ContactTextFieldControl *m_FieldControl;
+ };
+ }
+}
+
+#endif /* CONTACTS_INPUT_CONTACT_NOTE_FIELD_ITEM_H */
--- /dev/null
+/*
+ * Copyright (c) 2015-2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 "Contacts/Input/ContactNoteFieldItem.h"
+#include "Utils/Callback.h"
+
+#include "InputItemLayout.h"
+
+using namespace Contacts::Input;
+using namespace Contacts::Model;
+
+ContactNoteFieldItem::ContactNoteFieldItem(ContactObject &object)
+ : ContactFieldItem(object), m_FieldControl(nullptr)
+{
+}
+
+ContactNoteFieldItem::~ContactNoteFieldItem()
+{
+ if (m_FieldControl) {
+ evas_object_unref(m_FieldControl->getEvasObject());
+ }
+}
+
+Evas_Object *ContactNoteFieldItem::getContent(Evas_Object *parent, const char *part)
+{
+ if (strcmp(part, PART_VALUE) == 0) {
+ return m_FieldControl ? m_FieldControl->getEvasObject() : nullptr;
+ }
+
+ return ContactFieldItem::getContent(parent, part);
+}
+
+void ContactNoteFieldItem::onInserted()
+{
+ ContactFieldItem::onInserted();
+
+ m_FieldControl = new ContactTextFieldControl(this, getField().cast<ContactTextField>());
+ m_FieldControl->create(getParent()->getEvasObject());
+ m_FieldControl->setMultiline(true);
+ evas_object_ref(m_FieldControl->getEvasObject());
+ evas_object_event_callback_add(m_FieldControl->getEvasObject(), EVAS_CALLBACK_CHANGED_SIZE_HINTS,
+ makeCallback(&ContactNoteFieldItem::onFieldControlResized), this);
+}
+
+void ContactNoteFieldItem::onUnrealized()
+{
+ evas_object_hide(m_FieldControl->getEvasObject());
+}
+
+void ContactNoteFieldItem::onFieldControlResized(Evas *e, Evas_Object *obj, void *eventInfo)
+{
+ GenItem::update(PART_VALUE, ELM_GENLIST_ITEM_FIELD_CONTENT);
+}
void ContactTextFieldControl::updateReturnKey()
{
- setNextItem(findNextItem(m_ParentItem));
+ if (elm_entry_single_line_get(getEntry())) {
+ setNextItem(findNextItem(m_ParentItem));
+ }
}
void ContactTextFieldControl::updateEntryLayout()
void ContactTextFieldControl::onActivated(Evas_Object *entry, void *eventInfo)
{
+ if (!elm_entry_single_line_get(entry)) {
+ return;
+ }
+
if (m_NextItem) {
m_NextItem->focus(ELM_GENLIST_ITEM_SCROLLTO_IN, true);
} else {
#include "Contacts/Input/BasicInfoItem.h"
#include "Contacts/Input/ContactCompoundFieldItem.h"
#include "Contacts/Input/ContactGroupsFieldItem.h"
+#include "Contacts/Input/ContactNoteFieldItem.h"
#include "Contacts/Input/ContactRelationshipFieldItem.h"
#include "Contacts/Input/ContactRingtoneFieldItem.h"
#include "Contacts/Input/ContactTypedFieldItem.h"
ContactFieldItem *InputView::createFieldItem(ContactObject &field)
{
ContactFieldItem *item = nullptr;
- if (field.getId() == FieldRelationship) {
+ if (field.getId() == FieldNote) {
+ item = new ContactNoteFieldItem(field);
+ } else if (field.getId() == FieldRelationship) {
item = new ContactRelationshipFieldItem(field);
} else if (field.getId() == FieldRingtone) {
item = new ContactRingtoneFieldItem(field);