3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
5 // Licensed under the Flora License, Version 1.1 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://floralicense.org/license/
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an AS IS BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
19 * @file ToggleCustomItem.cpp
20 * @brief The ToggleCustomItem
25 #include <FGraphics.h>
26 #include <FUiControls.h>
28 #include "ClkToggleCustomItem.h"
30 using namespace Tizen::App;
31 using namespace Tizen::Base;
32 using namespace Tizen::Graphics;
33 using namespace Tizen::Ui::Controls;
35 static const int IDA_FORMAT_STRING = 101;
37 ToggleCustomItem::ToggleCustomItem(void)
45 ToggleCustomItem::~ToggleCustomItem(void)
51 ToggleCustomItem::Construct(int width, int height)
57 const Dimension dim(width, height);
58 r = CustomItem::Construct(dim, LIST_ANNEX_STYLE_ONOFF_SLIDING);
64 ToggleCustomItem::SetText(String& text)
70 ToggleCustomItem::GetText(void)
76 ToggleCustomItem::Make(void)
78 EnrichedText* pMainEnText = null;
79 TextElement* pMainTextElement = null;
80 Font* pMainTextFont = null;
81 int mainTextFont = 32;
84 Color textColor = Color(128, 128, 128);
85 Color pressedTextColor = Color(249, 249, 249);
88 int itemWidth = __width - 60 ;
90 pMainEnText = new (std::nothrow) EnrichedText();
91 pMainEnText->Construct(Dimension(__width - textX, textY));
93 pMainTextElement = new (std::nothrow) TextElement();
94 pMainTextElement->Construct(__text);
96 pMainTextFont = new (std::nothrow) Font();
97 pMainTextFont->Construct(FONT_STYLE_BOLD, mainTextFont);
99 pMainTextElement->SetFont(*pMainTextFont);
100 pMainTextElement->SetTextColor(textColor);
101 pMainEnText->Add(*pMainTextElement);
104 AddElement(Rectangle(X_Margin, Y_Margin, itemWidth , __height), IDA_FORMAT_STRING, *pMainEnText);
105 //SetElementSelectionEnabled(IDA_FORMAT_STRING, true);
107 delete pMainTextFont;
108 pMainEnText->RemoveAllTextElements(true);