示例#1
0
/*#
    @method new_from_pixmap GdkCursor
    @brief Creates a new cursor from a given pixmap and mask.
    @param source the pixmap specifying the cursor (GdkPixmap).
    @param mask the pixmap specifying the mask, which must be the same size as source (GdkPixmap).
    @param fg the foreground color, used for the bits in the source which are 1 (GdkColor).
    @param bg the background color, used for the bits in the source which are 0 (GdkColor).
    @param x the horizontal offset of the 'hotspot' of the cursor.
    @param y the vertical offset of the 'hotspot' of the cursor.
    @return a new GdkCursor.

    Both the pixmap and mask must have a depth of 1 (i.e. each pixel has only 2
    values - on or off). The standard cursor size is 16 by 16 pixels. You can
    create a bitmap from inline data as in the below example.

    [...]
 */
FALCON_FUNC Cursor::new_from_pixmap( VMARG )
{
    Item* i_src = vm->param( 0 );
    Item* i_mask = vm->param( 1 );
    Item* i_fg = vm->param( 2 );
    Item* i_bg = vm->param( 3 );
    Item* i_x = vm->param( 4 );
    Item* i_y = vm->param( 5 );
#ifndef NO_PARAMETER_CHECK
    if ( !i_src || !i_src->isObject() || !IS_DERIVED( i_src, GdkPixmap )
        || !i_mask || !i_mask->isObject() || !IS_DERIVED( i_mask, GdkPixmap )
        || !i_fg || !i_fg->isObject() || !IS_DERIVED( i_fg, GdkColor )
        || !i_bg || !i_bg->isObject() || !IS_DERIVED( i_bg, GdkColor )
        || !i_x || !i_x->isInteger()
        || !i_y || !i_y->isInteger() )
        throw_inv_params( "GdkPixmap,GdkPixmap,GdkColor,GdkColor,I,I" );
#endif
    vm->retval( new Gdk::Cursor( vm->findWKI( "GdkCursor" )->asClass(),
        gdk_cursor_new_from_pixmap( GET_PIXMAP( *i_src ),
                                    GET_PIXMAP( *i_mask ),
                                    GET_COLOR( *i_fg ),
                                    GET_COLOR( *i_bg ),
                                    i_x->asInteger(),
                                    i_y->asInteger() ) ) );
}
示例#2
0
/**
 * Class constructor.
 * @param	pParent	The parent widget
 * @param	szName	The widget's name
 * @param	fl		Widget creation flags
 */
FileView::FileView(QWidget* pParent, const char* szName, Qt::WFlags fl) :
	QWidget(pParent, fl),
	m_sRoot(""),
	m_pCurrentPath(0)
{
	QWidget* pPage;

	setupUi(this);
	setObjectName(szName);

	// Set the tab widget icons
	pPage = m_pTabWidget->widget(0);
	m_pTabWidget->setTabIcon(m_pTabWidget->indexOf(pPage), GET_PIXMAP(TabFileList));
	pPage = m_pTabWidget->widget(1);
	m_pTabWidget->setTabIcon(m_pTabWidget->indexOf(pPage), GET_PIXMAP(TabFileTree));

	// Setup the default current tab at startup
	m_pTabWidget->setCurrentIndex(Config().getActiveFileWindowTab());
	connect(m_pTabWidget, SIGNAL(currentChanged(int)),
		this, SLOT(slotActiveTabChanged(int)));

	// Setup default curent path of tree view
	m_pCurrentPath = new KUrl(QDir::currentPath());

	// Setup tree view widget
	m_pModel = m_pFileTree->model();
	m_pFileTree->setEditTriggers(QAbstractItemView::NoEditTriggers);
	m_pFileTree->setRootUrl(*m_pCurrentPath);
	m_pFileTree->setCurrentUrl(*m_pCurrentPath);
	m_pFileTree->setSortingEnabled(true);
	m_pFileTree->sortByColumn(0, (Qt::SortOrder)(Config().getFileTreeSortOrder()));
	m_pFileTree->setShowHiddenFiles(Config().getShowHiddenFiles());
	m_pFileTree->setContextMenuPolicy(Qt::CustomContextMenu);

	connect(m_pFileTree->header(), SIGNAL(sortIndicatorChanged(int, Qt::SortOrder)),
		this, SLOT(slotSortOrderChanged(int, Qt::SortOrder)));
	connect(m_pFileTree, SIGNAL(customContextMenuRequested(const QPoint&)),
		this, SLOT(slotContextMenuRequest(const QPoint&)));

	// Hide all but columns <name>, <size> & <type>
	for (int i = KDirModel::Size; i < KDirModel::ColumnCount; m_pFileTree->hideColumn(i++)){}
	m_pFileTree->showColumn(KDirModel::Size);
	m_pFileTree->showColumn(KDirModel::Type);

	// Send the fileRequested() signal whenever a file is selected in either
	// the list or the tree
	connect(m_pFileList, SIGNAL(fileRequested(const QString&, uint)), this,
		SIGNAL(fileRequested(const QString&, uint)));
	connect(m_pFileTree, SIGNAL(activated(const KUrl&)), 
		this, SLOT(slotTreeItemSelected(const KUrl&)));
}
示例#3
0
/**
 * Ensures an active history page exists.
 * The active history page is the only unlocked history page. If one does not
 * exist, it is created.
 */
void QueryWidget::findHistoryPage()
{
    HistoryPage* pPage;
    int nPages, i;
    QString sTitle;

    // First check if the active history page is unlocked
    if (m_pHistPage != NULL && !m_pHistPage->isLocked())
        return;

    // Look for the first unlocked history page
    nPages = m_pQueryTabs->count();
    for (i = 0; i < nPages; i++) {
        pPage = dynamic_cast<HistoryPage*>(m_pQueryTabs->widget(i));
        if (pPage != NULL && !pPage->isLocked()) {
            m_pHistPage = pPage;
            return;
        }
    }

    // Couldn't find an unlocked query page, create a new one
    m_pHistPage = new HistoryPage(this);

    // Add the page, and set it as the current one
    m_pQueryTabs->insertTab(-1, m_pHistPage, GET_PIXMAP(TabUnlocked), "");
    setPageCaption(m_pHistPage);

    // Emit the lineRequested() signal when a query record is selected on
    // this page
    connect(m_pHistPage, SIGNAL(lineRequested(const QString&, uint)), this,
            SLOT(slotRequestLine(const QString&, uint)));
}
示例#4
0
/**
 * Locks/unlocks the give page.
 * @param	pPage	The page to lock or unlock
 * @param	bLock	true to lock the page, false to unlock it
 */
void QueryWidget::setPageLocked(QueryPageBase* pPage, bool bLock)
{
    if (!pPage->canLock())
        return;

    // Set the locking state of the current page
    pPage->setLocked(bLock);
    m_pQueryTabs->setTabIcon(m_pQueryTabs->indexOf(pPage),
                             bLock ? GET_PIXMAP(TabLocked) : GET_PIXMAP(TabUnlocked));

    // There can only be one unlocked history page. Check if a non-active
    // query page is being unlocked
    if (isHistoryPage(pPage) && (pPage != m_pHistPage)	&& !bLock) {
        // Lock the active history page (may be NULL)
        if (m_pHistPage != NULL)
            setPageLocked(m_pHistPage, true);

        // Set the unlock page as the new active history page
        m_pHistPage = (HistoryPage*)pPage;
    }
}
示例#5
0
/**
 * Creates a new query page, and adds it to the tab widget.
 * The new page is set as the current one.
 */
void QueryWidget::addQueryPage()
{
    QueryPage* pPage;
    QString sTitle;

    // Create the page
    pPage = new QueryPage(this);

    // Add the page, and set it as the current one
    m_pQueryTabs->insertTab(m_nQueryPages++, pPage, GET_PIXMAP(TabUnlocked),
                            "Query");
    setCurrentPage(pPage);

    // Emit the lineRequested() signal when a query record is selected on
    // this page
    connect(pPage, SIGNAL(lineRequested(const QString&, uint)), this,
            SLOT(slotRequestLine(const QString&, uint)));
}