本文整理汇总了C++中TextInput类的典型用法代码示例。如果您正苦于以下问题:C++ TextInput类的具体用法?C++ TextInput怎么用?C++ TextInput使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TextInput类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: deserialize
void Any::deserialize(TextInput& ti) {
beforeRead();
Token token = ti.read();
deserialize(ti, token);
// Restore the last token
ti.push(token);
}
示例2: readNormal
static Vector3 readNormal(TextInput& ti, const Matrix3& normalXform) {
Vector3 n;
n.x = ti.readNumber();
n.y = ti.readNumber();
n.z = ti.readNumber();
return (normalXform * n).direction();
}
示例3:
bool GPUProgram::BindingTable::consumeSymbol(TextInput& ti, const std::string& s) {
Token t = ti.peek();
if (symbolMatch(t, s)) {
ti.readSymbol(s);
return true;
} else {
return false;
}
}
示例4: readVertex
static Vector3 readVertex(TextInput& ti, const Matrix4& xform) {
// Vertex
Vector4 v;
v.x = ti.readNumber();
v.y = ti.readNumber();
v.z = ti.readNumber();
v.w = 1.0f;
return (xform * v).xyz();
}
示例5: atClose
/** True if the next token begins the close tag */
static bool atClose(TextInput& t, const std::string name) {
if ((t.peek().type() == Token::SYMBOL) && (t.peek().string() == "<")) {
// Need to keep looking ahead
Token p0 = t.read();
if ((t.peek().type() == Token::SYMBOL) && (t.peek().string() == "/")) {
// Check the name on the close tag. It *must* match if
// this is a well-formed document, but there might be a
// tag error.
Token p1 = t.read();
Token p2 = t.peek();
std::string s = p2.string();
debugAssertM(beginsWith(name, s), "Mismatched close tag");
// Put the tokens back
t.push(p1);
t.push(p0);
return true;
} else {
// Put the read token back
t.push(p0);
return false;
}
} else {
return false;
}
}
示例6: if
void DeviceTestApp::processTap( ivec2 pos )
{
// TextInput *selectedInput = false;
if( mPlayButton.hitTest( pos ) )
audio::master()->setEnabled( ! audio::master()->isEnabled() );
else if( mRecordButton.hitTest( pos ) )
startRecording();
else if( mSamplerateInput.hitTest( pos ) ) {
}
else if( mFramesPerBlockInput.hitTest( pos ) ) {
}
else if( mNumInChannelsInput.hitTest( pos ) ) {
}
else if( mNumOutChannelsInput.hitTest( pos ) ) {
}
else if( mSendChannelInput.hitTest( pos ) ) {
}
#if defined( CINDER_COCOA_TOUCH )
TextInput *currentSelected = TextInput::getCurrentSelected();
if( currentSelected )
showKeyboard( KeyboardOptions().type( KeyboardType::NUMERICAL ).initialString( currentSelected->mInputString ) );
#endif
size_t currentTestIndex = mTestSelector.mCurrentSectionIndex;
if( mTestSelector.hitTest( pos ) && currentTestIndex != mTestSelector.mCurrentSectionIndex ) {
string currentTest = mTestSelector.currentSection();
CI_LOG_V( "selected: " << currentTest );
setupTest( currentTest );
return;
}
size_t currentOutputIndex = mOutputSelector.mCurrentSectionIndex;
if( mOutputSelector.hitTest( pos ) && currentOutputIndex != mOutputSelector.mCurrentSectionIndex ) {
auto dev = audio::Device::findDeviceByName( mOutputSelector.mSegments[mOutputSelector.mCurrentSectionIndex] );
CI_LOG_V( "selected output device named: " << dev->getName() << ", key: " << dev->getKey() );
setOutputDevice( dev );
return;
}
size_t currentInputIndex = mInputSelector.mCurrentSectionIndex;
if( mInputSelector.hitTest( pos ) && currentInputIndex != mInputSelector.mCurrentSectionIndex ) {
auto dev = audio::Device::findDeviceByName( mInputSelector.mSegments[mInputSelector.mCurrentSectionIndex] );
CI_LOG_V( "selected input named: " << dev->getName() << ", key: " << dev->getKey() );
setInputDevice( dev );
return;
}
}
示例7: keyDown
void DeviceTestApp::keyDown( KeyEvent event )
{
TextInput *currentSelected = TextInput::getCurrentSelected();
if( ! currentSelected )
return;
if( event.getCode() == KeyEvent::KEY_RETURN ) {
#if defined( CINDER_COCOA_TOUCH )
hideKeyboard();
#endif
try {
if( currentSelected == &mSamplerateInput ) {
int sr = currentSelected->getValue();
CI_LOG_V( "updating samplerate from: " << mOutputDeviceNode->getSampleRate() << " to: " << sr );
mOutputDeviceNode->getDevice()->updateFormat( audio::Device::Format().sampleRate( sr ) );
}
else if( currentSelected == &mFramesPerBlockInput ) {
int frames = currentSelected->getValue();
CI_LOG_V( "updating frames per block from: " << mOutputDeviceNode->getFramesPerBlock() << " to: " << frames );
mOutputDeviceNode->getDevice()->updateFormat( audio::Device::Format().framesPerBlock( frames ) );
}
else if( currentSelected == &mNumInChannelsInput ) {
int numChannels = currentSelected->getValue();
CI_LOG_V( "updating nnm input channels from: " << mInputDeviceNode->getNumChannels() << " to: " << numChannels );
setInputDevice( mInputDeviceNode->getDevice(), numChannels );
}
else if( currentSelected == &mNumOutChannelsInput ) {
int numChannels = currentSelected->getValue();
CI_LOG_V( "updating nnm output channels from: " << mOutputDeviceNode->getNumChannels() << " to: " << numChannels );
setOutputDevice( mOutputDeviceNode->getDevice(), numChannels );
}
else if( currentSelected == &mSendChannelInput ) {
if( mTestSelector.currentSection() == "send" || mTestSelector.currentSection() == "send stereo" )
setupTest( mTestSelector.currentSection() );
}
else
CI_LOG_E( "unhandled return for string: " << currentSelected->mInputString );
}
catch( audio::AudioDeviceExc &exc ) {
CI_LOG_E( "AudioDeviceExc caught, what: " << exc.what() );
auto ctx = audio::master();
mSamplerateInput.setValue( ctx->getSampleRate() );
mFramesPerBlockInput.setValue( ctx->getFramesPerBlock() );
return;
}
}
else {
if( event.getCode() == KeyEvent::KEY_BACKSPACE )
currentSelected->processBackspace();
else {
currentSelected->processChar( event.getChar() );
}
}
}
示例8: UtcDaliTextInputTextSelection
int UtcDaliTextInputTextSelection(void)
{
ToolkitTestApplication application;
tet_infoline("Testing Text Selection");
const std::string initialString = "initial text";
TextInput textInput = TextInput::New();
textInput.SetInitialText( initialString );
Stage::GetCurrent().Add(textInput);
application.SendNotification();
application.Render();
textInput.SetEditable( true );
tet_infoline("Testing IsTextSelected negative");
DALI_TEST_EQUALS( false, textInput.IsTextSelected(), TEST_LOCATION);
textInput.SelectText(1,7);
DALI_TEST_EQUALS( true, textInput.IsTextSelected(), TEST_LOCATION);
textInput.DeSelectText();
DALI_TEST_EQUALS( false, textInput.IsTextSelected(), TEST_LOCATION);
END_TEST;
}
示例9: UtcDaliTextInputSetAndGetNumberOfLines
int UtcDaliTextInputSetAndGetNumberOfLines(void)
{
ToolkitTestApplication application;
tet_infoline("Ensuring API for setting and getting max number of lines is correct");
TextInput textInput = TextInput::New(); // create empty TextInput
unsigned int numberOfLines = 1;
textInput.SetNumberOfLinesLimit( numberOfLines );
DALI_TEST_EQUALS(numberOfLines ,textInput.GetNumberOfLinesLimit(), TEST_LOCATION);
END_TEST;
}
示例10: UtcDaliTextInputSetSortModifier
int UtcDaliTextInputSetSortModifier(void)
{
tet_infoline("Testing SetSortModifier does not cause TextInput failure");
ToolkitTestApplication application;
TextInput textInput = TextInput::New();
const float offsetToUse = 1.5f;
textInput.SetSortModifier( offsetToUse );
DALI_TEST_CHECK( textInput );
END_TEST;
}
示例11: deserializeName
void Any::deserializeName(TextInput& ti, Token& token, std::string& name) {
debugAssert(token.type() == Token::SYMBOL);
std::string s = token.string();
while (!isOpen(s[0])) {
name += s;
// Skip newlines and comments
token = ti.readSignificant();
if (token.type() != Token::SYMBOL) {
throw ParseError(ti.filename(), token.line(), token.character(),
"Expected symbol while parsing Any");
}
s = token.string();
}
}
示例12: UtcDaliTextInputSetAndGetTextAlignment
int UtcDaliTextInputSetAndGetTextAlignment(void)
{
ToolkitTestApplication application;
TextInput textInput = TextInput::New();
Stage::GetCurrent().Add(textInput);
application.SendNotification();
application.Render();
textInput.SetTextAlignment(static_cast<Alignment::Type>( Alignment::HorizontalCenter) );
application.SendNotification();
application.Render();
DALI_TEST_CHECK( static_cast<Alignment::Type>( Alignment::HorizontalCenter) & textInput.GetTextAlignment()) ;
END_TEST;
}
示例13: readUntilCommaOrClose
void Any::readUntilCommaOrClose(TextInput& ti, Token& token) {
while (!(((token.type() == Token::SYMBOL) &&
(isClose(token.string()[0]))) ||
isSeparator(token.string()[0]))) {
switch (token.type()) {
case Token::NEWLINE:
case Token::COMMENT:
// Consume
token = ti.read();
break;
default:
throw ParseError(ti.filename(), token.line(), token.character(),
"Expected a comma or close paren");
}
}
}
示例14: UtcDaliTextInputSetAndGetSnapshotModeEnabled
int UtcDaliTextInputSetAndGetSnapshotModeEnabled(void)
{
ToolkitTestApplication application;
tet_infoline("Testing SetSnapshotModeEnabled and IsSnapshotModeEnabled");
TextInput textInput = TextInput::New(); // create empty TextInput
bool snapshotMode( true );
textInput.SetSnapshotModeEnabled( snapshotMode );
DALI_TEST_EQUALS( snapshotMode, textInput.IsSnapshotModeEnabled(), TEST_LOCATION);
snapshotMode = false;
textInput.SetSnapshotModeEnabled( snapshotMode );
DALI_TEST_EQUALS( snapshotMode, textInput.IsSnapshotModeEnabled(), TEST_LOCATION);
END_TEST;
}
示例15: UtcDaliTextInputGetText
// Positive test case for a method
int UtcDaliTextInputGetText(void)
{
ToolkitTestApplication application;
tet_infoline("Testing GetText");
const std::string teststring = "test";
TextInput textInput = TextInput::New(); // create empty TextInput
DALI_TEST_EQUALS("",textInput.GetText(), TEST_LOCATION); // Get text which should be empty
textInput.SetInitialText(teststring);
DALI_TEST_EQUALS(teststring,textInput.GetText(), TEST_LOCATION); // Get text which should be test string
END_TEST;
}