void QgsTabWidget::setTabVisible( QWidget *tab, bool visible )
{
  if ( visible )
    showTab( tab );
  else
    hideTab( tab );
}
Exemple #2
0
void HistoryDlg::OnSelchangeTab(NMHDR *pNMHDR, LRESULT *pResult)
{
    *pResult = 0;

    xpr_sint_t nIndex = mTabCtrl.GetCurSel();
    showTab(nIndex);
}
Exemple #3
0
void CallWindow::showTab(size_t tabId)
{
	if (hasTab(tabId))
	{
		showTab(tabMap[tabId]);
	}
}
bool Panel::onTabClose( TabPtr tab )
{
	bool doClose = false;

	int cnt = Manager::instance().dock()->getContentCount( tab->getContent()->getContentID() );
	ASSERT( cnt != 0 );

	Content::OnCloseAction response = tab->getContent()->onClose( (cnt == 1) );
	if ( response == Content::CONTENT_KEEP )
	{
		doClose = false;
	}
	else if ( response == Content::CONTENT_HIDE )
	{
		showTab( tab, false );
		doClose = true;
	}
	else if ( response == Content::CONTENT_DESTROY )
	{
		detachTab( tab );
		doClose = true;
	}
	else
		ASSERT( 0 );

	return doClose;
}
Exemple #5
0
int main() {

    bool sair;
    sair = false;
    while (!sair) {

        /* Variaveis! */

        int optEsc, numJog, tabP[9], player, aux;
        numJog = 0;
        tabP[1] = 0;
        tabP[2] = 0;
        tabP[3] = 0;
        tabP[4] = 0;
        tabP[5] = 0;
        tabP[6] = 0;
        tabP[7] = 0;
        tabP[8] = 0;
        tabP[9] = 0;

        /* Sessao de boas vindas! Eeeee! */

        cout << endl << endl << endl << endl;
        cout << "      Bem vindo ao TicTacToe!";
        cout << endl << endl;
        cout << "  1 - Jogar" << endl;
        cout << "  0 - Sair" << endl << endl;
        cout << "Sua escolha: ";
        cin >> optEsc;

        /* Lugar da jogatina */

        switch (optEsc) {
            case 1: //Caso o usuario escolha jogar
                while (checkWinner(tabP[1], tabP[2], tabP[3], tabP[4], tabP[5], tabP[6], tabP[7], tabP[8], tabP[9])) {
                    numJog++;
                    aux = numJog % 2;
                    if (aux = 1)
                        player = 1;
                    else if (aux = 0)
                        player = 2;
                    cout << endl << endl;
                    showTabIns();
                    cout << endl;
                    showTab(tabP[1], tabP[2], tabP[3], tabP[4], tabP[5], tabP[6], tabP[7], tabP[8], tabP[9]);
                    cout << endl << "Player " << player << ": ";
                    cin >> optEsc;
                }
                break;

            case 2: //Caso ele queira virar presunto
                sair = true;
                break;
        }
    }
    cout << endl << "Bye";
    return EXIT_SUCCESS;
}
bool QTabDialog::qt_invoke( int _id, QUObject* _o )
{
    switch ( _id - staticMetaObject()->slotOffset() ) {
    case 0: showTab((int)static_QUType_int.get(_o+1)); break;
    default:
	return QDialog::qt_invoke( _id, _o );
    }
    return TRUE;
}
Exemple #7
0
void
TabsView::itemClicked( const QModelIndex &index )
{
    const QStandardItemModel *itemModel = static_cast<QStandardItemModel*>( m_treeView->model() );

    QStandardItem *item = itemModel->itemFromIndex( index );
    TabsItem *tab = dynamic_cast<TabsItem*>( item );
    if( tab )
        showTab( tab );
}
void ViewController::showAndOpenCallTab(size_t tabId)
{
	auto curWindow = getCurrentWindowOfTab(tabId);
	if (!curWindow->hasTab(tabId))
	{
		moveCallTabToWindow(tabId, 0);
		curWindow = mainWindow;
	}
	curWindow->showTab(tabId);
}
bool QTabWidget::qt_invoke( int _id, QUObject* _o )
{
    switch ( _id - staticMetaObject()->slotOffset() ) {
    case 0: setCurrentPage((int)static_QUType_int.get(_o+1)); break;
    case 1: showPage((QWidget*)static_QUType_ptr.get(_o+1)); break;
    case 2: removePage((QWidget*)static_QUType_ptr.get(_o+1)); break;
    case 3: showTab((int)static_QUType_int.get(_o+1)); break;
    default:
	return QWidget::qt_invoke( _id, _o );
    }
    return TRUE;
}
void Panel::showTab( const std::string contentID, bool show )
{
	for( TabItr i = tabList_.begin(); i != tabList_.end(); ++i )
	{
		if ( tabContains( *i, contentID ) )
		{
			showTab( *i, show );
			Content* tcontent = (*i)->getContent().getObject();
			if ( tcontent && tcontent->getContentID() == ContentContainer::contentID )
				((ContentContainer*)tcontent)->currentContent( contentID );
		}
	}
}
Exemple #11
0
xpr_bool_t HistoryDlg::PreTranslateMessage(MSG* pMsg)
{
    if (pMsg->hwnd == mTreeCtrl.m_hWnd && pMsg->message == WM_KEYDOWN)
    {
        if (pMsg->wParam == VK_F5)
        {
            showTab(mTabCtrl.GetCurSel());
            return XPR_TRUE;
        }
        else if (pMsg->wParam == VK_RETURN)
        {
            OnOK();
            return XPR_TRUE;
        }
    }

    return super::PreTranslateMessage(pMsg);
}
/*!
    Removes page \a w from this stack of widgets. Does not delete \a
    w.

    \sa addTab(), showPage(), QWidgetStack::removeWidget()
*/
void QTabWidget::removePage( QWidget * w )
{
    int id = d->stack->id( w );
    if ( id >= 0 ) {
	int oldId = d->stack->id(currentPage());
	bool fixCurrentTab = oldId == id;
	//switches to the next enabled tab
	d->tabs->setTabEnabled( id, FALSE );
	//if no next enabled page we fix the current page
	fixCurrentTab = fixCurrentTab && oldId == d->stack->id(currentPage());

	d->stack->removeWidget( w );
	d->tabs->removeTab( d->tabs->tab(id) );
	if ( fixCurrentTab )
	    showTab( d->tabs->currentTab() );
	setUpLayout();

	if ( d->tabs->count() == 0 )
	    d->stack->setFrameStyle( QFrame::NoFrame );
    }
}
//   创建所有下级对话框
void
FormDeploy::initChildDialog()
{
	//const int numbers = 7;
	//const TCHAR *idd = L"IDD_TAB_PAGE";
	//TCHAR *name = (TCHAR*)calloc(128, sizeof(TCHAR));

	HINSTANCE hInst = GetModuleHandle(NULL);
	RECT rc = {};
	GetClientRect( this->hWnd, &rc);

	//wsprintf(name, L"%s%d", idd, 0);
	hwndChild[0] = CreateDialog(hInst, MAKEINTRESOURCE(IDD_TAB_PAGE1), hWnd, HwndWndProc0);
	hwndChild[1] = CreateDialog(hInst, MAKEINTRESOURCE(IDD_TAB_PAGE2), hWnd, HwndWndProc1);
	hwndChild[2] = CreateDialog(hInst, MAKEINTRESOURCE(IDD_TAB_PAGE3), hWnd, HwndWndProc2);
	hwndChild[3] = CreateDialog(hInst, MAKEINTRESOURCE(IDD_TAB_PAGE4), hWnd, HwndWndProc3);
	hwndChild[4] = CreateDialog(hInst, MAKEINTRESOURCE(IDD_TAB_PAGE5), hWnd, HwndWndProc4);
	hwndChild[5] = CreateDialog(hInst, MAKEINTRESOURCE(IDD_TAB_PAGE6), hWnd, HwndWndProc5);
	hwndChild[6] = CreateDialog(hInst, MAKEINTRESOURCE(IDD_TAB_PAGE7), hWnd, HwndWndProc6);

	for (int i = 0 ; i < 7; i++){
		if (NULL == hwndChild[i]){
			logStr(L"生成子窗口失败。");
			break;
		}
	}

	showTab(0);

	//
	this->sm->init(hwndChild);
	this->sm->fileGet(dbHelper->getPath(L"fileSystem.properties"));
	//SettingItem *si = this->sm->findItem(L"backupPath");
	//si->toString();
	this->sm->dataSet(TRUE);
}
Exemple #14
0
xpr_bool_t HistoryDlg::OnInitDialog(void) 
{
    super::OnInitDialog();

    SetIcon(mIcon, XPR_TRUE);

    HICON sIconHandle;
    sIconHandle = AfxGetApp()->LoadIcon(MAKEINTRESOURCE(IDI_NOT));
    mTreeImgList.Create(16, 16, ILC_COLOR32 | ILC_MASK, -1, -1);
    mTreeImgList.Add(sIconHandle);
    ::DestroyIcon(sIconHandle);

    mTreeCtrl.SetImageList(&mTreeImgList, TVSIL_NORMAL);

    //-----------------------------------------------------------------------------

    if (mToolBar.Create(this) == XPR_FALSE)
    {
        XPR_TRACE(XPR_STRING_LITERAL("Failed to create toolbar\n"));
        return -1;
    }

    mToolBarImgList.Create(IDB_TB_DRIVEDLG, 16, 1, RGB(255,0,255));
    mToolBar.GetToolBarCtrl().SetImageList(&mToolBarImgList);
    mToolBar.GetToolBarCtrl().SetBitmapSize(CSize(16,16));

    mToolBar.ModifyStyle(0, TBSTYLE_LIST | TBSTYLE_FLAT);
    mToolBar.GetToolBarCtrl().SetExtendedStyle(TBSTYLE_EX_DRAWDDARROWS | TBSTYLE_EX_MIXEDBUTTONS);

    mToolBar.SetBorders(0, 0, 0, 0);

    DWORD sStyle = mToolBar.GetBarStyle();
    sStyle &= ~CBRS_BORDER_TOP;
    sStyle |= CBRS_FLYBY;
    mToolBar.SetBarStyle(sStyle);

    //-----------------------------------------------------------------------------

    TBBUTTON sTbButton = {0};
    sTbButton.idCommand = ID_HISTORY_REFRESH;
    sTbButton.iBitmap = 0;
    sTbButton.fsState = TBSTATE_ENABLED;
    sTbButton.fsStyle = TBSTYLE_BUTTON | TBSTYLE_AUTOSIZE | BTNS_SHOWTEXT;
    sTbButton.iString = mToolBar.GetToolBarCtrl().AddStrings(gApp.loadString(XPR_STRING_LITERAL("popup.history.toolbar.refresh")));

    mToolBar.GetToolBarCtrl().AddButtons(1, &sTbButton);

    //-----------------------------------------------------------------------------
    // ControlBar Reposition

    CRect sClientStartRect;
    CRect sClientNowRect;
    GetClientRect(sClientStartRect);
    RepositionBars(AFX_IDW_CONTROLBAR_FIRST, AFX_IDW_CONTROLBAR_LAST, 0, reposQuery, sClientNowRect);

    CPoint sOffsetPoint(sClientNowRect.left - sClientStartRect.left, sClientNowRect.top - sClientStartRect.top); 
    CRect sChildRect;
    CWnd *sChildWnd = GetWindow(GW_CHILD);
    while (XPR_IS_NOT_NULL(sChildWnd))
    {
        sChildWnd->GetWindowRect(sChildRect);
        ScreenToClient(sChildRect);
        sChildRect.OffsetRect(sOffsetPoint);
        sChildWnd->MoveWindow(sChildRect, XPR_FALSE);
        sChildWnd = sChildWnd->GetNextWindow();
    }
    CRect sWindowRect;
    GetWindowRect(sWindowRect);
    sWindowRect.right += sClientStartRect.Width() - sClientNowRect.Width();
    sWindowRect.bottom += sClientStartRect.Height() - sClientNowRect.Height();
    MoveWindow(sWindowRect, XPR_FALSE);

    RepositionBars(AFX_IDW_CONTROLBAR_FIRST, AFX_IDW_CONTROLBAR_LAST, 0);

    //----------------------------------------------------------------------

    if (mHistoryDispDeque.size() == 1)
    {
        mTabCtrl.ShowWindow(SW_HIDE);

        CRect sTabRect;
        mTabCtrl.GetWindowRect(&sTabRect);
        ScreenToClient(&sTabRect);

        CRect sTreeRect;
        mTreeCtrl.GetWindowRect(&sTreeRect);
        ScreenToClient(&sTreeRect);

        sTreeRect.top = sTabRect.top;
        mTreeCtrl.MoveWindow(&sTreeRect);
    }

    // CResizingDialog -------------------------------------------
    HideSizeIcon();

    //sizeNone:     Don't resize at all  
    //sizeResize:   The control will be stretched in the appropriate direction 
    //sizeRepos:    The control will be moved in the appropriate direction 
    //sizeRelative: The control will be moved proportionally in the appropriate direction 
    AddControl(IDC_HISTORY_TREE,   sizeResize, sizeResize);
    AddControl(IDC_HISTORY_STATUS, sizeResize, sizeRepos);
    //------------------------------------------------------------

    HistoryDisp *sHistoryDisp;
    HistoryDispDeque::iterator sIterator;

    sIterator = mHistoryDispDeque.begin();
    for (; sIterator != mHistoryDispDeque.end(); ++sIterator)
    {
        sHistoryDisp = *sIterator;
        if (sHistoryDisp == XPR_NULL)
            continue;

        mTabCtrl.InsertItem(mTabCtrl.GetItemCount(), sHistoryDisp->mTabText);
    }

    mTabCtrl.SetCurSel((xpr_sint_t)mCurHistoryDisp);
    showTab(mCurHistoryDisp);

    mDlgState = DlgStateManager::instance().getDlgState(XPR_STRING_LITERAL("History"));
    if (XPR_IS_NOT_NULL(mDlgState))
    {
        mDlgState->setDialog(this, XPR_TRUE);
        mDlgState->load();
    }

    return XPR_TRUE;
}
void QTabWidget::setCurrentPage( int id )
{
    d->tabs->setCurrentTab( id );
    showTab( id );
}
void QTabWidget::setCurrentPage( int index )
{
    d->tabs->setCurrentTab( d->tabs->tabAt( index ) );
    showTab( d->tabs->currentTab() );
}