本文整理汇总了C++中CSlider类的典型用法代码示例。如果您正苦于以下问题:C++ CSlider类的具体用法?C++ CSlider怎么用?C++ CSlider使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CSlider类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ZoomMap
void CMainMap::ZoomMap()
{
CWindow* pw;
CMap* pm;
CSlider* ps;
float zoom;
pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW1));
if (pw == nullptr)
return;
pm = static_cast<CMap*>(pw->SearchControl(EVENT_OBJECT_MAP));
if (pm == nullptr)
return;
ps = static_cast<CSlider*>(pw->SearchControl(EVENT_OBJECT_MAPZOOM));
if (ps == nullptr)
return;
zoom = ps->GetVisibleValue();
zoom = powf(zoom, 2.0f);
zoom = ZOOM_MIN+zoom*(ZOOM_MAX - ZOOM_MIN);
pm->SetZoom(zoom);
DimMap();
}
示例2: ChangeSetupButtons
void CScreenSetupGame::ChangeSetupButtons()
{
CWindow* pw;
CSlider* ps;
CList* pli;
float value;
pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW5));
if ( pw == nullptr ) return;
ps = static_cast<CSlider*>(pw->SearchControl(EVENT_INTERFACE_AUTOSAVE_INTERVAL));
if ( ps != nullptr )
{
value = ps->GetVisibleValue();
m_main->SetAutosaveInterval(static_cast<int>(round(value)));
}
ps = static_cast<CSlider*>(pw->SearchControl(EVENT_INTERFACE_AUTOSAVE_SLOTS));
if ( ps != nullptr )
{
value = ps->GetVisibleValue();
m_main->SetAutosaveSlots(static_cast<int>(round(value)));
}
pli = static_cast<CList*>(pw->SearchControl(EVENT_INTERFACE_LANGUAGE));
if ( pli != nullptr )
{
m_settings->SetLanguage(static_cast<Language>(pli->GetSelect()-1));
// TODO: A really ugly way to apply the change immediately
m_main->ChangePhase(m_main->GetPhase());
}
}
示例3: CSlider
CSlider* CSlider::create()
{
CSlider* pRet = new CSlider();
if( pRet && pRet->init() )
{
pRet->autorelease();
return pRet;
}
CC_SAFE_DELETE(pRet);
return NULL;
}
示例4: onLoadScene
NS_MAIN_BEGIN
void MsgBox::onLoadScene()
{
SpriteFrameCache::getInstance()->addSpriteFramesWithFile("main/mainui.plist");
TuiManager::getInstance()->parseScene(this,"panel_msgbox",PATH_MAIN);
//注册事件
CButton *pBtnClose = (CButton*)getControl(PANEL_MSGBOX, BTN_CLOSE);
pBtnClose->setOnClickListener(this,ccw_click_selector(MsgBox::event_btn_close));
CSlider *pSlider = (CSlider*)getControl(PANEL_MSGBOX,SLIDER_TEST);
pSlider->setOnValueChangedListener(this,ccw_valuechanged_selector(MsgBox::event_slider_test));
}
示例5: CSlider
void CGUIWindow::LoadSlider (CSlider** slider_aux, CXMLTreeNode& pNewNode, const Vect2i& screenResolution, CTextureManager* tm)
{
//<Slider name="debug_fps" posx="0" posy="2" height="10" width="10" visible="true" active="true" value="0.5" buttonH="10" buttonW="10"
// button_normal="blabla" button_over="bla" button_clicked"bla" button_deactivated="bla" quad="bla"
// OnOverAction="" OnClickedAction="" OnChangeValue="" OnSaveValue="blabl" OnLoadValue="" Literal="blabla" widthOffset="" heightOffset=""/>
CSlider* slider;
std::string name = pNewNode.GetPszProperty("name", "defaultGuiElement");
float posx = pNewNode.GetFloatProperty("posx", 0.f);
float posy = pNewNode.GetFloatProperty("posy", 0.f);
float w = pNewNode.GetFloatProperty("width", 50.f);
float h = pNewNode.GetFloatProperty("height", 50.f);
bool visible = pNewNode.GetBoolProperty("visible", true);
bool activated = pNewNode.GetBoolProperty("active", true);
float value = pNewNode.GetFloatProperty("value", 0.f);
float buttonH = pNewNode.GetFloatProperty("buttonH", 10.f);
float buttonW = pNewNode.GetFloatProperty("buttonW", 10.f);
std::string button_normal = pNewNode.GetPszProperty("button_normal", "");
std::string button_over = pNewNode.GetPszProperty("button_over", "");
std::string button_clicked = pNewNode.GetPszProperty("button_clicked", "");
std::string button_deactivated = pNewNode.GetPszProperty("button_deactivated", "");
std::string quad = pNewNode.GetPszProperty("quad", "");
std::string OnChangeValue = pNewNode.GetPszProperty("OnChangeValue", "");
std::string OnClickedAction = pNewNode.GetPszProperty("OnClickedAction", "");
std::string OnOverAction = pNewNode.GetPszProperty("OnOverAction", "");
std::string OnSaveValue = pNewNode.GetPszProperty("OnSaveValue", "");
std::string OnLoadValue = pNewNode.GetPszProperty("OnLoadValue", "");
std::string l_literal = pNewNode.GetPszProperty("Literal", "");
float widthOffsetPercent = pNewNode.GetFloatProperty("widthOffset", 0.f);
float heightOffsetPercent = pNewNode.GetFloatProperty("heightOffset", 0.f);
CTexture* normal = tm->GetTexture(button_normal);
CTexture* over = tm->GetTexture(button_over);
CTexture* deac = tm->GetTexture(button_deactivated);
CTexture* clicked = tm->GetTexture(button_clicked);
CTexture* back = tm->GetTexture(quad);
uint32 widthOffset = (uint32) (screenResolution.x * 0.01f * widthOffsetPercent );
uint32 heightOffset = (uint32) (screenResolution.y * 0.01f * heightOffsetPercent );
slider = new CSlider( screenResolution.y, screenResolution.x, h, w, Vect2f(posx,posy), buttonW, buttonH, value,
l_literal, heightOffset, widthOffset, visible, activated);
slider->SetName(name);
slider->SetButtonTextures(normal, over, clicked, deac);
slider->SetBackGroundTexture(back);
slider->SetOnChangeValueAction(OnChangeValue);
slider->SetOnClickedAction(OnClickedAction);
slider->SetOnOverAction(OnOverAction);
slider->SetOnLoadValueAction(OnLoadValue);
slider->SetOnSaveValueAction(OnSaveValue);
*slider_aux = slider;
}
示例6: onLoadScene
NS_MAIN_BEGIN
void MsgBox::onLoadScene()
{
//setAutoRemoveUnusedTexture(true);
TuiManager::getInstance()->parseScene(this,"panel_msgbox",PATH_MAIN);
//注册事件
CButton *pBtnClose = (CButton*)getControl(PANEL_MSGBOX,BTN_CLOSE);
pBtnClose->setOnClickListener(this,ccw_click_selector(MsgBox::event_btn_close));
CSlider *pSlider = (CSlider*)getControl(PANEL_MSGBOX,SLIDER_TEST);
pSlider->setOnValueChangedListener(this,ccw_valuechanged_selector(MsgBox::event_slider_test));
CProgressBar *pProg = (CProgressBar*)this->getControl(PANEL_MSGBOX,PROG_HP);
pProg->setShowValueLabel(true);
}
示例7: ColorPerso
void CScreenApperance::ColorPerso()
{
CWindow* pw;
CSlider* ps;
Gfx::Color color;
PlayerApperance& apperance = m_main->GetPlayerProfile()->GetApperance();
pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW5));
if ( pw == nullptr ) return;
color.a = 0.0f;
ps = static_cast<CSlider*>(pw->SearchControl(EVENT_INTERFACE_PCRa));
if ( ps != nullptr ) color.r = ps->GetVisibleValue()/255.0f;
ps = static_cast<CSlider*>(pw->SearchControl(EVENT_INTERFACE_PCGa));
if ( ps != nullptr ) color.g = ps->GetVisibleValue()/255.0f;
ps = static_cast<CSlider*>(pw->SearchControl(EVENT_INTERFACE_PCBa));
if ( ps != nullptr ) color.b = ps->GetVisibleValue()/255.0f;
if ( m_apperanceTab == 1 ) apperance.colorCombi = color;
ps = static_cast<CSlider*>(pw->SearchControl(EVENT_INTERFACE_PCRb));
if ( ps != nullptr ) color.r = ps->GetVisibleValue()/255.0f;
ps = static_cast<CSlider*>(pw->SearchControl(EVENT_INTERFACE_PCGb));
if ( ps != nullptr ) color.g = ps->GetVisibleValue()/255.0f;
ps = static_cast<CSlider*>(pw->SearchControl(EVENT_INTERFACE_PCBb));
if ( ps != nullptr ) color.b = ps->GetVisibleValue()/255.0f;
if ( m_apperanceTab == 0 ) apperance.colorHair = color;
else apperance.colorBand = color;
}
示例8: MapEnable
void CMainMap::MapEnable(bool bEnable)
{
CWindow* pw;
CMap* pm;
CSlider* ps;
pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW1));
if (pw == nullptr)
return;
pm = static_cast<CMap*>(pw->SearchControl(EVENT_OBJECT_MAP));
if (pm != nullptr)
pm->SetEnable(bEnable);
ps = static_cast<CSlider*>(pw->SearchControl(EVENT_OBJECT_MAPZOOM));
if (ps != nullptr)
ps->SetState(STATE_ENABLE, bEnable);
}
示例9: createSlider
CSlider* TuiManager::createSlider(float tag,int max,int min,int cur, const char* bg, const char* progress, const char* thumb, float x, float y, float rotation, int isUseFrame){
CSlider *pSlider = NULL;
if (isUseFrame){
pSlider = CSlider::createSpriteFrame(thumb, progress);
pSlider->setBackgroundSpriteFrameName(bg);
}else{
pSlider = CSlider::create(thumb,progress);
pSlider->setBackgroundImage(bg);
}
pSlider->setRotation(rotation);
pSlider->setPosition(Vec2(x,-y));
pSlider->setMinValue(min);
pSlider->setMaxValue(max);
pSlider->setValue(cur);
pSlider->setTag(tag);
return pSlider;
}
示例10: DimMap
void CMainMap::ShowMap(bool bShow)
{
CWindow* pw;
CMap* pm;
CSlider* ps;
pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW1));
if (pw == nullptr)
return;
if (bShow) {
DimMap();
} else {
pm = static_cast<CMap*>(pw->SearchControl(EVENT_OBJECT_MAP));
if (pm != nullptr)
pm->ClearState(STATE_VISIBLE);
ps = static_cast<CSlider*>(pw->SearchControl(EVENT_OBJECT_MAPZOOM));
if (ps != nullptr)
ps->ClearState(STATE_VISIBLE);
}
}
示例11: ChangeSetupButtons
void CScreenSetupSound::ChangeSetupButtons()
{
CWindow* pw;
CSlider* ps;
float value;
pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW5));
if ( pw == nullptr ) return;
ps = static_cast<CSlider*>(pw->SearchControl(EVENT_INTERFACE_VOLSOUND));
if ( ps != nullptr )
{
value = ps->GetVisibleValue();
m_sound->SetAudioVolume(static_cast<int>(value));
}
ps = static_cast<CSlider*>(pw->SearchControl(EVENT_INTERFACE_VOLMUSIC));
if ( ps != nullptr )
{
value = ps->GetVisibleValue();
m_sound->SetMusicVolume(static_cast<int>(value));
}
}
示例12: CreateInterface
void CScreenSetupSound::CreateInterface()
{
CWindow* pw;
CLabel* pl;
CSlider* psl;
CButton* pb;
Math::Point pos, ddim;
std::string name;
CScreenSetup::CreateInterface();
pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW5));
if ( pw == nullptr ) return;
pos.x = ox+sx*3;
pos.y = 0.55f;
ddim.x = dim.x*4.0f;
ddim.y = 18.0f/480.0f;
psl = pw->CreateSlider(pos, ddim, 0, EVENT_INTERFACE_VOLSOUND);
psl->SetState(STATE_SHADOW);
psl->SetLimit(0.0f, MAXVOLUME);
psl->SetArrowStep(1.0f);
pos.y += ddim.y;
GetResource(RES_EVENT, EVENT_INTERFACE_VOLSOUND, name);
pl = pw->CreateLabel(pos, ddim, 0, EVENT_LABEL1, name);
pl->SetTextAlign(Gfx::TEXT_ALIGN_LEFT);
pos.x = ox+sx*3;
pos.y = 0.40f;
ddim.x = dim.x*4.0f;
ddim.y = 18.0f/480.0f;
psl = pw->CreateSlider(pos, ddim, 0, EVENT_INTERFACE_VOLMUSIC);
psl->SetState(STATE_SHADOW);
psl->SetLimit(0.0f, MAXVOLUME);
psl->SetArrowStep(1.0f);
pos.y += ddim.y;
GetResource(RES_EVENT, EVENT_INTERFACE_VOLMUSIC, name);
pl = pw->CreateLabel(pos, ddim, 0, EVENT_LABEL2, name);
pl->SetTextAlign(Gfx::TEXT_ALIGN_LEFT);
ddim.x = dim.x*3;
ddim.y = dim.y*1;
pos.x = ox+sx*10;
pos.y = oy+sy*2;
pb = pw->CreateButton(pos, ddim, -1, EVENT_INTERFACE_SILENT);
pb->SetState(STATE_SHADOW);
pos.x += ddim.x;
pb = pw->CreateButton(pos, ddim, -1, EVENT_INTERFACE_NOISY);
pb->SetState(STATE_SHADOW);
UpdateSetupButtons();
}
示例13: UpdateSetupButtons
void CScreenSetupGame::UpdateSetupButtons()
{
CWindow* pw;
CCheck* pc;
CSlider* ps;
CList* pli;
pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW5));
if ( pw == nullptr ) return;
pc = static_cast<CCheck*>(pw->SearchControl(EVENT_INTERFACE_TOOLTIP));
if ( pc != nullptr )
{
pc->SetState(STATE_CHECK, m_settings->GetTooltips());
}
pc = static_cast<CCheck*>(pw->SearchControl(EVENT_INTERFACE_GLINT));
if ( pc != nullptr )
{
pc->SetState(STATE_CHECK, m_settings->GetInterfaceGlint());
}
pc = static_cast<CCheck*>(pw->SearchControl(EVENT_INTERFACE_RAIN));
if ( pc != nullptr )
{
pc->SetState(STATE_CHECK, m_settings->GetInterfaceRain());
}
pc = static_cast<CCheck*>(pw->SearchControl(EVENT_INTERFACE_BGPAUSE));
if ( pc != nullptr )
{
pc->SetState(STATE_CHECK, m_settings->GetFocusLostPause());
}
pc = static_cast<CCheck*>(pw->SearchControl(EVENT_INTERFACE_EDITMODE));
if ( pc != nullptr )
{
pc->SetState(STATE_CHECK, m_engine->GetEditIndentMode());
}
pc = static_cast<CCheck*>(pw->SearchControl(EVENT_INTERFACE_EDITVALUE));
if ( pc != nullptr )
{
pc->SetState(STATE_CHECK, m_engine->GetEditIndentValue()>2);
}
pc = static_cast<CCheck*>(pw->SearchControl(EVENT_INTERFACE_SOLUCE4));
if ( pc != nullptr )
{
pc->SetState(STATE_CHECK, m_settings->GetSoluce4());
}
pc = static_cast<CCheck*>(pw->SearchControl(EVENT_INTERFACE_MOVIES));
if ( pc != nullptr )
{
pc->SetState(STATE_CHECK, m_settings->GetMovies());
}
pc = static_cast<CCheck*>(pw->SearchControl(EVENT_INTERFACE_SCROLL));
if ( pc != nullptr )
{
pc->SetState(STATE_CHECK, m_camera->GetOldCameraScroll());
}
pc = static_cast<CCheck*>(pw->SearchControl(EVENT_INTERFACE_INVERTX));
if ( pc != nullptr )
{
pc->SetState(STATE_CHECK, m_camera->GetCameraInvertX());
}
pc = static_cast<CCheck*>(pw->SearchControl(EVENT_INTERFACE_INVERTY));
if ( pc != nullptr )
{
pc->SetState(STATE_CHECK, m_camera->GetCameraInvertY());
}
pc = static_cast<CCheck*>(pw->SearchControl(EVENT_INTERFACE_EFFECT));
if ( pc != nullptr )
{
pc->SetState(STATE_CHECK, m_camera->GetEffect());
}
pc = static_cast<CCheck*>(pw->SearchControl(EVENT_INTERFACE_BLOOD));
if ( pc != nullptr )
{
pc->SetState(STATE_CHECK, m_camera->GetBlood());
}
pc = static_cast<CCheck*>(pw->SearchControl(EVENT_INTERFACE_AUTOSAVE_ENABLE));
if ( pc != nullptr )
{
pc->SetState(STATE_CHECK, m_main->GetAutosave());
}
ps = static_cast<CSlider*>(pw->SearchControl(EVENT_INTERFACE_AUTOSAVE_INTERVAL));
if ( ps != nullptr )
{
ps->SetState(STATE_ENABLE, m_main->GetAutosave());
ps->SetVisibleValue(m_main->GetAutosaveInterval());
//.........这里部分代码省略.........
示例14: getCSlidersForCurrentFolderId
void SliderDialog::createNewSlider()
{
// allow the user to create more than one slider
std::vector<const CCopasiObject*> objects = CCopasiSelectionDialog::getObjectVector(this,
CQSimpleSelectionTree::InitialTime |
CQSimpleSelectionTree::Parameters);
std::vector<CSlider*>* pVector = getCSlidersForCurrentFolderId();
std::vector<const CCopasiObject*>::const_iterator it = objects.begin(), endit = objects.end();
bool yesToAll = false;
bool noToAll = false;
// create the sliders for all the selected objects
// first we need the task object because we need it later to associate the
// later with the correct task
CCopasiObject* object = (CCopasiObject*)getTaskForFolderId(mCurrentFolderId);
if (!object) return;
CCopasiObject* pTmpObject = NULL;
while (it != endit)
{
// create a new slider
assert((*it) != NULL);
pTmpObject = const_cast<CCopasiObject*>(determineCorrectObjectForSlider(*it));
CSlider* pCSlider = new CSlider("slider", (*CCopasiRootContainer::getDatamodelList())[0]);
if (pCSlider)
{
pCSlider->setSliderObject(pTmpObject);
pCSlider->setAssociatedEntityKey(object->getKey());
// check if a slider for that object already exists and if so, prompt
// the user what to do
CSlider* pEquivalentSlider = equivalentSliderExists(pCSlider);
if (pEquivalentSlider != NULL)
{
CopasiSlider* pCopasiSlider = NULL;
// if the user has specified yesToAll, we reset the ranges of all
// duplicate sliders
if (yesToAll)
{
pEquivalentSlider->resetRange();
// update the slider widget
pCopasiSlider = findCopasiSliderForCSlider(pEquivalentSlider);
assert(pCopasiSlider != NULL);
if (pCopasiSlider != NULL)
{
pCopasiSlider->updateSliderData();
}
}
// if the user has not specified noToAll, we need to prompt
else if (!noToAll)
{
QMessageBox::StandardButton result = CQMessageBox::information(NULL, "Slider Exists",
"A slider for this object already exists.\n\nDo you want to reset the range of the slider?",
QMessageBox::Yes | QMessageBox::No | QMessageBox::YesToAll | QMessageBox::NoToAll, QMessageBox::No);
// check the answer and maybe set some flags
switch (result)
{
case QMessageBox::YesToAll:
// set the flag
yesToAll = true;
case QMessageBox::Yes:
// reset the range
pEquivalentSlider->resetRange();
// update the slider widget
pCopasiSlider = findCopasiSliderForCSlider(pEquivalentSlider);
assert(pCopasiSlider != NULL);
if (pCopasiSlider != NULL)
{
pCopasiSlider->updateSliderData();
}
break;
case QMessageBox::NoToAll:
// set the flag
noToAll = true;
break;
case QMessageBox::No:
// do nothing else
break;
default:
// do nothing
break;
}
}
delete pCSlider;
}
else
//.........这里部分代码省略.........
示例15: EventDialog
bool CStudio::EventProcess(const Event &event)
{
CWindow* pw;
CEdit* edit;
CSlider* slider;
if ( m_dialog != SD_NULL ) // dialogue exists?
{
return EventDialog(event);
}
if ( event.type == EVENT_FRAME )
{
EventFrame(event);
}
pw = static_cast< CWindow* >(m_interface->SearchControl(EVENT_WINDOW3));
if ( pw == nullptr ) return false;
edit = static_cast<CEdit*>(pw->SearchControl(EVENT_STUDIO_EDIT));
if ( edit == nullptr ) return false;
if ( event.type == pw->GetEventTypeClose() )
{
Event newEvent = event;
newEvent.type = EVENT_STUDIO_OK;
m_event->AddEvent(newEvent);
}
if ( event.type == EVENT_STUDIO_EDIT ) // text modifief?
{
ColorizeScript(edit);
}
if ( event.type == EVENT_STUDIO_LIST ) // list clicked?
{
m_main->StartDisplayInfo(const_cast<char *>(m_helpFilename.c_str()), -1); // TODO change to std::string when RobotMain changes
}
if ( event.type == EVENT_STUDIO_NEW ) // new?
{
m_script->New(edit, "");
}
if ( event.type == EVENT_STUDIO_OPEN ) // open?
{
StartDialog(SD_OPEN);
}
if ( event.type == EVENT_STUDIO_SAVE ) // save?
{
StartDialog(SD_SAVE);
}
if ( event.type == EVENT_STUDIO_UNDO ) // undo?
{
edit->Undo();
}
if ( event.type == EVENT_STUDIO_CUT ) // cut?
{
edit->Cut();
}
if ( event.type == EVENT_STUDIO_COPY ) // copy?
{
edit->Copy();
}
if ( event.type == EVENT_STUDIO_PASTE ) // paste?
{
edit->Paste();
}
if ( event.type == EVENT_STUDIO_SIZE ) // size?
{
slider = static_cast< CSlider* >(pw->SearchControl(EVENT_STUDIO_SIZE));
if ( slider == nullptr ) return false;
m_main->SetFontSize(9.0f+slider->GetVisibleValue()*12.0f);
ViewEditScript();
}
if ( event.type == EVENT_STUDIO_TOOL && // instructions?
m_dialog == SD_NULL )
{
m_main->StartDisplayInfo(SATCOM_HUSTON, false);
}
if ( event.type == EVENT_STUDIO_HELP && // help?
m_dialog == SD_NULL )
{
m_main->StartDisplayInfo(SATCOM_PROG, false);
}
if ( event.type == EVENT_STUDIO_COMPILE ) // compile?
{
if ( m_script->GetScript(edit) ) // compile
{
std::string res;
GetResource(RES_TEXT, RT_STUDIO_COMPOK, res);
SetInfoText(res, false);
}
else
{
std::string error;
//.........这里部分代码省略.........