Example #1
0
void UITextEntry::SetMaxLength(int l){
  max_length = l;
  if(max_length != -1){
    text = text.substr(0,max_length);
    UpdateText();
  }
}
C4UpdateDlg::C4UpdateDlg() : C4GUI::InfoDialog(LoadResStr("IDS_TYPE_UPDATE"), 10)
{
	// initial text update
	UpdateText();
	// assume update running
	UpdateRunning = true;
}
Example #3
0
void CSpinBox::SetRange(qint64 min, qint64 max) {
    min_value = min;
    max_value = max;

    SetValue(value);
    UpdateText();
}
Example #4
0
void CSpinBox::stepBy(int steps) {
    auto new_value = value;
    // Scale number of steps by the currently selected digit
    // TODO: Move this code elsewhere and enable it.
    // TODO: Support for num_digits==0, too
    // TODO: Support base!=16, too
    // TODO: Make the cursor not jump back to the end of the line...
    /*if (base == 16 && num_digits > 0) {
        int digit = num_digits - (lineEdit()->cursorPosition() - prefix.length()) - 1;
        digit = std::max(0, std::min(digit, num_digits - 1));
        steps <<= digit * 4;
    }*/

    // Increment "new_value" by "steps", and perform annoying overflow checks, too.
    if (steps < 0 && new_value + steps > new_value) {
        new_value = std::numeric_limits<qint64>::min();
    } else if (steps > 0 && new_value + steps < new_value) {
        new_value = std::numeric_limits<qint64>::max();
    } else {
        new_value += steps;
    }

    SetValue(new_value);
    UpdateText();
}
Example #5
0
MultimediaWidget::MultimediaWidget(QWidget *parent) : QWidget(parent), ui(new Ui::MultimediaWidget){
  ui->setupUi(this); //load the designer file

  //Add in the special QMultimediaWidgets
  mediaObj = new QMediaPlayer(this);
    mediaObj->setVolume(100);
    mediaObj->setNotifyInterval(500); //only every 1/2 second update
  videoDisplay = new QVideoWidget(this);
    videoDisplay->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    ui->videoLayout->addWidget(videoDisplay);
    mediaObj->setVideoOutput(videoDisplay);
    videoDisplay->setVisible(false);

  UpdateIcons();
  UpdateText();

  //Connect the special signals/slots for the media object
  connect(mediaObj, SIGNAL(durationChanged(qint64)), this, SLOT(playerDurationChanged(qint64)) );
  connect(mediaObj, SIGNAL(seekableChanged(bool)), ui->playerSlider, SLOT(setEnabled(bool)) );
  connect(mediaObj, SIGNAL(mediaStatusChanged(QMediaPlayer::MediaStatus)), this, SLOT(playerStatusChanged(QMediaPlayer::MediaStatus)) );
  connect(mediaObj, SIGNAL(positionChanged(qint64)), this, SLOT(playerTimeChanged(qint64)) );
  connect(mediaObj, SIGNAL(stateChanged(QMediaPlayer::State)), this, SLOT(playerStateChanged(QMediaPlayer::State)) );
  connect(mediaObj, SIGNAL(videoAvailableChanged(bool)), this, SLOT(playerVideoAvailable(bool)) );
  connect(mediaObj, SIGNAL(error(QMediaPlayer::Error)), this, SLOT(playerError()) );

  //Disable some of the initial states
  ui->tool_player_stop->setEnabled(false); //nothing to stop yet
  ui->tool_player_pause->setVisible(false); //nothing to pause yet
  ui->playerSlider->setEnabled(false); //nothing to seek yet
}
Example #6
0
void CGUIEditControl::OnSMSCharacter(unsigned int key)
{
  assert(key < 10);
  if (m_smsTimer.IsRunning())
  {
    // we're already entering an SMS character
    if (key != m_smsLastKey || m_smsTimer.GetElapsedMilliseconds() > smsDelay)
    { // a different key was clicked than last time, or we have timed out
      m_smsLastKey = key;
      m_smsKeyIndex = 0;
    }
    else
    { // same key as last time within the appropriate time period
      m_smsKeyIndex++;
      if (m_cursorPos)
        m_text2.erase(--m_cursorPos, 1);
    }
  }
  else
  { // key is pressed for the first time
    m_smsLastKey = key;
    m_smsKeyIndex = 0;
  }

  m_smsKeyIndex = m_smsKeyIndex % strlen(smsLetters[key]);

  m_text2.insert(m_text2.begin() + m_cursorPos++, smsLetters[key][m_smsKeyIndex]);
  UpdateText();
  m_smsTimer.StartZero();
}
	void CDateTimeUI::SetTimeStyle()
	{
		m_nDTUpdateFlag = DT_UPDATE;
		m_dwStyle = DTS_TIMEFORMAT;
		UpdateText();
		Invalidate();
	}
void CIMoteTerminal::BufferAppend(char * y){
	size_t len = strlen(y);
	for(size_t i = 0; i < len; i++)
		BufferAppend(y[i], false);
	ScrollToBottom();
	UpdateText();
}
Example #9
0
void ToyGrid::UpdateMode()
{
	for(WIDGET_LIST::const_iterator i=m_List.begin(); i!=m_List.end(); i++)
		(*i)->SetMode(m_Mode);
	
	switch( m_Mode )
	{
		case ToyWidget::MODE_DEFAULT:
			CloseEditPanel();
			break;
			
		case ToyWidget::MODE_EDIT:
			{
				CreateEditPanel();

				if( m_EditPanel )
				{
					QWidget *pParent = parentWidget();
					if( pParent )
						m_EditPanel->move( mapToGlobal(QPoint(width(),0)) );
					else
						m_EditPanel->move(frameGeometry().topRight() + QPoint(1,0));
					m_EditPanel->show();
					ClipToScreen( *m_EditPanel );
				}
			}
			break;
	}

	UpdateText();
}
	void CDateTimeUI::SetTime(SYSTEMTIME* pst)
	{
		m_sysTime = *pst;
		m_nDTUpdateFlag = DT_UPDATE;
		UpdateText();
		Invalidate();
	}
Example #11
0
void WIDGET_SLIDER::UpdateOptions(
	SCENENODE & scene,
	bool save_to_options,
	std::map<std::string, GUIOPTION> & optionmap,
	std::ostream & error_output)
{
	if (setting.empty()) return;

	if (save_to_options)
	{
		std::stringstream s;
		s << current;
		optionmap[setting].SetCurrentValue(s.str());
		//std::cout << "Saving option value to: " << current << " | " << s.str() << std::endl;
	}
	else
	{
		std::string currentsetting = optionmap[setting].GetCurrentStorageValue();
		if (!currentsetting.empty())
		{
			std::stringstream s(currentsetting);
			s >> current;
			float coeff = (current-min)/(max-min);
			cursor.SetToBillboard(corner1[0]+coeff*(corner2[0]-corner1[0]), corner1[1], w, h);
			UpdateText(scene);
			SendMessage(scene, currentsetting);
			//std::cout << "Loading option value for " << setting << ": " << current << " | " << currentsetting << std::endl;
		}
	}
Example #12
0
bool WIDGET_SLIDER::ProcessInput(SCENENODE & scene, float cursorx, float cursory, bool cursordown, bool cursorjustup)
{
	if (cursorx < corner2[0] + w * 0.5 &&
		cursorx > corner1[0] - w * 0.5 &&
		cursory < corner2[1] &&
		cursory > corner1[1])
	{
		if (cursordown)
		{
			float coeff = (cursorx - corner1[0]) / (corner2[0] - corner1[0]);
			if (coeff < 0) coeff = 0;
			else if (coeff > 1.0) coeff = 1.0;
			//std::cout << coeff << std::endl;
			current = coeff * (max - min) + min;
			float x = corner1[0] + coeff * (corner2[0] - corner1[0]);
			float y = corner1[1];
			cursor.SetToBillboard(x, y, w, h);

			UpdateText(scene);

			std::stringstream s;
			s << current;
			SendMessage(scene, s.str());
		}

		return true;
	}

	return false;
}
Example #13
0
void Text::OnResize(const IntVector2& newSize, const IntVector2& delta)
{
    if (wordWrap_)
        UpdateText(true);
    else
        charLocationsDirty_ = true;
}
Example #14
0
void Text::OnResize()
{
    if (wordWrap_)
        UpdateText(true);
    else
        charLocationsDirty_ = true;
}
	void CDateTimeUI::SetShortCenturDataStyle()
	{
		m_nDTUpdateFlag = DT_UPDATE;
		m_dwStyle = DTS_SHORTDATECENTURYFORMAT;
		UpdateText();
		Invalidate();
	}
Example #16
0
void C4StartupNetListEntry::SetRefQuery(const char *szAddress, enum QueryType eQueryType)
{
	// safety: clear previous
	ClearRef();
	// setup layout
	const_cast<C4Facet &>(reinterpret_cast<const C4Facet &>(pIcon->GetFacet()))
	  = (const C4Facet &) C4Startup::Get()->Graphics.fctNetGetRef;
	pIcon->SetAnimated(true, 1);
	pIcon->SetBounds(rctIconLarge);
	// init a new ref client to query
	sRefClientAddress.Copy(szAddress);
	this->eQueryType = eQueryType;
	pRefClient = new C4Network2RefClient();
	if (!pRefClient->Init() || !pRefClient->SetServer(szAddress))
	{
		// should not happen
		sInfoText[0].Clear();
		SetError(pRefClient->GetError(), TT_RefReqWait);
		return;
	}
	// set info
	sInfoText[0].Format(LoadResStr("IDS_NET_CLIENTONNET"), GetQueryTypeName(eQueryType), pRefClient->getServerName());
	sInfoText[1].Copy(LoadResStr("IDS_NET_INFOQUERY"));
	UpdateSmallState(); UpdateText();
	pRefClient->SetNotify(&Application.InteractiveThread);
	// masterserver: always on top
	if (eQueryType == NRQT_Masterserver)
		iSortOrder = 100;
	// register proc
	C4InteractiveThread &Thread = Application.InteractiveThread;
	Thread.AddProc(pRefClient);
	// start querying!
	QueryReferences();
}
Example #17
0
void Textbox::OnCreate()
{
    myTexture = Scene.Get()->GetAssetManager()->CreateFromMemory<Texture>("");
    UpdateText();
    SetTexture(myTexture);
    GUISprite::OnCreate();
}
Example #18
0
void AISTargetAlertDialog::CreateControls()
{
    wxBoxSizer* topSizer = new wxBoxSizer( wxVERTICAL );
    SetSizer( topSizer );

    m_pAlertTextCtl = new wxHtmlWindow( this, wxID_ANY, wxDefaultPosition, wxDefaultSize,
            wxHW_SCROLLBAR_AUTO );
    m_pAlertTextCtl->SetBorders( 5 );

    topSizer->Add( m_pAlertTextCtl, 1, wxALIGN_CENTER_HORIZONTAL | wxALL | wxEXPAND, 5 );

    // A horizontal box sizer to contain Ack
    wxBoxSizer* AckBox = new wxBoxSizer( wxHORIZONTAL );
    topSizer->Add( AckBox, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 5 );

    // The Silence button
    wxButton* silence = new wxButton( this, ID_SILENCE, _( "&Silence Alert" ), wxDefaultPosition,
            wxDefaultSize, 0 );
    AckBox->Add( silence, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );

    // The Ack button
    wxButton* ack = new wxButton( this, ID_ACKNOWLEDGE, _( "&Acknowledge" ), wxDefaultPosition,
            wxDefaultSize, 0 );
    AckBox->Add( ack, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );

    if( m_bjumpto ) {
        wxButton* jumpto = new wxButton( this, ID_JUMPTO, _( "&Jump To" ), wxDefaultPosition,
                wxDefaultSize, 0 );
        AckBox->Add( jumpto, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
    }

    UpdateText();
}
Example #19
0
void Ambix_binauralAudioProcessorEditor::changeListenerCallback (ChangeBroadcaster *source)
{
    UpdateText();
    DrawMeters();
    repaint();
    startTimer(100);
}
//=============================================================================
CXProgressWnd& CXProgressWnd::Show()  
//=============================================================================
{ 
	if (IsWindow(m_hWnd))
	{
		CDC *pDC = GetDC();
		ModifyStyle(0, WS_VISIBLE);
		ShowWindow(SW_SHOW);
		UpdateText(pDC, m_strText, m_TextRect);
		if (IsWindow(m_avi.m_hWnd))
			m_avi.ShowWindow(SW_SHOW);
// start modified code: added to allow dialog with only a message
		if (m_bEnableCancel)
// end modified code
			m_CancelButton.ShowWindow(SW_SHOW);
		if (m_bFirstTime)
		{
			RedrawWindow(NULL, NULL, RDW_ERASE|RDW_FRAME|RDW_INVALIDATE|RDW_UPDATENOW);
			m_dwStartProgressTicks = GetTickCount();
			m_bFirstTime = FALSE;
		}
		else if (m_bTimeLeft)
		{
			UpdateTimeLeft(pDC);
		}
		ReleaseDC(pDC);
	}
	return *this;
}
Example #21
0
    // Set the current field to its minimal or maximal value.
    void ResetCurrentField(Direction dir)
    {
        switch ( m_currentField )
        {
            case Field_Hour:
            case Field_AMPM:
                // In 12-hour mode setting the hour to the minimal value
                // also changes the suffix to AM and, correspondingly,
                // setting it to the maximal one changes the suffix to PM.
                // And, for consistency with the native MSW behaviour, we
                // also do the same thing when changing AM/PM field itself,
                // so change hours in any case.
                m_time.SetHour(dir == Dir_Down ? 0 : 23);
                break;

            case Field_Min:
                m_time.SetMinute(dir == Dir_Down ? 0 : 59);
                break;

            case Field_Sec:
                m_time.SetSecond(dir == Dir_Down ? 0 : 59);
                break;

            case Field_Max:
                wxFAIL_MSG( "Invalid field" );
                return;
        }

        UpdateText();
    }
void
VisitPointTool::UpdateTool()
{
    hotPoints[0].pt = avtVector((double*)Interface.GetPoint());

    if (proxy.GetFullFrameMode())
    {
        // 
        // Translate the hotPoints so they appear in the correct position
        // in full-frame mode. 
        // 
        double scale;
        int type;
        proxy.GetScaleFactorAndType(scale, type);
        if (type == 0 ) // x_axis
            hotPoints[0].pt.x *= scale;
        else            // x_axis
            hotPoints[0].pt.y *= scale;
    }
    double axisscale[3];
    if (proxy.Get3DAxisScalingFactors(axisscale))
    {
        hotPoints[0].pt.x *= axisscale[0];
        hotPoints[0].pt.y *= axisscale[1];
        hotPoints[0].pt.z *= axisscale[2];
    }

    UpdateSphere();
    UpdateText();
}
Example #23
0
    // Decrement or increment the value of the current field (wrapping if
    // necessary).
    void ChangeCurrentFieldBy1(Direction dir)
    {
        switch ( m_currentField )
        {
            case Field_Hour:
                m_time.SetHour((m_time.GetHour() + 24 + dir) % 24);
                break;

            case Field_Min:
                m_time.SetMinute((m_time.GetMinute() + 60 + dir) % 60);
                break;

            case Field_Sec:
                m_time.SetSecond((m_time.GetSecond() + 60 + dir) % 60);
                break;

            case Field_AMPM:
                m_time.SetHour((m_time.GetHour() + 12) % 24);
                break;

            case Field_Max:
                wxFAIL_MSG( "Invalid field" );
                return;
        }

        UpdateText();
    }
Example #24
0
void VoxCad::SetupPhysicsWindow(void)
{
	PhysicsDockWidget = new QDockWidget(this);
	PhysicsDockWidget->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
	PhysicsDlg = new Dlg_Physics(&MainSim, PhysicsDockWidget);
	PhysicsDockWidget->setWidget(PhysicsDlg);
    PhysicsDockWidget->setWindowTitle("Physics Settings");
	PhysicsDockWidget->setVisible(false);


	connect(PhysicsDockWidget->toggleViewAction(), SIGNAL(triggered(bool)), this, SLOT(PhysicsMode(bool)));
	connect(&MainSim, SIGNAL(UpdateText(QString)), PhysicsDlg, SLOT(SetStatusText(QString)));
	connect(&MainSim, SIGNAL(ReqGLUpdate()), this, SLOT(ReqGLUpdateAll()));
	connect(&MainSim, SIGNAL(ReqAddPlotPoint(double)), PhysicsDlg, SLOT(AddPlotPoint(double)), Qt::DirectConnection); 

	connect(&MainSim, SIGNAL(StartExternalGLUpdate()), GLWindow, SLOT(StartAutoRedraw()));
	connect(&MainSim, SIGNAL(StopExternalGLUpdate()), GLWindow, SLOT(StopAutoRedraw()));


	//connect(FEAInfoDlg, SIGNAL(RequestUpdateGL()), this, SLOT(ReqGLUpdateAll()));
	//connect(FEAInfoDlg, SIGNAL(GetCurIndex(int*)), this, SLOT(GetCurGLSelected(int*)));
	//connect(FEAInfoDlg, SIGNAL(GetFEAInfoString(QString*)), &MainFEA, SLOT(GetFEAInfoString(QString*)));
	//connect(FEAInfoDlg, SIGNAL(GetFEAInfoString(int, QString*)), &MainFEA, SLOT(GetFEAInfoString(int, QString*)));
	//connect(FEAInfoDlg, SIGNAL(DoneAnalyzing()), this, SLOT(ForceViewMode(void))); 

	addDockWidget(Qt::RightDockWidgetArea, PhysicsDockWidget);
}
Example #25
0
long CScrollBufL1::FillInData(char *szText, ETextType eTextType, int nLen)
{
    int nInsertionCol;
    char szTab[] = "                              ";
    Enter();
    if (m_nBrokenEscLen > 0)
    {
        szText = m_szEscCode;
    }
    switch (eTextType)
    {
    case LINEBUF_BEEP:
        MessageBeep(-1);
        break;
    case LINEBUF_TAB:
        nInsertionCol = (m_pL2->GetInsertionCol() & 7);
        nInsertionCol = ((nInsertionCol + 8) & (~7)) - nInsertionCol;
        UpdateText(szTab, nInsertionCol);
        break;
    case LINEBUF_BACKSPACE:
        m_pL2->SetInsertionCol(m_pL2->GetInsertionCol() - 1);
        break;
    case LINEBUF_CARRIAGE_RETURN:
        m_pL2->SetInsertionCol(0);
        break;
    case LINEBUF_NEWLINE:
        m_pL2->InsertNewline();
        break;
    case LINEBUF_TEXT:
        UpdateText(szText, nLen);
        break;
    case LINEBUF_ESCAPE_BRACKET:
        if (m_nEmulation == SCROLLBUFF_CFG_EMM_EMMULATE)
        {
            ProcessEscape(szText, nLen);
        }
        break;
    case LINEBUF_ESCAPE_BARE:
        if (m_nEmulation == SCROLLBUFF_CFG_EMM_EMMULATE)
        {
            ProcessBareEscape(szText, nLen);
        }
        break;
    }
    Exit();
    return 0;
}
Example #26
0
void Text::HandleChangeLanguage(StringHash eventType, VariantMap& eventData)
{
    auto* l10n = GetSubsystem<Localization>();
    text_ = l10n->Get(stringId_);
    DecodeToUnicode();
    ValidateSelection();
    UpdateText();
}
Example #27
0
void Text::SetWordwrap(bool enable)
{
    if (enable != wordWrap_)
    {
        wordWrap_ = enable;
        UpdateText();
    }
}
Example #28
0
void Text::SetRowSpacing(float spacing)
{
    if (spacing != rowSpacing_)
    {
        rowSpacing_ = Max(spacing, MIN_ROW_SPACING);
        UpdateText();
    }
}
Example #29
0
	PopupMultiChoice(int *value, const std::string &text, const char **choices, int minVal, int numChoices,
		I18NCategory *category, ScreenManager *screenManager, LayoutParams *layoutParams = 0)
		: Choice(text, "", false, layoutParams), value_(value), choices_(choices), minVal_(minVal), numChoices_(numChoices), 
		category_(category), screenManager_(screenManager) {
		if (*value < minVal) *value = minVal;
		OnClick.Handle(this, &PopupMultiChoice::HandleClick);
		UpdateText();
	}
void CWinHotkeyCtrl::SetWinHotkey(UINT vkCode, UINT fModifiers)
{
	m_vkCode = m_vkCode_def = vkCode;
	m_fModSet = m_fModSet_def = m_fModRel = fModifiers;
	m_fIsPressed = FALSE;

	UpdateText();
}