コード例 #1
0
const QPixmap* QWSDefaultDecoration::pixmapFor(const QWidget* w, QWSDecoration::Region type, bool on, int& xoff, int& /*yoff*/)
{
#ifndef QT_NO_IMAGEIO_XPM

    static const char** staticMenuPixmapXPM=0;
    static const char** staticClosePixmapXPM=0;
    static const char** staticMinimizePixmapXPM=0;
    static const char** staticMaximizePixmapXPM=0;
    static const char** staticNormalizePixmapXPM=0;

    const char** xpm;

    // Why don't we just use/extend the enum type...

    if ( staticMenuPixmapXPM != (xpm=menuPixmap()) ) {
	staticMenuPixmapXPM = xpm;
	staticMenuPixmap = new QPixmap(xpm);
    }
    if ( staticClosePixmapXPM != (xpm=closePixmap()) ) {
	staticClosePixmapXPM = xpm;
	staticClosePixmap = new QPixmap(xpm);
    }
    if ( staticMinimizePixmapXPM != (xpm=minimizePixmap()) ) {
	staticMinimizePixmapXPM = xpm;
	staticMinimizePixmap = new QPixmap(xpm);
    }
    if ( staticMaximizePixmapXPM != (xpm=maximizePixmap()) ) {
	staticMaximizePixmapXPM = xpm;
	staticMaximizePixmap = new QPixmap(xpm);
    }
    if ( staticNormalizePixmapXPM != (xpm=normalizePixmap()) ) {
	staticNormalizePixmapXPM = xpm;
	staticNormalizePixmap = new QPixmap(xpm);
    }

    const QPixmap *pm = 0;

    switch (type) {
	case Menu:
	    pm = w->icon();
	    if ( !pm ) {
		xoff = 1;
		pm = staticMenuPixmap;
	    }
	    break;
	case Close:
	    pm = staticClosePixmap;
	    break;
	case Maximize:
	    if (on)
		pm = staticNormalizePixmap;
	    else
		pm = staticMaximizePixmap;
	    break;
	case Minimize:
	    pm = staticMinimizePixmap;
	    break;
	default:
	    break;
    }
    return pm;
#else
    return 0;
#endif
}
コード例 #2
0
ファイル: qteruputer.cpp プロジェクト: clach04/Aurex2
QTERuputer::QTERuputer(Frame *_frame, Directory *_sddir, Option *option, UFilerIni *ini) : QMainWindow(NULL, "Aurex"), Ruputer(_frame, _sddir, option, ini)
{
//	qteruputer=this;
//	palette = NULL;

#if 1
/* configure menu */
	openFileMenu = new QPopupMenu(this);
	menuBar()->insertItem(tr("File"), openFileMenu);

	openAction = new QAction("Open", "Open", 0, this);
	openAction->addTo(openFileMenu);
	connect(openAction, SIGNAL(activated()), this, SLOT(openFile(void)));

	connect(openFileMenu, SIGNAL(aboutToShow()), this, SLOT(pauseEmulate(void)));
	connect(openFileMenu, SIGNAL(aboutToHide()), this, SLOT(resumeEmulate(void)));

/* configure tool button */
	enterAction = new QAction("enter", "enter", 0, this);
	QPixmap enterPixmap( (const char **)enter );
	QIconSet enterIconSet( enterPixmap, QIconSet::Small );
	enterAction->setIconSet(enterIconSet);

	elAction = new QAction("el", "el", 0, this);
	QPixmap elPixmap( (const char **)el );
	QIconSet elIconSet( elPixmap , QIconSet::Small );
	elAction->setIconSet(elIconSet);

	menuAction = new QAction("menu", "menu", 0, this);
	QPixmap menuPixmap( (const char **)menu );
	QIconSet menuIconSet( menuPixmap , QIconSet::Small);
	menuAction->setIconSet(menuIconSet);

	filerAction = new QAction("filer", "filer", 0, this);
	QPixmap filerPixmap( (const char **)filer );
	QIconSet filerIconSet( filerPixmap , QIconSet::Small );
	filerAction->setIconSet(filerIconSet);


	upAction = new QAction("up", "up", 0, this);
	QPixmap upPixmap( (const char **)up_arrow_xpm );
	QIconSet upIconSet( upPixmap , QIconSet::Small );
	upAction->setIconSet(upIconSet);

	rightAction = new QAction("right", "right", 0, this);
	QPixmap rightPixmap( (const char **)right_arrow_xpm );
	QIconSet rightIconSet( rightPixmap , QIconSet::Small );
	rightAction->setIconSet(rightIconSet);

	leftAction = new QAction("left", "left", 0, this);
	QPixmap leftPixmap( (const char **)left_arrow_xpm );
	QIconSet leftIconSet( leftPixmap , QIconSet::Small );
	leftAction->setIconSet(leftIconSet);

	downAction = new QAction("down", "down", 0, this);
	QPixmap downPixmap( (const char **)down_arrow_xpm );
	QIconSet downIconSet( downPixmap , QIconSet::Small );
	downAction->setIconSet(downIconSet);

	connect(enterAction, SIGNAL(activated()), this, SLOT(pushPaletteEnter(void)));
	connect(elAction, SIGNAL(activated()), this, SLOT(pushPaletteEl(void)));
	connect(menuAction, SIGNAL(activated()), this, SLOT(pushPaletteMenu(void)));
	connect(filerAction, SIGNAL(activated()), this, SLOT(pushPaletteFiler(void)));
	connect(upAction, SIGNAL(activated()), this, SLOT(pushPaletteUp(void)));
	connect(downAction, SIGNAL(activated()), this, SLOT(pushPaletteDown(void)));
	connect(leftAction, SIGNAL(activated()), this, SLOT(pushPaletteLeft(void)));
	connect(rightAction, SIGNAL(activated()), this, SLOT(pushPaletteRight(void)));

	palette = new QToolBar(this, "Palette");
//	palette->setVerticalStretchable( true );
//	palette->setHorizontalStretchable( true );

	enterAction->addTo(palette);
	menuAction->addTo(palette);
	upAction->addTo(palette);
	downAction->addTo(palette);
	leftAction->addTo(palette);
	rightAction->addTo(palette);

	elAction->addTo(palette);
	filerAction->addTo(palette);
	setDockEnabled(palette, Bottom, true);
	moveToolBar(palette, Bottom);

	qtelcd=new QTELcd(getSystemAddress(), this, getCMLcd(), menuBar()->height(), palette->height(), palette->width());
	setSDLcd(qtelcd);
#endif
	setCaption("Aurex");
}