示例#1
0
文件: ide.cpp 项目: kolyden/mirror
void Ide::MakeIcon() {
#ifdef PLATFORM_WIN32
	String mp = main;
	Image li = IdeImg::PackageLarge();
	if(!IsNull(mp))
	{
		Size isz = li.GetSize();
		ImageDraw idraw(isz);
		Draw& mdraw = idraw.Alpha();
		idraw.DrawImage(0, 0, li);
		mdraw.DrawImage(0, 0, li, White);
		Font font = StdFont(9);
		Size sz = GetTextSize(mp, font);
		sz.cx = min(sz.cx + 4, isz.cx);
		sz.cy += 2;
		int x = (isz.cx - sz.cx) / 2;
		int y = isz.cy - sz.cy;
		idraw.DrawRect(x, y, sz.cx, sz.cy, White);
		mdraw.DrawRect(x, y, sz.cx, sz.cy, White);
		idraw.DrawText(x + 2, y + 1, mp, font, Black);
		DrawFrame(idraw, x, y, sz.cx, sz.cy, LtBlue);
		li = idraw;
	}
	LargeIcon(li);
#endif
}
示例#2
0
void KasAboutDialog::addDemoBar()
{
   TQHBox *box = new TQHBox( this );

   box->setLineWidth(2);
   box->setFrameStyle( TQFrame::Panel | TQFrame::Sunken );

   box->setSpacing( spacingHint() );
   box->setMargin( marginHint() );

   KasBar *bar = new KasBar( Qt::Horizontal, box );
   bar->setItemSize( KasBar::Large );
   bar->setMasked( false );

   KasItem *ci = new KasItem( bar );
   ci->setIcon( LargeIcon( "icons" ) );
   bar->append( ci );

   KasPopup *pop = new KasPopup( ci );
   ci->setPopup( pop );
   ci->setCustomPopup( true );
   connect( ci, TQT_SIGNAL(leftButtonClicked(TQMouseEvent *)), ci, TQT_SLOT(togglePopup()) );

   KasBar *groupbar = bar->createChildBar( ( bar->orientation() == Qt::Horizontal ) ? Qt::Vertical : Qt::Horizontal, pop );
   KasItem *i = 0;

   KasClockItem *clk = new KasClockItem( groupbar );
   groupbar->append( clk );

   i = new KasLoadItem( groupbar );
   groupbar->append( i );

   groupbar->addTestItems();

   pop->resize( groupbar->size() );

   bar->setFixedSize( bar->itemExtent(), bar->itemExtent() );
   addWidgetBelowList( box );
}