本文整理汇总了C++中cegui::Editbox类的典型用法代码示例。如果您正苦于以下问题:C++ Editbox类的具体用法?C++ Editbox怎么用?C++ Editbox使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Editbox类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: hideChat
void GuiChat::hideChat()
{
CEGUI::Editbox* editbox = static_cast<CEGUI::Editbox*>(chatWindow->getChild("Editbox"));
editbox->deactivate();
chatWindow->deactivate();
}
示例2: accepted
bool accepted() {
m_sString = m_pEditbox->getText().c_str();
return true;
}
示例3: BuildSkeleton
void GameState::BuildSkeleton()
{
CEGUI::Editbox* heightbox = static_cast<CEGUI::Editbox*>(mGUIRoot->getChild("Settings Box/Skeleton Height/HeightEdit"));
CEGUI::Editbox* widthbox = static_cast<CEGUI::Editbox*>(mGUIRoot->getChild("Settings Box/Skeleton Width/WidthEditBox"));
CEGUI::Editbox* depthbox = static_cast<CEGUI::Editbox*>(mGUIRoot->getChild("Settings Box/Skeleton Depth/DepthEditBox"));
CEGUI::Editbox* neckbox = static_cast<CEGUI::Editbox*>(mGUIRoot->getChild("Settings Box/Neck Incline/NeckEditbox"));
CEGUI::Editbox* tailbox = static_cast<CEGUI::Editbox*>(mGUIRoot->getChild("Settings Box/Tail Incline/TailEditbox"));
CEGUI::Editbox* Xbox = static_cast<CEGUI::Editbox*>(mGUIRoot->getChild("Settings Box/Spawn Position/X Editbox"));
CEGUI::Editbox* Ybox = static_cast<CEGUI::Editbox*>(mGUIRoot->getChild("Settings Box/Spawn Position/Y Editbox"));
CEGUI::Editbox* Zbox = static_cast<CEGUI::Editbox*>(mGUIRoot->getChild("Settings Box/Spawn Position/Z Editbox"));
Skeleton_Builder::TorsoType Torso;
Skeleton_Builder::ArmType Arm;
Skeleton_Builder::LegType Leg;
Skeleton_Builder::NeckType Neck;
Skeleton_Builder::TailType Tail;
auto legitem = static_cast<CEGUI::Combobox*>(mGUIRoot->getChild("Settings Box/Leg Combobox"))->getSelectedItem();
auto torsoitem = static_cast<CEGUI::Combobox*>(mGUIRoot->getChild("Settings Box/Torso Combobox"))->getSelectedItem();
auto armitem = static_cast<CEGUI::Combobox*>(mGUIRoot->getChild("Settings Box/Arm Combobox"))->getSelectedItem();
auto tailitem = static_cast<CEGUI::Combobox*>(mGUIRoot->getChild("Settings Box/Tail Combobox"))->getSelectedItem();
auto neckitem = static_cast<CEGUI::Combobox*>(mGUIRoot->getChild("Settings Box/Neck Combobox"))->getSelectedItem();
if (legitem->getID() == 0)
Leg = Skeleton_Builder::LegType::Uninverted;
else
Leg = Skeleton_Builder::LegType::Inverted;
if (torsoitem->getID() == 0)
Torso = Skeleton_Builder::TorsoType::Upright;
else
Torso = Skeleton_Builder::TorsoType::Horizontal;
if (armitem->getID() == 0)
Arm = Skeleton_Builder::ArmType::NoArms;
else if (armitem->getID() == 1)
Arm = Skeleton_Builder::ArmType::ShortArms;
else
Arm = Skeleton_Builder::ArmType::LongArms;
if (tailitem->getID() == 0)
Tail = Skeleton_Builder::TailType::NoTail;
else if (tailitem->getID() == 1)
Tail = Skeleton_Builder::TailType::ShortTail;
else
Tail = Skeleton_Builder::TailType::LongTail;
if (neckitem->getID() == 1)
Neck = Skeleton_Builder::NeckType::ShortNeck;
else if (neckitem->getID() == 0)
Neck = Skeleton_Builder::NeckType::LongNeck;
auto Position = Ogre::Vector3(std::stof(Xbox->getText().c_str()), std::stof(Ybox->getText().c_str()), std::stof(Zbox->getText().c_str()));
mPhysics->BuildCharacter(Torso, Arm, Leg,Neck,Tail,
std::stof(heightbox->getText().c_str()),
std::stof(widthbox->getText().c_str()),
std::stof(depthbox->getText().c_str()),
std::stof(neckbox->getText().c_str()),
std::stof(tailbox->getText().c_str()),
static_cast<CEGUI::ToggleButton*>(mGUIRoot->getChild("Settings Box/Hide Arm/Checkbox"))->isSelected(),
static_cast<CEGUI::ToggleButton*>(mGUIRoot->getChild("Settings Box/Hide Leg/Checkbox"))->isSelected(),
static_cast<CEGUI::ToggleButton*>(mGUIRoot->getChild("Settings Box/Hide Neck/Checkbox"))->isSelected(),
static_cast<CEGUI::ToggleButton*>(mGUIRoot->getChild("Settings Box/Has Muscles/Checkbox"))->isSelected(),
static_cast<CEGUI::ToggleButton*>(mGUIRoot->getChild("Settings Box/Is Fixed/Checkbox"))->isSelected(),
Position);
}
示例4: HandleEnterKey
/***********************************************************
handle send button event
***********************************************************/
bool ChatBox::HandleEnterKey (const CEGUI::EventArgs& e)
{
const CEGUI::KeyEventArgs& we =
static_cast<const CEGUI::KeyEventArgs&>(e);
const CEGUI::WindowEventArgs& wine =
static_cast<const CEGUI::WindowEventArgs&>(e);
if(we.scancode == CEGUI::Key::LeftControl || we.scancode == CEGUI::Key::RightControl)
{
_control_key_on = true;
return true;
}
if(we.scancode == CEGUI::Key::LeftShift || we.scancode == CEGUI::Key::RightShift)
{
_shift_key_on = true;
return true;
}
if(we.scancode == CEGUI::Key::LeftAlt || we.scancode == CEGUI::Key::RightAlt)
{
return true;
}
if(wine.window->getName() == "Chat/edit")
{
if(we.scancode == CEGUI::Key::Return)
{
HandleSend (e);
CEGUI::Editbox * bed = static_cast<CEGUI::Editbox *>
(CEGUI::WindowManager::getSingleton().getWindow("Chat/edit"));
bed->deactivate();
return true;
}
if(we.scancode == CEGUI::Key::ArrowUp)
{
if(_itltext == _lasttexts.end())
_itltext = _lasttexts.begin();
else
{
std::list<std::string>::iterator ittmp = _itltext;
++ittmp;
if(ittmp != _lasttexts.end())
++_itltext;
}
try
{
CEGUI::Window *windowchat = CEGUI::WindowManager::getSingleton().getWindow("Chat/edit");
std::string text = "";
if(_itltext != _lasttexts.end())
text = *_itltext;
if(windowchat)
windowchat->setText((const unsigned char *)text.c_str());
}
catch(...){}
//++_currSelectedch;
//if(_currSelectedch >= (int)_channels.size())
// --_currSelectedch;
//else
//{
// std::list<std::string>::const_iterator it = _channels.begin();
// std::list<std::string>::const_iterator end = _channels.end();
// for(int cc=0; cc<_currSelectedch && it != end; ++it, ++cc);
// CEGUI::PushButton * bch = static_cast<CEGUI::PushButton *>
// (CEGUI::WindowManager::getSingleton().getWindow("Chat/bChannel"));
// bch->setProperty("Text", *it);
//}
return true;
}
if(we.scancode == CEGUI::Key::ArrowDown)
{
if(_itltext != _lasttexts.end())
{
if(_itltext != _lasttexts.begin())
--_itltext;
else
_itltext = _lasttexts.end();
}
CEGUI::Window *windowchat = CEGUI::WindowManager::getSingleton().getWindow("Chat/edit");
std::string text = "";
if(_itltext != _lasttexts.end())
text = *_itltext;
if(windowchat)
windowchat->setText((const unsigned char *)text.c_str());
//.........这里部分代码省略.........
示例5: saisiActiver
bool Chat::saisiActiver()
{
CEGUI::Editbox* editbox = static_cast<CEGUI::Editbox*>(d_root->getChild("Editbox"));
return editbox->isActive() ;
}
示例6:
void cRandom_Sound :: Editor_Activate( void )
{
CEGUI::WindowManager &wmgr = CEGUI::WindowManager::getSingleton();
// filename
CEGUI::Editbox *editbox = static_cast<CEGUI::Editbox *>(wmgr.createWindow( "TaharezLook/Editbox", "editor_sound_filename" ));
Editor_Add( UTF8_("Filename"), UTF8_("Sound filename"), editbox, 200 );
editbox->setText( m_filename.c_str() );
editbox->subscribeEvent( CEGUI::Editbox::EventTextChanged, CEGUI::Event::Subscriber( &cRandom_Sound::Editor_Filename_Text_Changed, this ) );
// continuous
CEGUI::Checkbox *checkbox = static_cast<CEGUI::Checkbox *>(wmgr.createWindow( "TaharezLook/Checkbox", "editor_sound_continuous" ));
Editor_Add( UTF8_("Continuous"), UTF8_("Check if the sound should be played continuously instead of randomly"), checkbox, 50 );
checkbox->setSelected( m_continuous );
checkbox->subscribeEvent( CEGUI::Checkbox::EventCheckStateChanged, CEGUI::Event::Subscriber( &cRandom_Sound::Editor_Continuous_Changed, this ) );
// delay min
editbox = static_cast<CEGUI::Editbox *>(wmgr.createWindow( "TaharezLook/Editbox", "editor_sound_delay_min" ));
Editor_Add( UTF8_("Delay Minimum"), UTF8_("Minimal delay until played again"), editbox, 90 );
editbox->setValidationString( "^[+]?\\d*$" );
editbox->setText( int_to_string( m_delay_min ) );
editbox->subscribeEvent( CEGUI::Editbox::EventTextChanged, CEGUI::Event::Subscriber( &cRandom_Sound::Editor_Delay_Min_Text_Changed, this ) );
// delay max
editbox = static_cast<CEGUI::Editbox *>(wmgr.createWindow( "TaharezLook/Editbox", "editor_sound_delay_max" ));
Editor_Add( UTF8_("Maximum"), UTF8_("Maximal delay until played again"), editbox, 90, 28, 0 );
editbox->setValidationString( "^[+]?\\d*$" );
editbox->setText( int_to_string( m_delay_max ) );
editbox->subscribeEvent( CEGUI::Editbox::EventTextChanged, CEGUI::Event::Subscriber( &cRandom_Sound::Editor_Delay_Max_Text_Changed, this ) );
// volume min
editbox = static_cast<CEGUI::Editbox *>(wmgr.createWindow( "TaharezLook/Editbox", "editor_sound_volume_min" ));
Editor_Add( UTF8_("Volume Minimum"), UTF8_("Minimal random volume for each play"), editbox, 90 );
editbox->setValidationString( "^[+]?\\d*$" );
editbox->setText( int_to_string( static_cast<int>(m_volume_min) ) );
editbox->subscribeEvent( CEGUI::Editbox::EventTextChanged, CEGUI::Event::Subscriber( &cRandom_Sound::Editor_Volume_Min_Text_Changed, this ) );
// volume max
editbox = static_cast<CEGUI::Editbox *>(wmgr.createWindow( "TaharezLook/Editbox", "editor_sound_volume_max" ));
Editor_Add( UTF8_("Maximum"), UTF8_("Maximal random volume for each play"), editbox, 90, 28, 0 );
editbox->setValidationString( "^[+]?\\d*$" );
editbox->setText( int_to_string( static_cast<int>(m_volume_max) ) );
editbox->subscribeEvent( CEGUI::Editbox::EventTextChanged, CEGUI::Event::Subscriber( &cRandom_Sound::Editor_Volume_Max_Text_Changed, this ) );
// volume reduction begin
editbox = static_cast<CEGUI::Editbox *>(wmgr.createWindow( "TaharezLook/Editbox", "editor_sound_volume_reduction_begin" ));
Editor_Add( UTF8_("Volume Reduction Begin"), UTF8_("Volume reduction begins gradually at this distance"), editbox, 90 );
editbox->setValidationString( "^[+]?\\d*$" );
editbox->setText( int_to_string( static_cast<int>(m_volume_reduction_begin) ) );
editbox->subscribeEvent( CEGUI::Editbox::EventTextChanged, CEGUI::Event::Subscriber( &cRandom_Sound::Editor_Volume_Reduction_Begin_Text_Changed, this ) );
// volume reduction end
editbox = static_cast<CEGUI::Editbox *>(wmgr.createWindow( "TaharezLook/Editbox", "editor_sound_volume_reduction_end" ));
Editor_Add( UTF8_("End"), UTF8_("Volume reduction ends at this distance. Sound is not played beyond this."), editbox, 90, 28, 0 );
editbox->setValidationString( "^[+]?\\d*$" );
editbox->setText( int_to_string( static_cast<int>(m_volume_reduction_end) ) );
editbox->subscribeEvent( CEGUI::Editbox::EventTextChanged, CEGUI::Event::Subscriber( &cRandom_Sound::Editor_Volume_Reduction_End_Text_Changed, this ) );
// init
Editor_Init();
}
示例7: GUI_Paste_From_Clipboard
bool GUI_Paste_From_Clipboard( void )
{
CEGUI::Window *sheet = CEGUI::System::getSingleton().getGUISheet();
// no sheet
if( !sheet )
{
return 0;
}
CEGUI::Window *window_active = sheet->getActiveChild();
// no active window
if( !window_active )
{
return 0;
}
const CEGUI::String &type = window_active->getType();
// MultiLineEditbox
if( type.find( "/MultiLineEditbox" ) != CEGUI::String::npos )
{
CEGUI::MultiLineEditbox *editbox = static_cast<CEGUI::MultiLineEditbox*>(window_active);
if( editbox->isReadOnly() )
{
return 0;
}
CEGUI::String::size_type beg = editbox->getSelectionStartIndex();
CEGUI::String::size_type len = editbox->getSelectionLength();
CEGUI::String new_text = editbox->getText();
// erase selected text
new_text.erase( beg, len );
// get clipboard text
CEGUI::String clipboard_text = reinterpret_cast<const CEGUI::utf8*>(Get_Clipboard_Content().c_str());
// set new text
editbox->setText( new_text.insert( beg, clipboard_text ) );
// set new carat index
editbox->setCaratIndex( editbox->getCaratIndex() + clipboard_text.length() );
}
// Editbox
else if( type.find( "/Editbox" ) != CEGUI::String::npos )
{
CEGUI::Editbox *editbox = static_cast<CEGUI::Editbox*>(window_active);
if( editbox->isReadOnly() )
{
return 0;
}
CEGUI::String::size_type beg = editbox->getSelectionStartIndex();
CEGUI::String::size_type len = editbox->getSelectionLength();
CEGUI::String new_text = editbox->getText();
// erase selected text
new_text.erase( beg, len );
// get clipboard text
CEGUI::String clipboard_text = reinterpret_cast<const CEGUI::utf8*>(Get_Clipboard_Content().c_str());
// set new text
editbox->setText( new_text.insert( beg, clipboard_text ) );
// set new carat index
editbox->setCaratIndex( editbox->getCaratIndex() + clipboard_text.length() );
}
else
{
return 0;
}
return 1;
}
示例8: GUI_Copy_To_Clipboard
bool GUI_Copy_To_Clipboard( bool cut )
{
CEGUI::Window *sheet = CEGUI::System::getSingleton().getGUISheet();
// no sheet
if( !sheet )
{
return 0;
}
CEGUI::Window *window_active = sheet->getActiveChild();
// no active window
if( !window_active )
{
return 0;
}
CEGUI::String sel_text;
const CEGUI::String &type = window_active->getType();
// MultiLineEditbox
if( type.find( "/MultiLineEditbox" ) != CEGUI::String::npos )
{
CEGUI::MultiLineEditbox *editbox = static_cast<CEGUI::MultiLineEditbox*>(window_active);
CEGUI::String::size_type beg = editbox->getSelectionStartIndex();
CEGUI::String::size_type len = editbox->getSelectionLength();
sel_text = editbox->getText().substr( beg, len ).c_str();
// if cutting
if( cut )
{
if( editbox->isReadOnly() )
{
return 0;
}
CEGUI::String new_text = editbox->getText();
editbox->setText( new_text.erase( beg, len ) );
}
}
// Editbox
else if( type.find( "/Editbox" ) != CEGUI::String::npos )
{
CEGUI::Editbox *editbox = static_cast<CEGUI::Editbox*>(window_active);
CEGUI::String::size_type beg = editbox->getSelectionStartIndex();
CEGUI::String::size_type len = editbox->getSelectionLength();
sel_text = editbox->getText().substr( beg, len ).c_str();
// if cutting
if( cut )
{
if( editbox->isReadOnly() )
{
return 0;
}
CEGUI::String new_text = editbox->getText();
editbox->setText( new_text.erase( beg, len ) );
}
}
else
{
return 0;
}
Set_Clipboard_Content( sel_text.c_str() );
return 1;
}
示例9: initialise
/*************************************************************************
Sample specific initialisation goes here.
*************************************************************************/
bool MinesweeperSample::initialise(CEGUI::GUIContext* guiContext)
{
using namespace CEGUI;
d_usedFiles = CEGUI::String(__FILE__);
// Register Timer Window
WindowFactoryManager::getSingleton().addFactory( &getTimerFactory() );
// load font and setup default if not loaded via scheme
Font& defaultFont = FontManager::getSingleton().createFromFile("DejaVuSans-12.font");
// Set default font for the gui context
guiContext->setDefaultFont(&defaultFont);
d_gameStarted = false;
// Get window manager which we wil use for a few jobs here.
WindowManager& winMgr = WindowManager::getSingleton();
// Load the scheme to initialse the VanillaSkin which we use in this sample
SchemeManager::getSingleton().createFromFile("VanillaSkin.scheme");
SchemeManager::getSingleton().createFromFile("TaharezLook.scheme");
guiContext->setDefaultTooltipType("TaharezLook/Tooltip");
// set default mouse image
guiContext->getMouseCursor().setDefaultImage("Vanilla-Images/MouseArrow");
// load an image to use as a background
if( !ImageManager::getSingleton().isDefined("SpaceBackgroundImage") )
ImageManager::getSingleton().addFromImageFile("SpaceBackgroundImage", "SpaceBackground.jpg");
// here we will use a StaticImage as the root, then we can use it to place a background image
Window* background = winMgr.createWindow("Vanilla/StaticImage");
// set area rectangle
background->setArea(URect(cegui_reldim(0), cegui_reldim(0), cegui_reldim(1), cegui_reldim(1)));
// disable frame and standard background
background->setProperty("FrameEnabled", "false");
background->setProperty("BackgroundEnabled", "false");
// set the background image
background->setProperty("Image", "SpaceBackgroundImage");
// install this as the root GUI sheet
guiContext->setRootWindow(background);
d_alarm = (Timer*)winMgr.createWindow("Timer");
background->addChild(d_alarm);
d_alarm->setDelay(0.5); // Tick each 0.5 seconds
// create the game frame
Window* frame = winMgr.createWindow("Vanilla/FrameWindow");
d_alarm->addChild(frame);
frame->setXPosition(UDim(0.3f, 0.0f));
frame->setYPosition(UDim(0.15f, 0.0f));
frame->setWidth(UDim(0.4f, 0.0f));
frame->setHeight(UDim(0.7f, 0.0f));
frame->setText("CEGUI Minesweeper");
// create the action panel
Window* action = winMgr.createWindow("DefaultWindow");
frame->addChild(action);
action->setXPosition(UDim(0.03f, 0.0f));
action->setYPosition(UDim(0.10f, 0.0f));
action->setWidth(UDim(0.94f, 0.0f));
action->setHeight(UDim(0.1f, 0.0f));
d_counter = (Editbox*)winMgr.createWindow("Vanilla/Editbox", "mine_counter");
action->addChild(d_counter);
d_counter->setText("0");
d_counter->setTooltipText("Number of mine");
d_counter->setReadOnly(true);
d_counter->setXPosition(UDim(0.0f, 0.0f));
d_counter->setYPosition(UDim(0.0f, 0.0f));
d_counter->setWidth(UDim(0.3f, 0.0f));
d_counter->setHeight(UDim(1.0f, 0.0f));
Window* newGame = winMgr.createWindow("Vanilla/Button", "new_game");
action->addChild(newGame);
newGame->setText("Start");
newGame->setTooltipText("Start a new game");
newGame->setXPosition(UDim(0.35f, 0.0f));
newGame->setYPosition(UDim(0.0f, 0.0f));
newGame->setWidth(UDim(0.3f, 0.0f));
newGame->setHeight(UDim(1.0f, 0.0f));
newGame->subscribeEvent(PushButton::EventClicked, Event::Subscriber(&MinesweeperSample::handleGameStartClicked, this));
d_timer = (Editbox*)winMgr.createWindow("Vanilla/Editbox", "timer");
action->addChild(d_timer);
d_timer->setText("0");
d_timer->setTooltipText("Time elapsed");
d_timer->setReadOnly(true);
d_timer->setXPosition(UDim(0.7f, 0.0f));
d_timer->setYPosition(UDim(0.0f, 0.0f));
d_timer->setWidth(UDim(0.3f, 0.0f));
d_timer->setHeight(UDim(1.0f, 0.0f));
d_alarm->subscribeEvent(Timer::EventTimerAlarm, Event::Subscriber(&MinesweeperSample::handleUpdateTimer, this));
//.........这里部分代码省略.........