예제 #1
0
Rect
TextPointer::GetCharacterRect (LogicalDirection dir) const
{
	RichTextBox *rtb = GetRichTextBox ();
	if (!rtb) {
		g_warning ("a TextPointer outside of a RichTextBox?  say it ain't so...");
		return Rect::ManagedEmpty;
	}

	return rtb->GetCharacterRect (this, dir);
}
예제 #2
0
void
TextSelection::ApplyPropertyValue (DependencyProperty *formatting, Value *value)
{
	RichTextBox *rtb = anchor.GetRichTextBox ();
	if (rtb == NULL) {
		g_warning ("this shouldn't happen...");
		return;
	}

	rtb->ApplyFormattingToSelection (this, formatting, value);
}
예제 #3
0
void
TextSelection::ApplyPropertyValue (DependencyProperty *formatting, Value *value)
{
    DependencyObject *el = anchor.GetParent();
    while (el) {
        if (el->Is (Type::RICHTEXTBOX))
            break;
        el = el->GetParent() ? el->GetParent()->GetParent() : NULL;
        if (!el)
            break;
    }
    if (el == NULL) {
        g_warning ("this shouldn't happen...");
        return;
    }

    RichTextBox *rtb = (RichTextBox*)el;

    rtb->ApplyFormattingToSelection (this, formatting, value);
}
RichTextBox*
FormWindow::CreateRichTextBox(const char* label_text, int ax, int ay, int aw, int ah, DWORD aid, DWORD pid, DWORD astyle)
{
	RichTextBox*   rtb    = 0;
	ActiveWindow*  parent = this;

	if (pid)
	parent = FindControl(pid);

	rtb = new(__FILE__,__LINE__) RichTextBox(parent, ax, ay, aw, ah, aid, astyle);

	if (rtb) {
		rtb->SetForm(this);
		rtb->SetText(label_text);

		if (!shown)
		rtb->Hide();
	}

	return rtb;
}
void
FormWindow::CreateDefRichText(CtrlDef& def)
{
	RichTextBox* ctrl = CreateRichTextBox(def.GetText(),
	def.GetX(),
	def.GetY(),
	def.GetW(),
	def.GetH(),
	def.GetID(),
	def.GetParentID(),
	def.GetStyle());

	ctrl->SetAltText(def.GetAltText());
	ctrl->SetBackColor(def.GetBackColor());
	ctrl->SetForeColor(def.GetForeColor());
	ctrl->SetLineHeight(def.GetLineHeight());
	ctrl->SetLeading(def.GetLeading());
	ctrl->SetScrollBarVisible(def.GetScrollBarVisible());
	ctrl->SetSmoothScroll(def.GetSmoothScroll());
	ctrl->SetTextAlign(def.GetTextAlign());
	ctrl->SetTransparent(def.GetTransparent());
	ctrl->SetHidePartial(def.GetHidePartial());

	ctrl->SetMargins(def.GetMargins());
	ctrl->SetTextInsets(def.GetTextInsets());
	ctrl->SetCellInsets(def.GetCellInsets());
	ctrl->SetCells(def.GetCells());
	ctrl->SetFixedWidth(def.GetFixedWidth());
	ctrl->SetFixedHeight(def.GetFixedHeight());

	if (def.GetTexture().length() > 0) {
		Bitmap*     ctrl_tex = 0;
		DataLoader* loader   = DataLoader::GetLoader();
		loader->SetDataPath("Screens/");
		loader->LoadTexture(def.GetTexture(), ctrl_tex);
		loader->SetDataPath("");

		ctrl->SetTexture(ctrl_tex);
	}

	Font* f = FontMgr::Find(def.GetFont());
	if (f) ctrl->SetFont(f);

	for (int i = 0; i < def.NumTabs(); i++)
	ctrl->SetTabStop(i, def.GetTab(i));
}