Exemplo n.º 1
0
void BaseWordForm::OnActionPerformed(const Osp::Ui::Control& source, int actionId)
{
	switch (actionId)
	{
	case ID_ADD_WORD:
	{
		if (__pAddWordDlg)
			delete __pAddWordDlg;

		__pAddWordDlg = new AddWord();
		__pAddWordDlg->ShowPopup(this);

		break;
	}
	case ID_MENU:
	{
		int hp = 0;
		int wp = 0;
		Header *header = GetHeader();

		if (header)
		{
			int posy = GetBounds().height - GetClientAreaBounds().height;

			Footer * footer = GetFooter();
			if (footer)
				posy -= footer->GetHeight();

			hp = (posy - 10);
			wp = header->GetWidth() - 10;
		}
		// Set the anchor position of the ContextMenu
		__pContextMenu->SetPosition(Point(wp, hp));

		// Show the ContextMenu
		__pContextMenu->SetShowState(true);
		__pContextMenu->Show();

		break;
	}
	case ID_DICTIONARY:
	{
		ShowDictionary();
		break;
	}
	case ID_MENU_INFO:
	{
		ShowInfoDlg();
		break;
	}
	}
}
Exemplo n.º 2
0
result BaseWordForm::OnDraw(void)
{
	result r = Form::OnDraw();
	Rectangle bound = GetBounds();
	Canvas * canvas = GetCanvasN(bound);

	if (!__pBGLogo)
		__pBGLogo = Utils::GetBitmapN("bg_logo.png");

	int x = bound.width / 2 - (__pBGLogo->GetWidth() / 2);
	int y = bound.height - __pBGLogo->GetHeight() - 15;

	Footer * footer = GetFooter();
	if (footer)
	{
		y -= footer->GetHeight();
	}

	canvas->DrawBitmap(Point(x, y), *__pBGLogo);

	delete canvas;

	return r;
}