示例#1
0
void Splitter::handlePainting(PaintCanvas& canvas) {
	if(hovering) {
		if(theme) {
			Rectangle rect { getClientSize() };
			// don't draw edges.
			(horizontal ? rect.pos.x : rect.pos.y) -= 2;
			(horizontal ? rect.size.x : rect.size.y) += 4;

			theme.drawBackground(canvas, WP_CAPTION, CS_ACTIVE, rect, true, canvas.getPaintRect());

		} else {
			canvas.fill(canvas.getPaintRect(), Brush(Brush::ActiveCaption));
		}

	} else {
		auto size = getClientSize();

		Pen pen { Color::predefined(COLOR_3DSHADOW) };
		auto select(canvas.select(pen));

		if(horizontal) {
			auto mid = size.y / 2;
			canvas.line(0, mid - 1, size.x, mid - 1);
			canvas.line(0, mid, size.x, mid);
		} else {
			auto mid = size.x / 2;
			canvas.line(mid - 1, 0, mid - 1, size.y);
			canvas.line(mid, 0, mid, size.y);
		}
	}
}
示例#2
0
void eTPEditDialog::init_eTPEditDialog()
{
    setText(_("Transponder Edit"));
    cmove( ePoint( 120, 150 ) );
    cresize( eSize( 460, 300 ) );
    tpWidget=new eTransponderWidget(this, 1,
                                    eTransponderWidget::deliverySatellite|
                                    eTransponderWidget::flagNoSat|
                                    eTransponderWidget::flagNoInv);
    tpWidget->resize( eSize( 460, 130 ) );
    tpWidget->load();
    tpWidget->setTransponder( tp );
    tpWidget->move( ePoint(0,-40) );
    save=new eButton( this );
    save->setText(_("save"));
    save->setShortcut("green");
    save->setShortcutPixmap("green");
    save->setHelpText(_("save changes and return"));
    save->move(ePoint( 10, getClientSize().height()-80) );
    save->resize( eSize( 220, 40 ) );
    save->loadDeco();
    CONNECT( save->selected, eTPEditDialog::savePressed );
    eStatusBar *sbar = new eStatusBar(this);
    sbar->move( ePoint( 0, getClientSize().height()-30) );
    sbar->resize( eSize( getClientSize().width(), 30 ) );
    sbar->loadDeco();
    setHelpID(63);
}
示例#3
0
void FontTypingWindow::render()
{
	getSurface()->clear(7);
	if (!fontEdit || (fontEdit->getNumChars() < 1))
		return;

	int      endPos  = strlen(typeBuffer);
	int      justify = fontEdit->getJustification();
	char    *front, *next;
	Point2I  pos(0, 0);
	RectI    rect(0, 0, getClientSize().x-1, getClientSize().y-1);

	typeBuffer[endPos]     = '_';
	typeBuffer[endPos + 1] = '\0';
	
	front = typeBuffer;

	while (*front)
	{
		// find the end of the current line
		next = front;
		while (*next != 0x0D && *next != 0x00)
			*next++;

		// line ended in a carriabe return
		if (*next == 0x0D)
		{
			*next = 0x00;
			if (justify)
			{
				// draw only the first line, otherwise the next line
				// will clobber
				GFXDrawText_r(getSurface(), fontEdit, &rect, front);
				break;
			}
			else
				GFXDrawText_p(getSurface(), fontEdit, &pos, front);
			*next = 0x0D;
			pos.y += fontEdit->getHeight() + 5;
		}
		else
		{
			// no more text, draw this and get out
			if (justify)
				GFXDrawText_r(getSurface(), fontEdit, &rect, front);
			else
				GFXDrawText_p(getSurface(), fontEdit, &pos, front);
			break;
		}

		front = next + 1;
	}
	typeBuffer[endPos] = '\0';
}
示例#4
0
    //-----------------------------------------------------------------------
    //                              l a y o u t
    //-----------------------------------------------------------------------
    void TGListBox::layout()
    {
        int     	w, h, y = 0, i = 0;

        getClientSize(w, h);
        w--;

        
        for (TGControlListItr itr = m_children.begin();itr != m_children.end(); ++itr)
        {
            TGListBoxItem* lbi = (TGListBoxItem*)(*itr);
            if( lbi->minimumWidth > (unsigned int)w)
                w = lbi->minimumWidth;
        }
        

        for (TGControlListItr itr = m_children.begin();itr != m_children.end(); ++itr)
        {
            TGListBoxItem* lbi = (TGListBoxItem*)(*itr);
            lbi->index = i++;
            lbi->setBounds(0, y, w, y + lbi->itemHeight - 1);
            y += lbi->itemHeight;
        }

        if (!m_selectedItem)
            m_selectedItem = (TGListBoxItem*)getFirstChild();

        TGScrollBox::layout();
    }
示例#5
0
enigmaCIMMI::enigmaCIMMI( eDVBCI *ci )
	:ci(ci)
{
	setText(_("Common Interface Module - mmi"));
	lText->setText(_("waiting for CI answer..."));
	int newHeight = size.height() - getClientSize().height() + lText->getExtend().height() + 10 + 20;
	resize( eSize( size.width(), newHeight ) );
}
示例#6
0
void FontEditWindow::onMouseMove(int, int y, UINT)
{
	if (grabbed == Grab_None)
		return;

	if (y < 15)
		y = 15;
	else if (y > getClientSize().y - 15)
		y = getClientSize().y - 15;

	int deltaY = (mouseDown.y - y) >> (magPosition - 2);

	switch (grabbed)
	{
		case Grab_Font_Base:
		{
			int newBaseline = baselineMouseDownY - deltaY;
			if (newBaseline != fontEdit->getBaseline())
			{
				fontEdit->setBaseline(newBaseline);
				parent->refresh();
			}
			break;
		}
		case Grab_Char_Base:
		{
			int newBaseline = baselineMouseDownY - deltaY;
			if (newBaseline != currentCharInfo->baseline)
			{
				currentCharInfo->baseline = newBaseline;
				parent->refresh();
			}
			break;
		}
		case Grab_Hot_X:
			break;
		case Grab_Hot_Y:
			break;
		case Grab_None:
//			FORWARD_WM_MOUSEMOVE( x, y, keyFlags, defWindowProc);
			break;
	}	
}
示例#7
0
int dwtMain(dwt::Application& app)
{
	auto window = new dwt::Window();
	window->create();
	window->onClosing([] { return ::PostQuitMessage(0), true; });

	auto split = window->addChild(dwt::SplitterContainer::Seed(0.3, true));

	split->addChild(dwt::Label::Seed(_T("First row")));
	split->addChild(dwt::Label::Seed(_T("Second row")));
	split->addChild(dwt::Label::Seed(_T("Third row")));

	split->resize(window->getClientSize());
	window->onSized([=](const dwt::SizedEvent&) { split->resize(window->getClientSize()); });

	app.run();

	return 0;
}
示例#8
0
void FontEditWindow::render()
{
	getSurface()->clear(7);
	if ((selectedASCII == -1) || (!fontEdit) || (fontEdit->getNumChars() < 1))
		return;

	const GFXBitmap *bitmap;
   RectI inSubRegion;

	fontEdit->getCharInfo(selectedASCII, &bitmap, &inSubRegion, &currentCharInfo);

	Point2I clientSize = getClientSize();
	Point2I scale, pos;

	int iScale       = 1 << (magPosition - 2);
	int scaledWidth  = bitmap->width*iScale;
	int scaledHeight = fontEdit->getHeight()*iScale;
	scale.x = 1 << (14 + magPosition);
	scale.y = scale.x;

	fontEdit->setScale(&scale);
	pos.x = clientSize.x/2 - scaledWidth/2;
	pos.y = clientSize.y/2 - scaledHeight/2;

	int fontBaseline = pos.y + iScale*fontEdit->getBaseline();
	int charBaseline = fontBaseline + iScale*currentCharInfo->baseline;

	fontEdit->drawChar(getSurface(), selectedASCII, &pos);
	scale.x = scale.y = 1<<16;
	fontEdit->setScale(&scale);

	if (magPosition < 2)
		return;

	// draw scaffolding
	getSurface()->drawLine2d(&Point2I(0,fontBaseline),
	                     &Point2I(clientSize.x,fontBaseline), 0);
	getSurface()->drawLine2d(&Point2I(0,charBaseline),
	                     &Point2I(clientSize.x,charBaseline), 0);
	fontBaselineRect.upperL.x = clientSize.x - 30;
	fontBaselineRect.upperL.y = fontBaseline - 4;
	fontBaselineRect.lowerR.x = clientSize.x - 21;
	fontBaselineRect.lowerR.y = fontBaseline + 4;
	charBaselineRect.upperL.x = pos.x + scaledWidth + 10;
	charBaselineRect.upperL.y = charBaseline - 4;
	charBaselineRect.lowerR.x = pos.x + scaledWidth + 19;
	charBaselineRect.lowerR.y = charBaseline + 4;
	drawShadowRect(getSurface(), &fontBaselineRect);
	drawShadowRect(getSurface(), &charBaselineRect);
}
示例#9
0
    //-----------------------------------------------------------------------
    //                      T G F i l e B r o w s e r
    //-----------------------------------------------------------------------
    TGFileBrowser::TGFileBrowser(TGString caption, TGString path)
        : TGWindow(NULL,"",caption)
    {
        int	w, h;
        TGLabel	*l;
        TGButton	*b;
        resize(500, 300);
        center();
        if(path.empty())
            path = ".";
        this->path = path;

        getClientSize(w, h);

        l = new TGLabel(this,"", "Files and directories:");
        l->setPos(5,5);

        files = new TGListBox(this);
        files->setBounds(5, l->y2 + 5, w-10, h-40);

        files->addEventHandler(TGEvent::Modified,new TGEventHandler(&TGFileBrowser::selectFileBrowserAction,this));
        l = new TGLabel(this,"", "Filename:");
        l->setPos(5, files->y2+9);

        filename = new TGEditBox(this);
        filename->setBounds(l->x2 + 5, files->y2 + 5, w-130,files->y2 + 30);
        b = new TGButton(this, "OkButton" , "Ok");
        b->setBounds(w-125, files->y2 + 5, w-70, files->y2 + 30);
        b->addEventHandler(TGEvent::MouseClicked,new TGEventHandler(&TGFileBrowser::closeFileBrowserAction,this));
        b = new TGButton(this,"CancelButton" , "Cancel");
        b->setBounds(w-65, files->y2 + 5, w-10, files->y2+30);
        b->addEventHandler(TGEvent::MouseClicked,new TGEventHandler(&TGFileBrowser::cancelFileBrowserAction,this));

        reloadFiles();

        makeExclusive();
    }