~unity-team/nux/texture-atlas

« back to all changes in this revision

Viewing changes to Nux/RangeValue.cpp

  • Committer: Nicolas d'Offay
  • Date: 2012-11-16 18:23:48 UTC
  • mfrom: (682.2.25 trunk)
  • Revision ID: nicolas.doffay@canonical.com-20121116182348-ygq13lkwgbugen04
Additional work to get the texture atlas class running as a normal texture.

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
#include "HLayout.h"
26
26
#include "RangeValue.h"
27
27
 
 
28
#include <sstream>
 
29
#include <iomanip>
 
30
 
28
31
namespace nux
29
32
{
30
33
  NUX_IMPLEMENT_OBJECT_TYPE(RangeValue);
134
137
    m_ValueString->ProcessDraw(graphics_engine, force_draw);
135
138
  }
136
139
 
137
 
  void RangeValue::PostDraw(GraphicsEngine & /* graphics_engine */, bool /* force_draw */)
138
 
  {
139
 
 
140
 
  }
141
 
 
142
140
/////////////////
143
141
//  RECEIVERS  //
144
142
/////////////////
172
170
    else
173
171
      m_Value = value;
174
172
 
175
 
    m_ValueString->SetText(NString::Printf("%.3f", m_Value));
 
173
    m_ValueString->SetText(std::to_string((long double)m_Value));
176
174
    QueueDraw();
177
175
  }
178
176
 
193
191
    else
194
192
      m_Value = m_min + (m_max - m_min) * (float) x / (float) m_Percentage->GetBaseWidth();
195
193
 
196
 
    m_ValueString->SetText(NString::Printf("%.3f", m_Value));
 
194
    m_ValueString->SetText(std::to_string((long double)m_Value));
197
195
    sigValueChanged.emit(this);
198
196
    sigFloatChanged.emit(m_Value);
199
197
    sigMouseDown.emit(m_Value);
211
209
    else
212
210
      m_Value = m_min + (m_max - m_min) * (float) x / (float) m_Percentage->GetBaseWidth();
213
211
 
214
 
    m_ValueString->SetText(NString::Printf("%.3f", m_Value));
 
212
    std::stringstream s;
 
213
    s << std::setprecision(3) << m_Value;
 
214
    m_ValueString->SetText(s.str());
215
215
    sigValueChanged.emit(this);
216
216
    sigFloatChanged.emit(m_Value);
217
217
    sigMouseUp.emit(m_Value);
228
228
    else
229
229
      m_Value = m_min + (m_max - m_min) * (float) x / (float) m_Percentage->GetBaseWidth();
230
230
 
231
 
    m_ValueString->SetText(NString::Printf("%.3f", m_Value));
 
231
    std::stringstream s;
 
232
    s << std::setprecision(3) << m_Value;
 
233
    m_ValueString->SetText(s.str());
232
234
    sigValueChanged.emit(this);
233
235
    sigFloatChanged.emit(m_Value);
234
236
    sigMouseDrag.emit(m_Value);
246
248
 
247
249
  }
248
250
 
249
 
  void RangeValue::OnValidateKeyboardEntry(EditTextBox * /* textbox */, const NString &text)
 
251
  void RangeValue::OnValidateKeyboardEntry(EditTextBox* /* textbox */, const std::string &text)
250
252
  {
251
253
    float f;
252
 
    f = CharToDouble(text.GetTCharPtr());
 
254
    f = CharToDouble(text.c_str());
253
255
    SetValue(f);
254
256
    sigValueChanged.emit(this);
255
257
    sigFloatChanged.emit(m_Value);