예제 #1
0
// display a simple splash screen until launcher is ready
void BadaGraphicsManager::showSplash() {
	Canvas canvas;
	canvas.Construct();
	canvas.SetBackgroundColor(Color::COLOR_BLACK);
	canvas.Clear();

	int x = _videoMode.hardwareWidth / 3;
	int y = _videoMode.hardwareHeight / 3;

	Font *pFont = new Font();
	pFont->Construct(FONT_STYLE_ITALIC | FONT_STYLE_BOLD, 55);
	canvas.SetFont(*pFont);
	canvas.SetForegroundColor(Color::COLOR_GREEN);
	canvas.DrawText(Point(x, y), L"ScummVM");
	delete pFont;

	pFont = new Font();
	pFont->Construct(FONT_STYLE_ITALIC | FONT_STYLE_BOLD, 35);
	canvas.SetFont(*pFont);
	canvas.SetForegroundColor(Color::COLOR_WHITE);
	canvas.DrawText(Point(x + 70, y + 50), L"Loading ...");
	delete pFont;

	canvas.Show();

}
예제 #2
0
// FIXME: leaks
result RichTextPanel::Construct(const Dimension& dim, const String & text) {
	result r = E_SUCCESS;
	TextElement* textElement;
	int width, height;
	Color color = Color::GetColor(COLOR_ID_WHITE);
	Font font;

	Dimension textDim;
	int textActualLen;

	enrichedText = new EnrichedText();
	r = enrichedText->Construct(dim);
	TryCatch(r == E_SUCCESS, , "Failed Construct EnrichedText");

	r = font.Construct(FONT_STYLE_PLAIN, TEXT_FONT_SIZE);
	TryCatch(r == E_SUCCESS, , "Failed Construct Font");

	textElement = new TextElement();
	r = textElement->Construct(text);
	TryCatch(r == E_SUCCESS, , "Failed TextElement");
	r = textElement->SetTextColor(color);
	TryCatch(r == E_SUCCESS, , "Failed SetTextColor");
	r = textElement->SetFont(font);
	TryCatch(r == E_SUCCESS, , "Failed SetFont");

	r = enrichedText->Add(*textElement);
	TryCatch(r == E_SUCCESS, , "Failed Add textElement");


	height = enrichedText->GetTotalLineHeight();

	r = enrichedText->GetTextExtent(0, text.GetLength(), textDim, textActualLen);
	TryCatch(r == E_SUCCESS, , "Failed GetTextExtent");
	width = dim.width < textDim.width ? dim.width : textDim.width;

	r = Panel::Construct(Rectangle(0, 0, width, height));
	TryCatch(r == E_SUCCESS, , "Failed Construct RichTextPanel parent");

	TryCatch(GetLastResult() == E_SUCCESS, r = GetLastResult(), "Failed GetSize");
	AppLog("Size received: %d x %d", width, height);

	r = SetSize(width, height);
	TryCatch(r == E_SUCCESS, , "Failed SetSize");

//	SetBackgroundColor(color);
	TryCatch(GetLastResult() == E_SUCCESS, r = GetLastResult(), "Failed SetBackgroundColor");

	return r;

	CATCH:
	    AppLogException("$${Function:Construct} is failed.", GetErrorMessage(r));

	    if (textElement)
	    	delete textElement;

	    return r;
}
예제 #3
0
result Form2::OnDraw() {
	Canvas *pCanvas = GetCanvasN();
	Font *pFont = new Font;
	result r = pFont->Construct("/Res/LiberationMono-Regular.ttf", FONT_STYLE_PLAIN, font);
	pCanvas->SetFont(*pFont);
	for (int i = 0; i < 3; i++)
		pCanvas->DrawText(Point(10,600+i*font),legal[i]);
	delete pCanvas;
	delete pFont;
	r = E_SUCCESS;
	return r;
}
예제 #4
0
void
CommentItem::Initialize(String name, String time, String comment, String bitmap_path)
{
	Font font;
    font.Construct(FONT_STYLE_PLAIN, 25);

	AppResource* pAppResource = Application::GetInstance()->GetAppResource();
	profile_image = pAppResource->GetBitmapN(L"tizen.png");

	enriched_text1 = new EnrichedText();
	enriched_text2 = new EnrichedText();
	enriched_text3 = new EnrichedText();

	enriched_text1->Construct(Dimension(400,30));
	enriched_text1->SetTextWrapStyle(TEXT_WRAP_CHARACTER_WRAP);
	enriched_text1->SetTextAbbreviationEnabled(true);

	enriched_text2->Construct(Dimension(500,30));
	enriched_text2->SetTextWrapStyle(TEXT_WRAP_CHARACTER_WRAP);
	enriched_text2->SetTextAbbreviationEnabled(true);

	enriched_text3->Construct(Dimension(150,30));
	enriched_text3->SetTextWrapStyle(TEXT_WRAP_CHARACTER_WRAP);
	enriched_text3->SetTextAbbreviationEnabled(true);

	text_element_name = new TextElement();
	text_element_time = new TextElement();
	text_element_comment = new TextElement();


	text_element_name->Construct(name);
	text_element_time->Construct(time);
	text_element_comment->Construct(comment);

	text_element_name->SetFont(font);
	text_element_time->SetFont(font);
	text_element_time->SetTextColor(Color(200,200,200,255));
	text_element_comment->SetFont(font);

	enriched_text1->Add(*text_element_name);
	enriched_text2->Add(*text_element_comment);
	enriched_text3->Add(*text_element_time);

//	this->RequestRedraw(true);

}
예제 #5
0
	virtual result DrawButton(Canvas& canvas)
	{
		canvas.SetBackgroundColor(Color(0, 0, 0, 0));
		canvas.Clear();

		if (_state == BUTTON_STATE_NORMAL)
		{
			canvas.FillRoundRectangle(_pallete[BUTTON_COLOR_BG_NORMAL], Rectangle(0, 0 , _bounds.width, _bounds.height), Dimension(5, 5));
		}
		else
		{
			canvas.FillRoundRectangle(_pallete[BUTTON_COLOR_BG_PRESSED], Rectangle(0, 0 , _bounds.width, _bounds.height), Dimension(5, 5));
		}

        Font font;
        font.Construct(FONT_STYLE_PLAIN, 18);
        canvas.SetFont(font);

        if (_text != L"")
        {
        	EnrichedText enriched;
        	enriched.Construct(Dimension(_bounds.width, _bounds.height));
        	enriched.SetVerticalAlignment(TEXT_ALIGNMENT_MIDDLE);
        	enriched.SetHorizontalAlignment(TEXT_ALIGNMENT_CENTER);

        	TextElement element;
        	element.Construct(_text);
    		if (_state == BUTTON_STATE_NORMAL)
    		{
    			element.SetTextColor(_pallete[BUTTON_COLOR_FG_NORMAL]);
    		}
    		else
    		{
    			element.SetTextColor(_pallete[BUTTON_COLOR_FG_PRESSED]);
    		}
    		enriched.Add(element);
    		canvas.DrawText(Point(0, 0), enriched);
    		enriched.RemoveAll(false);
        }

		return E_SUCCESS;
	}
예제 #6
0
void Dictionary::AddItemTitle(CustomItem *& pItem, String name, int itemWidth)
{
	result r;

	EnrichedText* pEnrichedText = new EnrichedText();
	r = pEnrichedText->Construct(Dimension(itemWidth, 200));

	TextElement * pTextElement = new TextElement();
	r = pTextElement->Construct(name);

	Font font;
	font.Construct(FONT_STYLE_BOLD, 40);
	pTextElement->SetFont(font);

	pEnrichedText->Add(*pTextElement);

	AddToDestructList(pTextElement);
	AddToDestructList(pEnrichedText);
	pItem->AddElement(Rectangle(10, 5, itemWidth - 10, 50), ID_FORMAT_STRING, *pEnrichedText);
}
Tizen::Ui::Controls::ListItemBase *
ShoppingListTab1::CreateItem(int index, int itemWidth)
{

	String*	pvalueText;
	DbRow* pRow = theTableLists.GetRow(index);
	if (pRow)
	{
		pRow->GetText(1, pvalueText);
	}

	String strName = *pvalueText;

	int textWidth = GetWidth() - INDENT*2;

	EnrichedText enrichedText;
	enrichedText.Construct(FloatDimension(textWidth, 112));
	enrichedText.SetVerticalAlignment(TEXT_ALIGNMENT_MIDDLE);
	enrichedText.SetHorizontalAlignment(TEXT_ALIGNMENT_LEFT);
	enrichedText.SetTextWrapStyle(TEXT_WRAP_WORD_WRAP);

	Font pFont;
	pFont.Construct(FONT_STYLE_BOLD, 44.0f);

	TextElement* pTextElement = new (std::nothrow) TextElement();
	pTextElement->Construct(strName + "\n");
	pTextElement->SetFont(pFont);
	enrichedText.Add(*pTextElement);

	int textHeight = enrichedText.GetTotalLineHeight();

	CustomItem* pItem = new CustomItem();
	pItem->Construct(Dimension(GetWidth(), textHeight + INDENT*2), LIST_ANNEX_STYLE_NORMAL);
	pItem->AddElement(Rectangle(INDENT, INDENT, textWidth, textHeight), 0, enrichedText);

	AppAssert(pItemContext);
	pItem->SetContextItem(pItemContext);

	return pItem;

}
예제 #8
0
void Dictionary::AddItemPreparing(CustomItem *& pItem, int itemWidth)
{
	result r;

	EnrichedText* pEnrichedText = new EnrichedText();
	r = pEnrichedText->Construct(Dimension(itemWidth, 200));
	pEnrichedText->SetVerticalAlignment(TEXT_ALIGNMENT_TOP);
	pEnrichedText->SetHorizontalAlignment(TEXT_ALIGNMENT_RIGHT);
	TextElement * pTextElement = new TextElement();
	r = pTextElement->Construct(Utils::GetString("IDS_PREPARING"));

	Font font;
	font.Construct(FONT_STYLE_PLAIN, 25);
	pTextElement->SetFont(font);
	pEnrichedText->Add(*pTextElement);

	AddToDestructList(pTextElement);
	AddToDestructList(pEnrichedText);
	int width, height;
	pEnrichedText->GetSize(width, height);
	pItem->AddElement(Rectangle(0, 5, itemWidth - 10, 30), ID_FORMAT_PREPARING, *pEnrichedText);
}
예제 #9
0
void
SkyCanvas::Initialize() {

	starLayers = new Osp::Base::Collection::HashMapT<int, Osp::Graphics::Canvas*>();
	starLayers -> Construct();

	Font font;
	font.Construct(FONT_STYLE_BOLD, 14);

	Canvas* canvas1 = new Canvas();
	canvas1 -> Construct(Rectangle(0, 0, 240, 400));
	canvas1 -> SetBackgroundColor(COLOR_SKY);
	canvas1 -> SetForegroundColor(COLOR_FORM_TEXT);
	canvas1 -> FillRectangle(COLOR_SKY, Rectangle(0, 0, 240, 400));
	canvas1 -> SetFont(font);
	canvas1 -> DrawText(Point(120, 70), "N");
	canvas1 -> DrawText(Point(120, 312), "S");
	starLayers -> Add(1, canvas1);

	Canvas* canvas2 = new Canvas();
	canvas2 -> SetBackgroundColor(COLOR_SKY);
	canvas2 -> Construct(Rectangle(0, 0, 480, 800));
	canvas2 -> FillRectangle(COLOR_SKY, Rectangle(0, 0, 480, 800));
	starLayers -> Add(2, canvas2);

	Canvas* canvas4 = new Canvas();
	canvas4 -> SetBackgroundColor(COLOR_SKY);
	canvas4 -> Construct(Rectangle(0, 0, 960, 1600));
	canvas4 -> FillRectangle(COLOR_SKY, Rectangle(0, 0, 960, 1600));
	starLayers -> Add(4, canvas4);

//	Fails to initialize on real device :(
//	Canvas* canvas8 = new Canvas();
//	canvas8 -> SetBackgroundColor(COLOR_SKY);
//	canvas8 -> Construct(Rectangle(0, 0, 1920, 3200));
//	canvas8 -> FillRectangle(COLOR_SKY, Rectangle(0, 0, 1920, 3200));
//	starLayers -> Add(8, canvas8);

}
예제 #10
0
result
EditingScrollPanel::OnDraw()
{
	int i;
	Rectangle *tmp_rect;
	String	  *tmp_string;
	Boolean	  *tmp_highlight;
	Font font;
    font.Construct(FONT_STYLE_PLAIN, 30);

	AppResource* pAppResource = Application::GetInstance()->GetAppResource();

	Rectangle tmp_client_rect = GetClientAreaBounds();

	Canvas *pCanvas = this->GetCanvasN(Rectangle(0,0,this->GetWidth(), tmp_client_rect.height));

	pCanvas->FillRectangle(Color(246,0,200,255), Rectangle(0,0,this->GetWidth(), tmp_client_rect.height));
	pCanvas->FillRectangle(Color(246,255,0,255), Rectangle(0,200,this->GetWidth(), tmp_client_rect.height));

	for(i=0; i<arr_text_element.GetCount(); i++)
	{
		tmp_rect = static_cast< Rectangle* > (arr_text_element_rect.GetAt(i));
		tmp_string = static_cast< String *> (arr_text_element.GetAt(i));
		tmp_highlight = static_cast <Boolean *> (arr_text_element_highlight.GetAt(i));
		if(tmp_highlight->ToBool() == true)
		{
			pCanvas->DrawText(Point(tmp_rect->x, tmp_rect->y), *tmp_string, Color(0,255,0,150));
		}
		else
		{
			pCanvas->DrawText(Point(tmp_rect->x, tmp_rect->y), *tmp_string);
		}
		//pCanvas->DrawRectangle(*tmp_rect);
	}

}
예제 #11
0
 result DrawElement(const Osp::Graphics::Canvas& canvas, const Osp::Graphics::Rectangle& rect, CustomListItemStatus itemStatus)
 {
     result r = E_SUCCESS;

     Canvas* pCanvas = const_cast<Canvas*>(&canvas);

     Font textfont;
     textfont.Construct(Osp::Graphics::FONT_STYLE_PLAIN, 28);

     EnrichedText texteel;
     texteel.Construct(Dimension(rect.width, rect.height));
   	 texteel.SetHorizontalAlignment(Osp::Graphics::TEXT_ALIGNMENT_LEFT);
     texteel.SetVerticalAlignment(Osp::Graphics::TEXT_ALIGNMENT_MIDDLE);
     texteel.SetTextWrapStyle(TEXT_WRAP_CHARACTER_WRAP);
     texteel.SetTextAbbreviationEnabled(true);
     TextElement textelcol;
     textelcol.Construct(text);
     textelcol.SetTextColor(Color::COLOR_WHITE);
     textelcol.SetFont(textfont);
     texteel.Add(textelcol);
     pCanvas->DrawText(Point(0,0), texteel);

     return r;
 }
예제 #12
0
void Dictionary::AddItemExamples(CustomItem *& pItem, int itemWidth, String examples)
{
	result r;

	EnrichedText* pEnrichedText = new EnrichedText();
	r = pEnrichedText->Construct(Dimension(itemWidth, 200));
	pEnrichedText->SetTextWrapStyle(TEXT_WRAP_WORD_WRAP);
	pEnrichedText->SetVerticalAlignment(TEXT_ALIGNMENT_TOP);
	pEnrichedText->SetHorizontalAlignment(TEXT_ALIGNMENT_LEFT);

	TextElement * pTextElement = new TextElement();
	r = pTextElement->Construct(examples);

	Font font;
	font.Construct(FONT_STYLE_PLAIN, 20);
	pTextElement->SetFont(font);

	pEnrichedText->Add(*pTextElement);

	AddToDestructList(pTextElement);
	AddToDestructList(pEnrichedText);

	pItem->AddElement(Rectangle(10, 45, itemWidth - 80, ITEM_HEIGHT - 60), ID_FORMAT_EXAMPLES, *pEnrichedText);
}
예제 #13
0
    bool drawText(const char * pszText, Dimension& dimensions, CCImage::ETextAlign alignment, const char * fontName = NULL, int fontSize = 0)
    {
        bool nRet = false;
        do
        {
            CC_BREAK_IF(pszText == NULL || strlen(pszText) <= 0);
            // text
            Osp::Base::String strText(pszText);
            // Set a font to the TextElement
            Font font;
            bool bUseDefaultFont = true;
            if (fontName != NULL && strlen(fontName) > 0)
            {
                String strFonName(fontName);
                if (strFonName.EndsWith(".ttf") || strFonName.EndsWith(".TTF"))
                {
                    bUseDefaultFont = false;
                    const char* pFullFontPath = CCFileUtils::fullPathFromRelativePath(fontName);
                    font.Construct(pFullFontPath, FONT_STYLE_PLAIN, fontSize);
                }
                else
                {
                    IList* pSystemFontList = Font::GetSystemFontListN();
                    if (pSystemFontList != NULL)
                    {
                        IEnumerator* pEnum = pSystemFontList->GetEnumeratorN();
                        Object* pObj = null;
                        while (pEnum->MoveNext() == E_SUCCESS)
                        {
                            pObj = pEnum->GetCurrent();
                            String* pStrName = static_cast<String*>(pObj);
                            if (pStrName->Equals(strFonName, false))
                            {
                                bUseDefaultFont = false;
                                font.Construct(*pStrName, FONT_STYLE_PLAIN, fontSize);
                                break;
                            }
                        }

                        delete pEnum;

                        pSystemFontList->RemoveAll(true);
                        delete pSystemFontList;
                    }
                }
            }

            if (bUseDefaultFont)
            {
                font.Construct(FONT_STYLE_PLAIN, fontSize);
            }

            // calculate text size
            if (dimensions.width <= 0)
            {
                Dimension dim;
                font.GetTextExtent(strText, strText.GetLength(), dim);
                dimensions.width = dim.width;
                dimensions.height = dim.height;
            }

            CC_BREAK_IF(dimensions.width <= 0);

            // Create an EnrichedText
            m_pEnrichedText = new EnrichedText();
            m_pEnrichedText->Construct(Dimension(dimensions.width, 10));

            switch (alignment)
            {
            case CCImage::kAlignCenter:
                m_pEnrichedText->SetHorizontalAlignment(TEXT_ALIGNMENT_CENTER);
                m_pEnrichedText->SetVerticalAlignment(TEXT_ALIGNMENT_MIDDLE);
                break;
            case CCImage::kAlignTop:
                m_pEnrichedText->SetHorizontalAlignment(TEXT_ALIGNMENT_CENTER);
                m_pEnrichedText->SetVerticalAlignment(TEXT_ALIGNMENT_TOP);
                break;
            case CCImage::kAlignTopRight:
                m_pEnrichedText->SetHorizontalAlignment(TEXT_ALIGNMENT_RIGHT);
                m_pEnrichedText->SetVerticalAlignment(TEXT_ALIGNMENT_TOP);
                break;
            case CCImage::kAlignRight:
                m_pEnrichedText->SetHorizontalAlignment(TEXT_ALIGNMENT_RIGHT);
                m_pEnrichedText->SetVerticalAlignment(TEXT_ALIGNMENT_MIDDLE);
                break;
            case CCImage::kAlignBottomRight:
                m_pEnrichedText->SetHorizontalAlignment(TEXT_ALIGNMENT_RIGHT);
                m_pEnrichedText->SetVerticalAlignment(TEXT_ALIGNMENT_BOTTOM);
                break;
            case CCImage::kAlignBottom:
                m_pEnrichedText->SetHorizontalAlignment(TEXT_ALIGNMENT_CENTER);
                m_pEnrichedText->SetVerticalAlignment(TEXT_ALIGNMENT_BOTTOM);
                break;
            case CCImage::kAlignBottomLeft:
                m_pEnrichedText->SetHorizontalAlignment(TEXT_ALIGNMENT_LEFT);
                m_pEnrichedText->SetVerticalAlignment(TEXT_ALIGNMENT_BOTTOM);
                break;
            case CCImage::kAlignLeft:
                m_pEnrichedText->SetHorizontalAlignment(TEXT_ALIGNMENT_LEFT);
                m_pEnrichedText->SetVerticalAlignment(TEXT_ALIGNMENT_MIDDLE);
                break;
            case CCImage::kAlignTopLeft:
                m_pEnrichedText->SetHorizontalAlignment(TEXT_ALIGNMENT_LEFT);
                m_pEnrichedText->SetVerticalAlignment(TEXT_ALIGNMENT_TOP);
                break;
            default:
                m_pEnrichedText->SetHorizontalAlignment(TEXT_ALIGNMENT_CENTER);
                m_pEnrichedText->SetVerticalAlignment(TEXT_ALIGNMENT_MIDDLE);
                break;
            }
            // Set attributes of the EnrichedText
            m_pEnrichedText->SetTextWrapStyle(TEXT_WRAP_CHARACTER_WRAP);
            m_pEnrichedText->SetTextAbbreviationEnabled(true);

            // Create a TextElement
            TextElement* pTextElement = new TextElement();
            pTextElement->Construct(strText);
            // After Adding, set attributes of the TextElement
            pTextElement->SetTextColor(Color::COLOR_WHITE);
            pTextElement->SetFont(font);
            // Add the TextElement to the EnrichedText
            m_pEnrichedText->Add(*pTextElement);

            m_pEnrichedText->Refresh();
            dimensions.height = m_pEnrichedText->GetTotalLineHeight();
            m_pEnrichedText->SetSize(dimensions.width, dimensions.height);

            CC_SAFE_DELETE(m_pCanvas);
            m_pCanvas = new Canvas();
            m_pCanvas->Construct(Rectangle(0, 0, dimensions.width, dimensions.height));
            m_pCanvas->DrawText(Point(0, 0), *m_pEnrichedText);

            m_pEnrichedText->RemoveAllTextElements(true);
            CC_SAFE_DELETE(m_pEnrichedText);

            nRet = true;
        } while (0);
        return nRet;
    }
예제 #14
0
result
EnrichedTextForm::OnInitializing(void)
{
	BaseForm::OnInitializing();
	result r = E_SUCCESS;

	ButtonItem buttonLeftItem;
	buttonLeftItem.Construct(BUTTON_ITEM_STYLE_TEXT, ID_EXIT);
	buttonLeftItem.SetText(L"Back");

	Rectangle rect(20, 200, 680, 360);
	__pEnrichedText = new (std::nothrow) EnrichedText();
	__pEnrichedText->Construct(Dimension(rect.width, rect.height));
	__pEnrichedText->SetVerticalAlignment(TEXT_ALIGNMENT_TOP);
	__pEnrichedText->SetHorizontalAlignment(TEXT_ALIGNMENT_LEFT);
	__pEnrichedText->SetTextWrapStyle(TEXT_WRAP_NONE);
	__pEnrichedText->SetTextAbbreviationEnabled(true);

	Font* pFont = new (std::nothrow) Font();
	pFont->Construct(FONT_STYLE_PLAIN, 35);

	Font* pFontItalic = new (std::nothrow) Font();
	pFontItalic->Construct(FONT_STYLE_ITALIC, 30);

	Bitmap* pBitmap = App::GetInstance()->GetAppResource()->GetBitmapN(L"home_type3.png");
	if (pBitmap)
	{
		pBitmap->Scale(Dimension(50, 50));
	}

	__pTextElement1 = new (std::nothrow) TextElement();
	__pTextElement2 = new (std::nothrow) TextElement();
	__pTextElement3 = new (std::nothrow) TextElement();

	__pTextElement1->Construct(L"Tizen is a new open platform that enables richer user experience");
	__pTextElement2->Construct(L"in applications on mobile devices.");
	__pTextElement3->Construct(L"Tizen API Reference provides of all the powerful features. Tizen is a new open platform that enables richer user experience in applications on mobile devices");

	__pTextElement1->SetTextColor(Color::GetColor(COLOR_ID_YELLOW));

	__pTextElement2->SetTextColor(Color::GetColor(COLOR_ID_BLUE));
	__pTextElement2->SetFont(*pFont);

	__pTextElement3->SetTextColor(Color::GetColor(COLOR_ID_VIOLET));
	__pTextElement3->SetFont(*pFontItalic);

	__pEnrichedText->Add(*__pTextElement1);
	__pEnrichedText->Add(*__pTextElement2);
	__pEnrichedText->Add(*pBitmap);
	__pEnrichedText->Add(*__pTextElement3);

	__pEnrichedText->Refresh();

	ListView* pListview = static_cast<ListView*>(GetControl("IDC_LISTVIEW", true));
	if(pListview)
	{
		pListview->SetBounds(0, GetClientAreaBounds().height/2, GetClientAreaBounds().width, GetClientAreaBounds().height/2);
		pListview->AddListViewItemEventListener(*this);
		pListview->SetItemProvider(*this);
	}

	delete pFont;
	delete pFontItalic;
	delete pBitmap;

	return r;
}
예제 #15
0
result
EditPanel::OnDraw()
{
	int i;
	Rectangle *tmp_rect;
	Rectangle *tmp_rect2;
	String	  *tmp_string;
	Boolean	  *tmp_highlight;
	Integer	  *tmp_int;
	String	  *tmp_insert_str;
	Integer   *tmp_check;
	Point	*tmp_point;
	Font font;
	String	  *tmp_string2;


    font.Construct(FONT_STYLE_PLAIN, 30);

	AppResource* pAppResource = Application::GetInstance()->GetAppResource();

	Canvas *pCanvas = this->GetCanvasN();
	pCanvas->SetFont(font);


	//pCanvas->DrawBitmap(Rectangle(0,0,this->GetWidth(), 855), *(pAppResource->GetBitmapN(L"EditPanel_background.png")));
	//pCanvas->FillRectangle(Color(246,246,246,255), Rectangle(0,0,this->GetWidth(), tmp_client_rect.height-497));
	//pCanvas->FillRectangle(Color(255,255,255,255), Rectangle(0,0,this->GetWidth()-60, tmp_client_rect.height));

	for(i=0; i<arr_text_element.GetCount(); i++)
	{
		tmp_rect = static_cast< Rectangle* > (arr_text_element_rect.GetAt(i));
		tmp_string = static_cast< String *> (arr_text_element.GetAt(i));
		tmp_highlight = static_cast <Boolean *> (arr_text_element_highlight.GetAt(i));
		tmp_int = static_cast< Integer *> (arr_text_element_editing_mark.GetAt(i));
		tmp_check = static_cast< Integer *> (arr_insert_check.GetAt(i));
		tmp_insert_str = static_cast< String *> (arr_text_insert.GetAt(i));
		tmp_point = static_cast< Point *> (arr_binding_start_and_end.GetAt(i));
		tmp_rect2 = static_cast< Rectangle* > (arr_memo_rect.GetAt(i));
		tmp_string2 = static_cast< String *> (arr_memo.GetAt(i));
/*		if(tmp_rect->height < 0 || tmp_rect->y > tmp_client_rect.height-497)
		{

		}
		else*/
		{
			if(tmp_point->x < 1000)
			{
				pCanvas->FillRectangle(Color(255,248,209,255),Rectangle(*tmp_rect));
				if(tmp_string2->GetLength() > 1)
				{

					pCanvas->FillRectangle(Color(240,200,209,255),Rectangle(*tmp_rect2));
				}
			}

			if(tmp_highlight->ToBool() == true)
			{
				pCanvas->DrawText(Point(tmp_rect->x, tmp_rect->y), *tmp_string, Color(0,255,0,150));
			}
			else
			{
				pCanvas->DrawText(Point(tmp_rect->x, tmp_rect->y), *tmp_string);
			}



			if(tmp_int->value == 2)
			{

				pCanvas->FillRectangle(Color(0,187,237,255), Rectangle(tmp_rect->x, tmp_rect->y+15, tmp_rect->width, 5));
				pCanvas->DrawText(Point(tmp_rect->x, tmp_rect->y + tmp_rect->height), *tmp_insert_str, Color(0,187,237,255));

			}
			if(tmp_int->value == 3)
			{
				pCanvas->FillRectangle(Color(0,187,237,200), Rectangle(tmp_rect->x, tmp_rect->y+15, tmp_rect->width, 5));
				//pCanvas->DrawText(Point(tmp_rect->x, tmp_rect->y + tmp_rect->height), *tmp_insert_str, Color(0,255,0,0));
			}
			else if(tmp_int->value == 1)
			{
				pCanvas->FillRectangle(Color(0,187,237,255), Rectangle(tmp_rect->x, tmp_rect->y+15, tmp_rect->width, 5));
			}
			else if(tmp_check->value == 1)
			{
				pCanvas->DrawBitmap(Rectangle(tmp_rect->x-15, tmp_rect->y+15, 30 , 15), *pAppResource->GetBitmapN(L"attach_mark.png"));
				pCanvas->DrawText(Point(tmp_rect->x-(tmp_insert_str->GetLength()/2), tmp_rect->y + tmp_rect->height), *tmp_insert_str, Color(0,255,0,255));
			}
			else if(tmp_check->value == 2)
			{
				pCanvas->DrawBitmap(Rectangle(tmp_rect->x-15, tmp_rect->y+15, 30 , 15), *pAppResource->GetBitmapN(L"attach_mark.png"));
				pCanvas->DrawText(Point(tmp_rect->x-(tmp_insert_str->GetLength()/2), tmp_rect->y + tmp_rect->height), *tmp_insert_str, Color(0,255,0,255));
				tmp_insert_str = static_cast< String *> (arr_text_insert.GetAt(i+1));
				pCanvas->DrawBitmap(Rectangle(tmp_rect->x-15, tmp_rect->y+15, 30 , 15), *pAppResource->GetBitmapN(L"attach_mark.png"));
				pCanvas->DrawText(Point(tmp_rect->x-(tmp_insert_str->GetLength()/2), tmp_rect->y + tmp_rect->height), *tmp_insert_str, Color(0,255,0,255));
			}
			else if(tmp_check->value == 3)
			{
				tmp_insert_str = static_cast< String *> (arr_text_insert.GetAt(i+1));
				pCanvas->DrawBitmap(Rectangle(tmp_rect->x-15, tmp_rect->y+15, 30 , 15), *pAppResource->GetBitmapN(L"attach_mark.png"));
				pCanvas->DrawText(Point(tmp_rect->x-(tmp_insert_str->GetLength()/2), tmp_rect->y + tmp_rect->height), *tmp_insert_str, Color(0,255,0,255));
			}
			pCanvas->DrawRectangle(*tmp_rect);
		}
	}

	if(onHighlightStart == true)
	{
		pCanvas->FillRectangle(Color(100,100,255,255), cur_start_rect);
		pCanvas->FillRectangle(Color(100,100,255,255), cur_end_rect);
	}


}
예제 #16
0
bool
EditPanel::Construct(String content, bool me)
{

	AppResource* pAppResource = Application::GetInstance()->GetAppResource();


	select_index_edit = Point(1000,1000);
	int i;
	int current_y = 0;
	int current_x = 40;
	Rectangle *tmp_rect;
    Dimension		tmp_dim;
    String			tmp_str;
    wchar_t			tmp_char;
	Font font;
    font.Construct(FONT_STYLE_PLAIN, 30);

  //  this->SetBackgroundColor(Color(100,100,100,255));

    ori_word_cnt = 0;
    edt_word_cnt = 0;

    scroll_state = 1;
	str_content = L"이용수 위원장은 협상팀과 함께 지난 4일 출국해 6일 귀국했고 곧바로 7일 브리핑을 하는 셈이다. 큰 틀에서 이미 판 마르바이크 감독과 합의가 이루어진 것으로 예상할 수 있는 대목이다. 판 마르바이크 감독과의 교감이 없었다면 굳이 브리핑을 할 이유가 없으며 다른 후보자들을 두고 조기 귀국할 이유 역시 없기 때문이다. 사실상 판 마르바이크 감독과의 세부적인 조율만을 남겨놓고 있다는 전망이 나오고 있는 이유다. 이미 네덜란드 언론에서도 판 마르바이크 감독이 한국와의 협상이 진행중이라는 보도가 나온 만큼 대한축구협회가 판 마르바이크 감독에게 관심을 보이고 있다는 사실은 더 이상 비밀이 아니다. 7일 열리는 브리핑을 통해 한국 축구대표팀 차기 감독의 윤곽이 드러날지 기대된다.";
	Eng = L"Chairman of the past four days to leave the water six days he returned with the negotiating team and that the briefing is Shem 7 days straight. It is to be expected that the agreement made ​​board director and Marquez already big frame bike passage. Without sympathetic because of the dry plate bike coach no reason to doubt why the briefing dare not leave the other candidates to return home early. The only reason that comes the prospect that detailed coordination and supervision left on the bike virtually dry plate. It is not a secret that there already seems to plate dry bike in Dutch media director for the Football Association as from the reports of the negotiations with South Korea coach underway dry plate is no longer interested in bikes. Briefing paper is expected to be revealed over the seven days of the South Korea national football team will open the outline next coach.";
	bool		start_blank_check = false;

	for(i=0; i<str_content.GetLength(); i++)
	{
		str_content.GetCharAt(i, tmp_char);
		if(tmp_char == ' ' && start_blank_check == false)
		{

		}
		else
		{
			start_blank_check = true;
			tmp_str.Append(tmp_char);
			if(tmp_char == ' ' && (i+1) < str_content.GetLength())
			{
				str_content.GetCharAt(i+1,tmp_char);
				if(tmp_char != ' ')
				{
					font.GetTextExtent(tmp_str, tmp_str.GetLength(), tmp_dim);
					arr_text_element.Add(new String(tmp_str));

					if(current_x + tmp_dim.width > 650)
					{
						current_x = 40;
						current_y += (STRIATION_SPACING);
					}
					arr_text_element_highlight.Add(new Boolean(false));
					arr_text_element_rect.Add(new Rectangle(current_x, current_y, tmp_dim.width ,STRIATION_SPACING/2));
					arr_text_element_editing_mark.Add(new Integer(NONE));
					arr_insert_check.Add(new Integer(0));
					arr_text_insert.Add(new String(""));
					arr_binding_start_and_end.Add(new Point(1000,1000));
					arr_memo_rect.Add(new Rectangle(current_x - 20,current_y + STRIATION_SPACING/2, 40, 40));
					arr_memo.Add(new String("0"));
					current_x += tmp_dim.width;
					ori_word_cnt++;
					tmp_str.Clear();
				}
			}
			else if(i == str_content.GetLength()-1)
			{
				font.GetTextExtent(tmp_str, tmp_str.GetLength(), tmp_dim);
				arr_text_element.Add(new String(tmp_str));

				if(current_x + tmp_dim.width > 650)
				{
					current_x = 70;
					current_y += (STRIATION_SPACING);
				}
				arr_text_element_highlight.Add(new Boolean(false));
				arr_text_element_rect.Add(new Rectangle(current_x, current_y, tmp_dim.width ,STRIATION_SPACING/2));
				arr_memo_rect.Add(new Rectangle(current_x - 20,current_y + STRIATION_SPACING/2, 40, 40));
				arr_text_element_editing_mark.Add(new Integer(NONE));
				arr_insert_check.Add(new Integer(0));
				arr_text_insert.Add(new String("0"));
				arr_binding_start_and_end.Add(new Point(1000,1000));
				arr_memo.Add(new String(0));
				current_x += tmp_dim.width;
				ori_word_cnt++;
				tmp_str.Clear();
			}

		}
	}



	cur_label = new Label;

	cur_label->Construct(Rectangle(65,176,31,19), " ");
	cur_label->SetBackgroundBitmap(*pAppResource->GetBitmapN(L"edit_background_cursor.png"));





	onHighlightStart = false;


    contextMenu = new ContextMenu();
    contextMenu->Construct(Point(50, 50), CONTEXT_MENU_STYLE_GRID, CONTEXT_MENU_ANCHOR_DIRECTION_UPWARD );
    contextMenu->SetFocusable(true);
    contextMenu->AddItem(L"첨삭하기", 1);
    contextMenu->AddActionEventListener(*this);

    contextMenu2 = new ContextMenu();
    contextMenu2->Construct(Point(50, 50), CONTEXT_MENU_STYLE_GRID, CONTEXT_MENU_ANCHOR_DIRECTION_UPWARD );
    contextMenu2->SetFocusable(true);
    contextMenu2->AddItem(L"첨삭수정", 1);
    contextMenu2->AddItem(L"첨삭삭제", 10);
    contextMenu2->AddActionEventListener(*this);

    onContextMenu = false;


    for(i=0; i<200; i++)
    {
    	plus[i] = 0;
    	minus[i] = 0;
    }

    plus_cnt = 0;
    minus_cnt = 0;


	AppLog("success!");

	Panel::Construct(Rectangle(0,0,650,current_y+50));
	AddControl(contextMenu);
	AddControl(contextMenu2);
	this->AddTouchEventListener(*this);
	//this->AddScrollEventListener(*this);


	draw_timer.Construct(*this);
	return true;
}
예제 #17
0
bool
EditingScrollPanel::Initialize(String content)
{
	result r =  Construct(FORM_STYLE_NORMAL | FORM_STYLE_PORTRAIT_INDICATOR);
	TryReturn(r == E_SUCCESS, false, "Failed to construct form");

	AppResource* pAppResource = Application::GetInstance()->GetAppResource();



	int i;
	int current_y = 0;
	int current_x = 70;

    Dimension		tmp_dim;
    String			tmp_str;
    Rectangle		panel_rect;
    wchar_t			tmp_char;
	Font font;
    font.Construct(FONT_STYLE_PLAIN, 30);

    str_content = content;
	str_content = L"이용수 위원장은 협상팀과 함께 지난 4일 출국해 6일 귀국했고 곧바로 7일 브리핑을 하는 셈이다. 큰 틀에서 이미 판 마르바이크 감독과 합의가 이루어진 것으로 예상할 수 있는 대목이다. 판 마르바이크 감독과의 교감이 없었다면 굳이 브리핑을 할 이유가 없으며 다른 후보자들을 두고 조기 귀국할 이유 역시 없기 때문이다. 사실상 판 마르바이크 감독과의 세부적인 조율만을 남겨놓고 있다는 전망이 나오고 있는 이유다. 이미 네덜란드 언론에서도 판 마르바이크 감독이 한국와의 협상이 진행중이라는 보도가 나온 만큼 대한축구협회가 판 마르바이크 감독에게 관심을 보이고 있다는 사실은 더 이상 비밀이 아니다. 7일 열리는 브리핑을 통해 한국 축구대표팀 차기 감독의 윤곽이 드러날지 기대된다.";

	for(i=0; i<str_content.GetLength(); i++)
	{
		str_content.GetCharAt(i, tmp_char);
		tmp_str.Append(tmp_char);
		if(tmp_char == ' ' && (i+1) < str_content.GetLength())
		{
			str_content.GetCharAt(i+1,tmp_char);
			if(tmp_char != ' ')
			{
				font.GetTextExtent(tmp_str, tmp_str.GetLength(), tmp_dim);
				arr_text_element.Add(new String(tmp_str));

				if(current_x + tmp_dim.width > 650)
				{
					current_x = 70;
					current_y += (STRIATION_SPACING);
				}
				arr_text_element_highlight.Add(new Boolean(false));
				arr_text_element_rect.Add(new Rectangle(current_x, current_y, tmp_dim.width ,STRIATION_SPACING));
				current_x += tmp_dim.width;
				tmp_str.Clear();
			}
		}
		else if(i == str_content.GetLength()-1)
		{
			font.GetTextExtent(tmp_str, tmp_str.GetLength(), tmp_dim);
			arr_text_element.Add(new String(tmp_str));

			if(current_x + tmp_dim.width > 650)
			{
				current_x = 70;
				current_y += (STRIATION_SPACING);
			}
			arr_text_element_highlight.Add(new Boolean(false));
			arr_text_element_rect.Add(new Rectangle(current_x, current_y, tmp_dim.width ,STRIATION_SPACING));
			//this->SetBounds(30, 377, this->GetWidth()-60, + current_y+STRIATION_SPACING);

			current_x += tmp_dim.width;
			tmp_str.Clear();
		}
	}

	this->AddTouchEventListener(*this);
	this->AddScrollEventListener(*this);

	this->Show();

	return true;
}