Ejemplo n.º 1
0
wxSize wxBookCtrlBase::DoGetBestSize() const
{
    wxSize bestSize;

    // iterate over all pages, get the largest width and height
    const size_t nCount = m_pages.size();
    for ( size_t nPage = 0; nPage < nCount; nPage++ )
    {
        const wxWindow * const pPage = m_pages[nPage];
        if( pPage )
        {
            wxSize childBestSize(pPage->GetBestSize());

            if ( childBestSize.x > bestSize.x )
                bestSize.x = childBestSize.x;

            if ( childBestSize.y > bestSize.y )
                bestSize.y = childBestSize.y;
        }
    }

    if (m_fitToCurrentPage && GetCurrentPage())
        bestSize = GetCurrentPage()->GetBestSize();

    // convert display area to window area, adding the size necessary for the
    // tabs
    wxSize best = CalcSizeFromPage(bestSize);
    CacheBestSize(best);
    return best;
}
Ejemplo n.º 2
0
STDAPI CCandidateWindow::SetSelection(UINT nIndex)
{
	UINT uOldPage, uNewPage;

	if(_pCandidateWindow)
	{
		return _pCandidateWindow->SetSelection(nIndex);
	}

	if(nIndex >= _uCount)
	{
		return E_INVALIDARG;
	}

	if(_ulsingle)
	{
		_Update();
	}
	else
	{
		GetCurrentPage(&uOldPage);
		_uIndex = nIndex;
		GetCurrentPage(&uNewPage);

		_dwFlags = TF_CLUIE_SELECTION;
		if(uNewPage != uOldPage)
		{
			_dwFlags |= TF_CLUIE_CURRENTPAGE;
		}

		_UpdateUIElement();
	}

	return S_OK;
}
Ejemplo n.º 3
0
void CUpdateWizard::FailedTransfer()
{
	m_inTransfer = false;

	if (!m_loaded)
		return;

	if (m_localFile != _T(""))
	{
		wxLogNull log;
		wxRemoveFile(m_localFile);
	}

	if (!m_currentPage)
		XRCCTRL(*this, "ID_FAILURE", wxStaticText)->SetLabel(_("Failed to check for newer version of FileZilla."));
	else
		XRCCTRL(*this, "ID_FAILURE", wxStaticText)->SetLabel(_("Failed to download the latest version of FileZilla."));

	((wxWizardPageSimple*)GetCurrentPage())->SetNext(m_pages[3]);
	m_pages[3]->SetPrev((wxWizardPageSimple*)GetCurrentPage());

	m_skipPageChanging = true;
	ShowPage(m_pages[3]);
	m_currentPage = 3;
	m_skipPageChanging = false;

	wxButton* pNext = wxDynamicCast(FindWindow(wxID_FORWARD), wxButton);
	pNext->Enable();
	wxButton* pPrev = wxDynamicCast(FindWindow(wxID_BACKWARD), wxButton);
	pPrev->Disable();

	XRCCTRL(*this, "ID_LOG", wxTextCtrl)->ChangeValue(m_update_log);
}
void CCandidateWindow::_NextComp()
{
	UINT uOldPage, uNewPage;

	GetCurrentPage(&uOldPage);

	if(_uIndex + 1 >= _uCount)
	{
		return;
	}

	_InvokeSfHandler(SKK_NEXT_COMP);

	candidx++;

	_uIndex++;
	GetCurrentPage(&uNewPage);

	_dwFlags = TF_CLUIE_SELECTION;
	if(uNewPage != uOldPage)
	{
		_dwFlags |= TF_CLUIE_CURRENTPAGE;
	}

	_Update();
	_UpdateUIElement();
}
void WIZARD_3DSHAPE_LIBS_DOWNLOADER::OnPageChanged( wxWizardEvent& aEvent )
{
    SetBitmap( KiBitmap( wizard_add_fplib_icon_xpm ) );
    enableNext( true );

    if( GetCurrentPage() == m_githubListDlg )
        setupGithubList();
    else if( GetCurrentPage() == m_reviewDlg )
        setupReview();
}
Ejemplo n.º 6
0
bool CGUITextBox::GetCondition(int condition, int data) const
{
  switch (condition)
  {
  case CONTAINER_HAS_NEXT:
      return (GetCurrentPage() < GetNumPages());
  case CONTAINER_HAS_PREVIOUS:
    return (GetCurrentPage() > 1);
  default:
    return false;
  }
}
void WIZARD_FPLIB_TABLE::OnPageChanged( wxWizardEvent& aEvent )
{
    SetBitmap( KiBitmap( wizard_add_fplib_icon_xpm ) );
    enableNext( true );

#ifdef BUILD_GITHUB_PLUGIN
    if( GetCurrentPage() == m_githubListDlg )
        setupGithubList();
    else
#endif
        if( GetCurrentPage() == m_fileSelectDlg )
            setupFileSelect();
        else if( GetCurrentPage() == m_reviewDlg )
            setupReview();
}
Ejemplo n.º 8
0
/***********************************************************************************
**  WebServerDialog::OnInputAction
************************************************************************************/
/*virtual*/ BOOL
WebServerDialog::OnInputAction(OpInputAction* action)
{
	switch (action->GetAction())
	{
	case OpInputAction::ACTION_GET_ACTION_STATE:
		{
			OpInputAction* child_action = action->GetChildAction();
			switch (child_action->GetAction())
			{
			case OpInputAction::ACTION_OPEN_ADVANCED_WEBSERVER_SETTINGS: // disable button after clicking it once
				{
					child_action->SetEnabled(IsFeatureSettingsPage(GetCurrentPage()));
					return TRUE;
				}
			}
		}
		break;

	case OpInputAction::ACTION_OPEN_ADVANCED_WEBSERVER_SETTINGS:
		{
			WebServerAdvancedSettingsDialog * dialog = OP_NEW(WebServerAdvancedSettingsDialog, (&m_current_settings, &m_current_settings));
			if (dialog)
			{
				OpStatus::Ignore(dialog->Init(this));
			}
			return TRUE;
		}
	}
	return FeatureDialog::OnInputAction(action);
}
Ejemplo n.º 9
0
void CItemFindDialog::OnBnClickedItemFindNextPageButton()
{
	// TODO: 여기에 컨트롤 알림 처리기 코드를 추가합니다.

	// 다음 페이지로 이동

	int			page	= GetCurrentPage();
	const int	maxPage	= max( 0, int( mPageMap.size() ) - 1 );

	if( maxPage == page )
	{
		return;
	}

	PutPage( ++page );

	if( maxPage == page )
	{
		mPageNextButton.EnableWindow( FALSE );
	}

	mPagePrevButton.EnableWindow( TRUE );

	{
		CString text;
		text.Format( _T( "%d/%d" ), page + 1, mPageMap.size() );
		mPageStatic.SetWindowText( text );
	}
}
Ejemplo n.º 10
0
void CItemFindDialog::OnBnClickedItemFindPrevPageButton()
{
	// TODO: 여기에 컨트롤 알림 처리기 코드를 추가합니다.

	// 이전 페이지로 이동

	int page = GetCurrentPage();

	if( 1 >  page )
	{
		return;
	}

	PutPage( --page );

	if( ! page )
	{
		mPagePrevButton.EnableWindow( FALSE );
	}

	mPageNextButton.EnableWindow( TRUE );

	{
		CString text;
		text.Format( _T( "%d/%d" ), page + 1, mPageMap.size() );
		mPageStatic.SetWindowText( text );
	}
}
Ejemplo n.º 11
0
void Redraw()
{
    XClearWindow(disp, win);

    MarkMargins();
    DrawPage(GetCurrentPage());
}
Ejemplo n.º 12
0
/*!
 * Remove the page transition from the stack.
 */
wxWizardPageEx* CWizardAttach::_PopPageTransition() {
    wxWizardPageEx* pPage = NULL;
    if (GetCurrentPage()) {
        if (!m_PageTransition.empty()) {
            pPage = m_PageTransition.top();

            wxLogTrace(wxT("Function Status"), wxT("CWizardAttach::_PopPageTransition -     Popping Page: '%p'"), pPage);
            m_PageTransition.pop();

            // TODO: Figure out the best way to handle the situation where the wizard has been launched with a
            //   project init file and the volunteer hits the back button on the m_ProjectPropertiesPage/
            //   m_AccountManagerPropertiesPage page.  Ideally they go back to the m_ProjectInfoPage/
            //   m_AccountManagerInfoPage page, but since the wizard launched in automatic attach mode
            //   that page isn't on the stack and the manager crashes.
            //
            //   It is probably enough to just push the correct InfoPage on the stack before launching the
            //   wizard in automatic mode.  I need to think about it some more.
            //
            if ((pPage == m_ProjectPropertiesPage) || (pPage == m_ProjectProcessingPage) ||
                (pPage == m_AccountManagerPropertiesPage) || (pPage == m_AccountManagerProcessingPage))
            {
                // We want to go back to the page before we attempted to communicate
                //   with any server.
                pPage = m_PageTransition.top();

                wxLogTrace(wxT("Function Status"), wxT("CWizardAttach::_PopPageTransition -     Popping Page: '%p'"), pPage);
                m_PageTransition.pop();

            }
            wxASSERT(pPage);
            return pPage;
        }
    }
    return NULL;
}
Ejemplo n.º 13
0
/// Handle clicks on the 'Back' or 'Next' button.
/// Normally this is done by wxWizard but the standard behaviour is to call
/// the validators of the current page no matter which button is clicked.
/// This means that the user has to enter valid data before he is able to
/// click any of the two buttons. This is undesired if the user wants to
/// go back to the previous page so this version of the event handler just
/// skips the validation of the page's data in case the back button was clicked.
///
/// \param[in] event The event generated by clicking the 'Back' or 'Next' button.
void CBOINCBaseWizard::OnBackOrNext(wxCommandEvent& event) {
    int button_id = event.GetId();
    wxASSERT_MSG((button_id == wxID_FORWARD) || (button_id == wxID_BACKWARD),
                  wxT("unknown button"));

    wxWizardPage* cur_page = GetCurrentPage();
    wxCHECK_RET(cur_page, _T("should have a valid current page"));

    // Ask the current page first: notice that we do it before calling
    // GetNext/Prev() because the data transfered from the controls of the page
    // may change the value returned by these methods.
    // Only do this in case of the next button. This differs from standard
    // wxWizard behaviour!
    if (button_id == wxID_FORWARD) {
        if ((!cur_page->Validate()) || (!cur_page->TransferDataFromWindow())) {
            // the page data is incorrect, don't do anything
            return;
        }
    }

    wxWizardPage* next_page;
    bool forward = (button_id == wxID_FORWARD);
    if (forward) {
        next_page = cur_page->GetNext();
    } else { // back
        next_page = cur_page->GetPrev();

        wxASSERT_MSG(next_page, wxT("\"<Back\" button should have been disabled"));
    }

    // just pass to the new page (or maybe not - but we don't care here)
    (void)ShowPage(next_page, forward);
}
void ConnectWizard::OnPageChanged( wxWizardEvent& event ) {
	dout << "> OnPageChanged" << std::endl;
	if( event.GetDirection() ) {
		if( GetCurrentPage()==sessionlistPage ) {
			// just in case
			dout << "stop search" << std::endl;
			d->setup.stopSearch();

			// clear host search list
			dout << "clear list" << std::endl;
			d->sessionsCritSec.Enter();
			d->hosts.clear();
			sessions->Clear();
			sessions->Refresh();
			d->sessionsCritSec.Leave();

			// start new host search
			dout << "start new search" << std::endl;
			long portNum;
			port->GetValue().ToLong( &portNum );

			bool ret = d->setup.startSearch( broadcastRadio->GetValue(),
											 hostName->GetValue().c_str(), portNum );
			if( !ret )
				derr << "Search failed. Take a look at the logs to find out why." << std::endl;
		}
	}

	dout << "< OnPageChanged" << std::endl;
}
Ejemplo n.º 15
0
LEditor* MainBook::GetActiveEditor(bool includeDetachedEditors)
{
    if(includeDetachedEditors) {
        EditorFrame::List_t::iterator iter = m_detachedEditors.begin();
        for(; iter != m_detachedEditors.end(); ++iter) {
            if((*iter)->GetEditor()->IsFocused()) {
                return (*iter)->GetEditor();
            }
        }
    }

    if(!GetCurrentPage()) {
        return NULL;
    }
    return dynamic_cast<LEditor*>(GetCurrentPage());
}
Ejemplo n.º 16
0
void
TabMenuControl::NextPage()
{
  const unsigned NumAllPages = pager.GetTabCount();
  if (NumAllPages < 2)
    return;
  SetCurrentPage((GetCurrentPage() + 1) % NumAllPages);
}
void ConnectWizard::OnNextPage( wxWizardEvent& event ) {
	dout << "> OnNextPage" << std::endl;
	if( event.GetDirection() ) {
		if( GetCurrentPage()==hostPage ) {
			wxIPV4address addr;
			if( directRadio->GetValue() && addr.Hostname( hostName->GetValue() )==false ) {
		        wxMessageBox(_T("Please enter a valid internet (IP v4) address for the hostname."), _T("Invalid hostname"),
							 wxICON_ERROR | wxOK, this);
				event.Veto();
				return;
			}
                
			if( addr.Service( port->GetValue() )==false ) {
				wxMessageBox(_T("Please enter a valid port number (between 1 and 65535)."), 
							 _T("Invalid port"),
							 wxICON_ERROR | wxOK, this);
				event.Veto();
				return;
			}
		} else
		if( GetCurrentPage()==sessionlistPage ) {
			d->setup.stopSearch();

			// session selected?
			int selected = sessions->GetSelection();
			if( selected==wxNOT_FOUND ) {
				wxMessageBox(_T("Please select the host you want to connect to."), 
							 _T("No host selected"),
							 wxICON_ERROR | wxOK, this);
				event.Veto();
				return;
			}

			// connect finally
			d->con = d->setup.connect( d->hosts[selected] );
			if( d->con.isNull() ) {
				wxMessageBox( _T(d->setup.errorMessage().c_str()),
							  _T("Connection error"),
							  wxICON_ERROR | wxOK, this);
				event.Veto();
				return;
			}
		}
	}	
	dout << "< OnNextPage" << std::endl;
}
Ejemplo n.º 18
0
void wxBookCtrlBase::OnHelp(wxHelpEvent& event)
{
    // determine where does this even originate from to avoid redirecting it
    // back to the page which generated it (resulting in an infinite loop)

    // notice that we have to check in the hard(er) way instead of just testing
    // if the event object == this because the book control can have other
    // subcontrols inside it (e.g. wxSpinButton in case of a notebook in wxUniv)
    wxWindow *source = wxStaticCast(event.GetEventObject(), wxWindow);
    while ( source && source != this && source->GetParent() != this )
    {
        source = source->GetParent();
    }

    if ( source && m_pages.Index(source) == wxNOT_FOUND )
    {
        // this event is for the book control itself, redirect it to the
        // corresponding page
        wxWindow *page = NULL;

        if ( event.GetOrigin() == wxHelpEvent::Origin_HelpButton )
        {
            // show help for the page under the mouse
            const int pagePos = HitTest(ScreenToClient(event.GetPosition()));

            if ( pagePos != wxNOT_FOUND)
            {
                page = GetPage((size_t)pagePos);
            }
        }
        else // event from keyboard or unknown source
        {
            // otherwise show the current page help
            page = GetCurrentPage();
        }

        if ( page )
        {
            // change event object to the page to avoid infinite recursion if
            // we get this event ourselves if the page doesn't handle it
            event.SetEventObject(page);

            if ( page->GetEventHandler()->ProcessEvent(event) )
            {
                // don't call event.Skip()
                return;
            }
        }
    }
    //else: event coming from one of our pages already

    event.Skip();
}
void CCandidateWindow::_NextPage()
{
	UINT uOldPage, uNewPage;

	GetCurrentPage(&uOldPage);
	uNewPage = uOldPage + 1;
	if(uNewPage >= _uPageCnt)
	{
		if(_pCandidateList != NULL)
		{
			if(_hwnd == NULL)
			{
				regwordul = TRUE;
			}

			if(!regword)
			{
				//辞書登録開始
				regword = TRUE;
				regwordtext.clear();
				regwordtextpos = 0;
				comptext.clear();
				regwordfixed = TRUE;

				_BackUpStatus();
				_ClearStatus();

				if(_pInputModeWindow != NULL)
				{
					_pInputModeWindow->_Show(TRUE);
				}
			}
			else
			{
				_CreateNext(TRUE);
			}

			_Update();
			return;
		}
	}

	_uIndex = _PageIndex[uNewPage];

	_dwFlags = TF_CLUIE_SELECTION;
	if(uNewPage != uOldPage)
	{
		_dwFlags |= TF_CLUIE_CURRENTPAGE;
	}

	_Update();
	_UpdateUIElement();
}
void CCandidateWindow::_PrevComp()
{
	UINT uOldPage, uNewPage;

	GetCurrentPage(&uOldPage);

	if(_uIndex == 0)
	{
		if(_pTextService->cx_stacompmulti && !_pTextService->cx_dyncompmulti)
		{
			_InvokeSfHandler(SKK_PREV_COMP);
			return;
		}
	}

	_InvokeSfHandler(SKK_PREV_COMP);

	if(_uIndex == 0)
	{
		candidx = (size_t)-1;
		_InitList();
		_Update();
		_UpdateUIElement();
		return;
	}

	candidx--;

	_uIndex--;
	GetCurrentPage(&uNewPage);

	_dwFlags = TF_CLUIE_SELECTION;
	if(uNewPage != uOldPage)
	{
		_dwFlags |= TF_CLUIE_CURRENTPAGE;
	}

	_Update();
	_UpdateUIElement();
}
Ejemplo n.º 21
0
void CWKSP::On_Command_UI(wxUpdateUIEvent &event)
{
	switch( event.GetId() )
	{
	default:
		if( !g_pACTIVE->Get_Active() || !g_pACTIVE->Get_Active()->On_Command_UI(event) )
		{
			m_pTools->On_Command_UI(event);
			m_pData ->On_Command_UI(event);
			m_pMaps ->On_Command_UI(event);
		}
		break;

	case ID_CMD_WKSP_ITEM_CLOSE:
		if( GetCurrentPage() )
		{
			switch( GetCurrentPage()->GetId() )
			{
			case ID_WND_WKSP_TOOLS:	m_pTools->On_Command_UI(event);	break;
			case ID_WND_WKSP_DATA :	m_pData ->On_Command_UI(event);	break;
			case ID_WND_WKSP_MAPS :	m_pMaps ->On_Command_UI(event);	break;
			}
		}
		break;

	case ID_CMD_DATA_OPEN:
		break;

	case ID_CMD_TOOLS_SEARCH:
		m_pTools->On_Command_UI(event);
		break;

	case ID_CMD_DATA_PROJECT_SAVE:
	case ID_CMD_DATA_PROJECT_SAVE_AS:
	case ID_CMD_DATA_PROJECT_COPY:
	case ID_CMD_DATA_PROJECT_COPY_DB:
		event.Enable(g_pData->Get_Count() > 0);
		break;
	}
}
void CWizardAttach::_ProcessCancelEvent( wxWizardExEvent& event ) {

    bool bCancelWithoutNextPage = false;
    wxWizardPageEx* page = GetCurrentPage();

    int iRetVal = wxGetApp().SafeMessageBox(
        _("Do you really want to cancel?"), 
        _("Question"),
        wxICON_QUESTION | wxYES_NO,
        this
    );

    // Reenable the next and back buttons if they have been disabled
    GetNextButton()->Enable();
    GetBackButton()->Enable();

    // Page specific rules - Disable the validator(s)
    if (wxYES == iRetVal) {
        if ((page == m_ProjectInfoPage) || (page == m_AccountManagerInfoPage)) {
            m_ProjectInfoPage->m_pProjectUrlCtrl->SetValidator(wxDefaultValidator);
        } else if (page == m_AccountInfoPage) {
            m_AccountInfoPage->m_pAccountEmailAddressCtrl->SetValidator(wxDefaultValidator);
            m_AccountInfoPage->m_pAccountPasswordCtrl->SetValidator(wxDefaultValidator);
            if (IsAttachToProjectWizard) {
                m_AccountInfoPage->m_pAccountConfirmPasswordCtrl->SetValidator(wxDefaultValidator);
            }
        } else if (page == m_ErrProxyPage) {
            m_ErrProxyPage->m_pProxyHTTPServerCtrl->SetValidator(wxDefaultValidator);
            m_ErrProxyPage->m_pProxyHTTPPortCtrl->SetValidator(wxDefaultValidator);
            m_ErrProxyPage->m_pProxyHTTPUsernameCtrl->SetValidator(wxDefaultValidator);
            m_ErrProxyPage->m_pProxyHTTPPasswordCtrl->SetValidator(wxDefaultValidator);
            m_ErrProxyPage->m_pProxySOCKSServerCtrl->SetValidator(wxDefaultValidator);
            m_ErrProxyPage->m_pProxySOCKSPortCtrl->SetValidator(wxDefaultValidator);
            m_ErrProxyPage->m_pProxySOCKSUsernameCtrl->SetValidator(wxDefaultValidator);
            m_ErrProxyPage->m_pProxySOCKSPasswordCtrl->SetValidator(wxDefaultValidator);
        }
    }

    // Generic rules
    bCancelWithoutNextPage |= (page == m_ErrNotDetectedPage);
    bCancelWithoutNextPage |= (page == m_ErrUnavailablePage);
    bCancelWithoutNextPage |= (page == m_ErrNoInternetConnectionPage);
    
    if (IsAttachToProjectWizard) {
        bCancelWithoutNextPage |= (page == m_ErrAlreadyExistsPage);
    } else {
        bCancelWithoutNextPage |= (page == m_WelcomePage);
    }
    if (wxYES != iRetVal) {
        event.Veto();
    }
}
Ejemplo n.º 23
0
bool
TPropertySheet::PreProcessMsg(MSG& msg) {

  // If current page = 0, then it's time to close the property sheet.
  // 
  HWND page = GetCurrentPage();
  if (!page) {
    CloseWindow();
    return false;
  } 
  else {
    return TWindow::PreProcessMsg(msg);
  }
}
Ejemplo n.º 24
0
void CWKSP::On_Command_UI(wxUpdateUIEvent &event)
{
	switch( event.GetId() )
	{
	default:
		if( !g_pACTIVE->Get_Active() || !g_pACTIVE->Get_Active()->On_Command_UI(event) )
		{
			m_pModules->On_Command_UI(event);
			m_pData   ->On_Command_UI(event);
			m_pMaps   ->On_Command_UI(event);
		}
		break;

	case ID_CMD_WKSP_ITEM_CLOSE:
		if( GetCurrentPage() )
		{
			switch( GetCurrentPage()->GetId() )
			{
			case ID_WND_WKSP_MODULES:	m_pModules->On_Command_UI(event);	break;
			case ID_WND_WKSP_DATA:		m_pData   ->On_Command_UI(event);	break;
			case ID_WND_WKSP_MAPS:		m_pMaps   ->On_Command_UI(event);	break;
			}
		}
		break;

	case ID_CMD_WKSP_OPEN:
		break;

	case ID_CMD_MODULES_SEARCH:
		m_pModules->On_Command_UI(event);
		break;

	case ID_CMD_WKSP_SAVE:
		event.Enable(g_pData->Get_Count() > 0);
		break;
	}
}
Ejemplo n.º 25
0
void CUpdateWizard::FailedChecksum()
{
	m_inTransfer = false;

	if (m_localFile == _T(""))
		return;
	else
	{
		wxLogNull log;
		wxRemoveFile(m_localFile);
	}

	wxString label = _("Checksum mismatch of downloaded file.");
	XRCCTRL(*this, "ID_FAILURE", wxStaticText)->SetLabel(label);

	XRCCTRL(*this, "ID_MISMATCH1", wxStaticText)->Show();
	XRCCTRL(*this, "ID_MISMATCH2", wxStaticText)->Show();
	XRCCTRL(*this, "ID_MISMATCH3", wxStaticText)->Show();
	XRCCTRL(*this, "ID_MISMATCH4", wxStaticText)->Show();

	((wxWizardPageSimple*)GetCurrentPage())->SetNext(m_pages[3]);
	m_pages[3]->SetPrev((wxWizardPageSimple*)GetCurrentPage());

	m_skipPageChanging = true;
	ShowPage(m_pages[3]);
	m_currentPage = 3;
	m_skipPageChanging = false;

	wxButton* pNext = wxDynamicCast(FindWindow(wxID_FORWARD), wxButton);
	pNext->Enable();
	wxButton* pPrev = wxDynamicCast(FindWindow(wxID_BACKWARD), wxButton);
	pPrev->Disable();

	XRCCTRL(*this, "ID_LOG", wxTextCtrl)->ChangeValue(m_update_log);

	RewrapPage(3);
}
Ejemplo n.º 26
0
wxSize wxBookCtrlBase::DoGetBestSize() const
{
    wxSize bestSize;

    if (m_fitToCurrentPage && GetCurrentPage())
    {
        bestSize = GetCurrentPage()->GetBestSize();
    }
    else
    {
        // iterate over all pages, get the largest width and height
        const size_t nCount = m_pages.size();
        for ( size_t nPage = 0; nPage < nCount; nPage++ )
        {
            const wxWindow * const pPage = m_pages[nPage];
            if ( pPage )
                bestSize.IncTo(pPage->GetBestSize());
        }
    }

    // convert display area to window area, adding the size necessary for the
    // tabs
    return CalcSizeFromPage(bestSize);
}
Ejemplo n.º 27
0
std::string CGUIBaseContainer::GetLabel(int info) const
{
  std::string label;
  switch (info)
  {
  case CONTAINER_NUM_PAGES:
    label = StringUtils::Format("%u", (GetRows() + m_itemsPerPage - 1) / m_itemsPerPage);
    break;
  case CONTAINER_CURRENT_PAGE:
    label = StringUtils::Format("%u", GetCurrentPage());
    break;
  case CONTAINER_POSITION:
    label = StringUtils::Format("%i", GetCursor());
    break;
  case CONTAINER_CURRENT_ITEM:
    {
      if (m_items.size() && m_items[0]->IsFileItem() && (std::static_pointer_cast<CFileItem>(m_items[0]))->IsParentFolder())
        label = StringUtils::Format("%i", GetSelectedItem());
      else
        label = StringUtils::Format("%i", GetSelectedItem() + 1);
    }
    break;
  case CONTAINER_NUM_ALL_ITEMS:
  case CONTAINER_NUM_ITEMS:
    {
      unsigned int numItems = GetNumItems();
      if (info == CONTAINER_NUM_ITEMS && numItems && m_items[0]->IsFileItem() && (std::static_pointer_cast<CFileItem>(m_items[0]))->IsParentFolder())
        label = StringUtils::Format("%u", numItems-1);
      else
        label = StringUtils::Format("%u", numItems);
    }
    break;
  case CONTAINER_NUM_NONFOLDER_ITEMS:
    {
      int numItems = 0;
      for (auto item : m_items)
      {
        if (!item->m_bIsFolder)
          numItems++;
      }
      label = StringUtils::Format("%u", numItems);
    }
    break;
  default:
    break;
  }
  return label;
}
Ejemplo n.º 28
0
std::string CGUITextBox::GetLabel(int info) const
{
  std::string label;
  switch (info)
  {
  case CONTAINER_NUM_PAGES:
    label = StringUtils::Format("%u", GetNumPages());
    break;
  case CONTAINER_CURRENT_PAGE:
    label = StringUtils::Format("%u", GetCurrentPage());
    break;
  default:
    break;
  }
  return label;
}
Ejemplo n.º 29
0
void HostWizard::OnNextPage( wxWizardEvent& event ) {
    if( event.GetDirection() )
        if( GetCurrentPage()==sessionPage ) {
            if( sessionNameEdit->GetValue().Length()==0 ) {
                wxMessageBox(_T("Please enter a session name. Empty session names are not allowed."), _T("Invalid session name"),
                             wxICON_ERROR | wxOK, this);
                event.Veto();
            } else {

                long ret;
                if( !portEdit->GetValue().ToLong( &ret ) || ret<=0 || ret>65535 ) {
                    wxMessageBox(_T("Please enter a valid port number (between 1 and 65535)."), _T("Invalid port"),
                                 wxICON_ERROR | wxOK, this);
                    event.Veto();
                }
            }
        }
}
Ejemplo n.º 30
0
DWORD STDCALL mouseRunewordsPageLeftUp(sWinMessage* msg)
{
	if (!D2isLODGame() || !D2GetResolution()) return -1;

	if (!isOnStatsPage(msg->x,msg->y)) return 1;

	if (isOnCloseBtn(msg->x,msg->y))
	{
		log_msg("push up left button close\n");
		if (isDownBtn.close)
			D2TogglePage(2,1,0);
	}
	else if (isOnNextPageBtn(msg->x,msg->y))
	{
		log_msg("push up left button next page\n");
		if (isDownBtn.nextPage)
		{
			GoStatPage(GetCurrentPage()+1);
			log_msg("next page press\n");
		}
	}
	else if (isOnPrevRunesBtn(msg->x,msg->y))
	{
		log_msg("push up left button prev runes\n");
		if (isDownBtn.prevRunes)
		{
			if (curRunesPage) curRunesPage--;
		}
	}
	else if (isOnNextRunesBtn(msg->x,msg->y))
	{
		log_msg("push up left button next runes\n");
		if (isDownBtn.nextRunes)
		{
			if (curRunesPage < maxRunesPage) curRunesPage++;
		}
	}

	D2CleanStatMouseUp();
	freeMessage(msg);
	isDownBtn.all=0;
	return 0;
}