static void UpdateControls() { // Update volume name controls BOOL bVolume = IsButtonChecked(hDlg, IDC_VOLUME); ENABLE_STATE es = bVolume ? ES_ENABLE : ES_DISABLE; SetEnable(hDlg, IDC_VOLUME_NAME, es); SetEnable(hDlg, IDC_VOLUME_NAME_LABEL, es); GetWndText(hDlg, IDC_VOLUME_NAME, szVolumeName); // Num processes edit control BOOL bParallel = IsButtonChecked(hDlg, IDC_NUM_PROCESSES_CHECKBOX); SetEnable(hDlg, IDC_NUM_PROCESSES, (ENABLE_STATE)bParallel); GetWndText(hDlg, IDC_NUM_PROCESSES, szNumProcesses, NUM_PROCS_BUF_SIZE); GetWndText(hDlg, IDC_LOG_FILE, g_CfgData.szSalvageLogFileName, _MAX_PATH); GetWndText(hDlg, IDC_TEMP_DIR, szTempDir, _MAX_PATH); // Should OK button be enabled or disabled? BOOL bEnable = TRUE; if (bVolume) bEnable = !!lstrlen(szVolumeName); if (bEnable && bParallel) bEnable = !!lstrlen(szNumProcesses); SetEnable(hDlg, IDOK, (ENABLE_STATE)bEnable); }
static void EnableScMachine(BOOL bEnable) { SetEnable(hDlg, IDC_SC_MACHINE_LABEL, (ENABLE_STATE)bEnable); SetEnable(hDlg, IDC_SC_MACHINE, (ENABLE_STATE)bEnable); bSettingScMachine = TRUE; SetWndText(hDlg, IDC_SC_MACHINE, bEnable ? szScMachine : TEXT("")); bSettingScMachine = FALSE; }
void NumericUpDown::SetEnable(bool enable){ __super::SetEnable(enable); auto up = mUp.lock(); if (up) up->SetEnable(mValue < mMax && enable); auto down = mDown.lock(); if (down) down->SetEnable(mValue > mMin && enable); }
int CIEProxy::ReadReg() { SetEnable(0); SetHost(""); SetPort2(-1); SetOverride(""); HKEY hKeyIn = HKEY_CURRENT_USER, hKeyOut; if( ERROR_SUCCESS != RegOpenKeyExA(hKeyIn, "Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings", 0, KEY_CREATE_LINK | KEY_WRITE | KEY_READ | KEY_NOTIFY, &hKeyOut)) { return -1; } DWORD proxyEnable = 0; ULONG regSize = sizeof(DWORD); if(ERROR_SUCCESS != RegQueryValueExA(hKeyOut, "ProxyEnable", NULL, NULL, (BYTE *)&proxyEnable, ®Size)) { return 0; } SetEnable(proxyEnable); char proxyServer[1024] = { 0 }; regSize = sizeof(proxyServer); if(ERROR_SUCCESS != RegQueryValueExA(hKeyOut, "ProxyServer", NULL, NULL, (BYTE *)&proxyServer, ®Size)) { return 0; } string strProxyServer = proxyServer; if(strProxyServer.find("://") != string::npos) { strProxyServer = strProxyServer.substr(strProxyServer.find("://") + 3); } if(strProxyServer.find(":") != string::npos) { SetHost(strProxyServer.substr(0, strProxyServer.find(":"))); SetPort2(atoi(strProxyServer.substr(strProxyServer.find(":") + 1).c_str())); } else { SetHost(strProxyServer); SetPort2(80); } char proxyOverride[1024] = { 0 }; regSize = sizeof(proxyOverride); if(ERROR_SUCCESS == RegQueryValueExA(hKeyOut, "ProxyOverride", NULL, NULL, (BYTE *)&proxyOverride, ®Size)) { SetOverride(proxyOverride); } return 0; }
// Control update void EmMainUpdate(HWND hWnd, RPC *r) { // Validate arguments if (hWnd == NULL || r == NULL) { return; } SetEnable(hWnd, IDOK, LvIsMasked(hWnd, L_LIST) && LvIsMultiMasked(hWnd, L_LIST) == false); SetEnable(hWnd, B_DELETE, LvIsMasked(hWnd, L_LIST) && LvIsMultiMasked(hWnd, L_LIST) == false); }
void NumericUpDown::SetMinMax(int min, int max) { mMin = min; mMax = max; auto up = mUp.lock(); auto down = mDown.lock(); if (up && down){ up->SetEnable(mValue < mMax && mEnable); down->SetEnable(mValue > mMin && mEnable); } }
void Pit::SetCount(const uint32_t count) { STATE_GUARD(Pit, VOID); PIT->CHANNEL[m_channel].LDVAL = std::max<uint32_t>(count, 1) - 1; if (GET_BIT(PIT->CHANNEL[m_channel].TCTRL, PIT_TCTRL_TEN_SHIFT)) { SetEnable(false); SetEnable(true); } }
static void CheckEnableSc() { BOOL bSccEnable = TRUE; UINT uiSccStatusMsg; UINT uiSccActionMsg; BOOL bScsEnable = TRUE; UINT uiScsStatusMsg; UINT uiScsActionMsg; // Disable SCS and SCC? if (!bFsOn && !bDbOn) { bScsEnable = FALSE; uiScsStatusMsg = IDS_SC_DISABLED; uiScsActionMsg = IDS_SC_ENABLE; bSccEnable = FALSE; uiSccStatusMsg = IDS_SC_DISABLED; uiSccActionMsg = IDS_SC_ENABLE; // Disable SCS? } else if (bSccOn) { bScsEnable = FALSE; uiScsStatusMsg = IDS_SC_DISABLED; uiScsActionMsg = IDS_SCS_ENABLE; // Disable SCC } else if (bScsOn) { bSccEnable = FALSE; uiSccStatusMsg = IDS_SC_DISABLED; uiSccActionMsg = IDS_SCC_ENABLE; } // Enable the sc server GUI if (bScsEnable) { SetEnable(hDlg, IDC_SCS, ES_ENABLE); SetCheck(hDlg, IDC_SCS, bScsOn); } else { // Disable the sc server gui SetEnable(hDlg, IDC_SCS, ES_DISABLE); SetCheck(hDlg, IDC_SCS, FALSE); SetWndText(hDlg, IDC_SCS_STATUS_MSG, uiScsStatusMsg); SetWndText(hDlg, IDC_SCS_ACTION_MSG, uiScsActionMsg); } // Enable the sc client GUI if (bSccEnable) { SetEnable(hDlg, IDC_SCC, ES_ENABLE); SetCheck(hDlg, IDC_SCC, bSccOn); EnableScMachine(bSccOn); } else { // Disable the sc client gui SetEnable(hDlg, IDC_SCC, ES_DISABLE); SetCheck(hDlg, IDC_SCC, FALSE); SetWndText(hDlg, IDC_SCC_STATUS_MSG, uiSccStatusMsg); SetWndText(hDlg, IDC_SCC_ACTION_MSG, uiSccActionMsg); EnableScMachine(FALSE); } }
static void CheckEnableBak() { // Enable/disable bk service based on db service. if (!bDbOn) { SetCheck(hDlg, IDC_BK_SERVICE, FALSE); SetEnable(hDlg, IDC_BK_SERVICE, ES_DISABLE); SetWndText(hDlg, IDC_BK_STATUS_MSG, IDS_BK_DISABLED); SetWndText(hDlg, IDC_BK_ACTION_MSG, IDS_BK_ENABLE); } else { SetCheck(hDlg, IDC_BK_SERVICE, bBakOn); SetEnable(hDlg, IDC_BK_SERVICE, ES_ENABLE); } }
void NumericUpDown::InitializeButtons() { //mDown = (Button*)AddChild(0.0, 0.0, 0.33333f, 1.0f, ComponentType::Button); assert(mDown.expired()); auto down = std::static_pointer_cast<Button>(AddChild(ComponentType::Button)); mDown = down; down->SetName("down"); down->SetRuntimeChild(true); //mUp = (Button*)AddChild(1.0, 0.0, 0.33333f, 1.0f, ComponentType::Button); auto up = std::static_pointer_cast<Button>(AddChild(ComponentType::Button)); mUp = up; up->SetName("up"); up->SetRuntimeChild(true); down->ChangeSize(Vec2I(20, 20)); down->ChangeNPos(Vec2(0, 0)); down->SetUseAbsPos(false); down->SetProperty(UIProperty::REGION, "DownTriangle"); down->SetProperty(UIProperty::IMAGE_COLOR_OVERLAY, "1, 1, 0, 1"); down->SetProperty(UIProperty::NO_BACKGROUND, "true"); down->RegisterEventFunc(UIEvents::EVENT_MOUSE_LEFT_CLICK, std::bind(&NumericUpDown::OnDown, this, std::placeholders::_1)); down->SetEnable(mValue > mMin && mEnable); up->ChangeSize(Vec2I(20, 20)); up->ChangeNPos(Vec2(1, 0)); up->SetUseAbsPos(false); up->SetProperty(UIProperty::REGION, "UpTriangle"); up->SetProperty(UIProperty::IMAGE_COLOR_OVERLAY, "1, 1, 0, 1"); up->SetProperty(UIProperty::ALIGNH, "right"); up->SetProperty(UIProperty::NO_BACKGROUND, "true"); up->RegisterEventFunc(UIEvents::EVENT_MOUSE_LEFT_CLICK, std::bind(&NumericUpDown::OnUp, this, std::placeholders::_1)); up->SetEnable(mValue < mMax && mEnable); SetProperty(UIProperty::TEXT_ALIGN, "center"); WCHAR buffer[100]; swprintf_s(buffer, L"%d", mValue); SetText(buffer); if (up && down){ mValue = std::min(mValue, mMax); mValue = std::max(mValue, mMin); SetNumber(mValue); } }
void CWindowLOGINMENU::Update(void) { int nCharCount; PCInfoAccount pInfoAccount; SetEnable (1, FALSE); pInfoAccount = m_pMgrData->GetAccount (); nCharCount = pInfoAccount->m_adwCharID.GetSize (); if (nCharCount == 0) { SetEnable (0, FALSE); SetEnable (2, FALSE); } else { SetEnable (0, TRUE); SetEnable (2, TRUE); } if ((nCharCount >= 0) && (nCharCount < 3)) { SetEnable (1, TRUE); } //Todo: SetEnable (2, FALSE); SetEnable (3, TRUE); CWindowBase::Update (); }
// License dialog control update void EmLicenseDlgUpdate(HWND hWnd, RPC *s) { bool b = false; // Validate arguments if (hWnd == NULL || s == NULL) { return; } b = LvIsSingleSelected(hWnd, L_LIST); SetEnable(hWnd, B_DEL, b); SetEnable(hWnd, IDOK, b); }
// 重置 void AcceptorProxy::Reset(const std::string& ip, int port, bool enable, bool reload) { if (ip != m_Ip || port != m_Port || enable != m_Enable) { SetIp(ip); SetPort(port); SetEnable(enable); if (reload) { if (m_Enable) { RestartAcceptor(); } else if (m_Acceptor) { m_Acceptor->Stop(); } } else if (m_Acceptor) { RestartAcceptor(); } } }
void NumericUpDown::SetNumber(int number) { mValue = number; mValue = std::min(mMax, mValue); mValue = std::max(mMin, mValue); WCHAR buffer[100]; swprintf_s(buffer, L"%d", mValue); SetText(buffer); auto up = mUp.lock(); if (up) up->SetEnable(mValue < mMax && mEnable); auto down = mDown.lock(); if (down) down->SetEnable(mValue > mMin && mEnable); OnEvent(UIEvents::EVENT_NUMERIC_SET); }
//------------------------------------------------ // ctor //------------------------------------------------ InputXInput::InputXInput( HINSTANCE hInstance ) : InputDevice( hInstance ) , padID_( -1 ) , timeFFB_( 0 ) , isConnect_( false ) , isGeneratingFFB_( false ) { // XInput有効にする XInputEnable( TRUE ); // PADに管理用IDを振る padID_ = InputXInput::padCnt_; // パッドの数を更新 ++padCnt_; // XInputの能力を取得 XINPUT_CAPABILITIES capability; DWORD result = XInputGetCapabilities( padID_, XINPUT_FLAG_GAMEPAD, &capability ); // 使用の可否を更新 SetEnable( result == ERROR_SUCCESS ); // 振動をON SetEnableFFB( true ); }
MkWindowBaseNode::MkWindowBaseNode(const MkHashStr& name) : MkWindowThemedNode(name) { SetAcceptInput(true); SetEnable(true); m_CursorInside = false; m_HoldingEventType = ePA_SNE_None; }
FileLogListener::FileLogListener(const char *filename) { #ifdef _WIN32 m_logfile.open(ConvertUTF8ToWString(filename).c_str(), std::ios::app); #else m_logfile.open(filename, std::ios::app); #endif SetEnable(true); }
// Change Password dialog UINT EmPasswordDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) { RPC *r = (RPC *)param; char pass1[MAX_PATH]; char pass2[MAX_PATH]; UCHAR hash[SHA1_SIZE]; RPC_SET_PASSWORD t; // Validate arguments if (hWnd == NULL) { return 0; } switch (msg) { case WM_INITDIALOG: Focus(hWnd, E_PASSWORD1); break; case WM_COMMAND: switch (wParam) { case IDOK: GetTxtA(hWnd, E_PASSWORD1, pass1, sizeof(pass1)); Hash(hash, pass1, StrLen(pass1), true); Zero(&t, sizeof(t)); Copy(t.HashedPassword, hash, SHA1_SIZE); if (CALL(hWnd, EcSetPassword(r, &t)) == false) { break; } MsgBox(hWnd, MB_ICONINFORMATION, _UU("CM_PASSWORD_SET")); EndDialog(hWnd, 1); break; case IDCANCEL: Close(hWnd); break; } switch (LOWORD(wParam)) { case E_PASSWORD1: case E_PASSWORD2: GetTxtA(hWnd, E_PASSWORD1, pass1, sizeof(pass1)); GetTxtA(hWnd, E_PASSWORD2, pass2, sizeof(pass2)); SetEnable(hWnd, IDOK, StrCmp(pass1, pass2) == 0 ? true : false); break; } break; case WM_CLOSE: EndDialog(hWnd, 0); break; } return 0; }
BOOL Mp3Dlg::OnInitDialog(HWND hDlg, WPARAM wParam, LPARAM lParam) { CheckDlgButton(hDlg, IDC_USE_ID3V2, Profile::blnUseId3v2 ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hDlg, IDC_USE_CUE,Profile::blnUseCue ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hDlg, IDC_USE_MP3CUE, Profile::blnUseMp3Cue ? BST_CHECKED : BST_UNCHECKED); SetEnable(); return FALSE; }
// Change Password dialog UINT NmChangePasswordProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) { RPC *r = (RPC *)param; char tmp1[MAX_SIZE]; char tmp2[MAX_SIZE]; RPC_SET_PASSWORD t; // Validate arguments if (hWnd == NULL) { return 0; } switch (msg) { case WM_INITDIALOG: FormatText(hWnd, 0, r->Sock->RemoteHostname); FormatText(hWnd, S_TITLE, r->Sock->RemoteHostname); break; case WM_COMMAND: GetTxtA(hWnd, E_PASSWORD1, tmp1, sizeof(tmp1)); GetTxtA(hWnd, E_PASSWORD2, tmp2, sizeof(tmp2)); switch (LOWORD(wParam)) { case E_PASSWORD1: case E_PASSWORD2: SetEnable(hWnd, IDOK, StrCmp(tmp1, tmp2) == 0); break; } switch (wParam) { case IDOK: Zero(&t, sizeof(t)); Hash(t.HashedPassword, tmp1, StrLen(tmp1), true); if (CALL(hWnd, NcSetPassword(r, &t))) { MsgBox(hWnd, MB_ICONINFORMATION, _UU("NM_PASSWORD_MSG")); EndDialog(hWnd, true); } break; case IDCANCEL: Close(hWnd); break; } break; case WM_CLOSE: EndDialog(hWnd, false); break; } return 0; }
BOOL SkinDlg::OnInitDialog(HWND hDlg, WPARAM wParam, LPARAM lParam) { CheckRadioButton(hDlg, IDC_SKIN_PLUGIN1, IDC_SKIN_OTHER1, IDC_SKIN_PLUGIN1 + Profile::intSkin1); CheckRadioButton(hDlg, IDC_SKIN_WINAMP2, IDC_SKIN_OTHER2, IDC_SKIN_WINAMP2 + Profile::intSkin2); SetDlgItemText(hDlg, IDC_SKIN_DIR1, Profile::strSkinDir1.c_str()); SetDlgItemText(hDlg, IDC_SKIN_DIR2, Profile::strSkinDir2.c_str()); SetEnable(); return FALSE; }
void PreferenceWindow::CheckChanged(QListWidgetItem* item) { QString t = item->text(); bool e = false; if (item->checkState() == Qt::Checked) { e = true; } emit SetEnable(t, e); }
void Pit::Uninit() { if (m_is_init) { m_is_init = false; SetIsr(nullptr); SetEnable(false); g_instances[m_channel] = nullptr; } }
bool bullet::FrameFunc(float dt) { if (!GetEnable()) { return false; } m_time +=dt; FLOAT arc = m_r*M_PI/180.0f; x = m_time*m_power*cosf(arc) + m_v1.x; y = m_time*m_power*sinf(arc) - m_time*m_time*4.9f + m_v1.y; //4.9=9.8/2 FPOINT v1; v1.Set(x,y); // ДІРэВагА if (m_time/0.5f == 0.0f) m_v1_onscr3 = m_v1_onscr2; m_v1_onscr2 = m_v1_onscr1; m_v1_onscr1 = m_v1_onscr; m_tank2->WorldToScreen(v1,m_v1_onscr); if (m_v1_onscr.x <0 || m_v1_onscr.x > m_tank2->m_state.m_ScreenW || m_v1_onscr.y <0 || m_v1_onscr.y > m_tank2->m_state.m_ScreenH) { // out of screen SetEnable(false); } if (ContactCheck()) { // Contact SetEnable(false); } return false; }
Pit::Pit(const Config &config) : m_channel(config.channel), m_is_init(true) { assert(m_channel < PIT_COUNT); assert(!g_instances[m_channel]); assert(config.count > 0); g_instances[m_channel] = this; // System enable PIT Sim::SetEnableClockGate(Sim::ClockGate::kPit, true); CLEAR_BIT(PIT->MCR, PIT_MCR_MDIS_SHIFT); CLEAR_BIT(PIT->MCR, PIT_MCR_FRZ_SHIFT); SetEnable(false); SetCount(config.count); ConsumeInterrupt(); SetIsr(config.isr); if (config.is_enable) { SetEnable(true); } }
void ShowAndEnable(HWND hDlg, UINT uiCtrlID, BOOL bShowAndEnable) { int nShow = SW_SHOW; ENABLE_STATE es = ES_ENABLE; if (!bShowAndEnable) { nShow = SW_HIDE; es = ES_DISABLE; } ShowWnd(hDlg, uiCtrlID, nShow); SetEnable(hDlg, uiCtrlID, es); }
/* * Event Handler Functions _________________________________________________________________ * */ static void OnInitDialog(HWND hwndDlg) { hDlg = hwndDlg; bAdvanced = TRUE; TCHAR szNumProcesses[32]; _itot(DEFAULT_NUM_PROCESSES, szNumProcesses, 10); SetWndText(hDlg, IDC_NUM_PROCESSES, szNumProcesses); SetCheck(hDlg, IDC_NUM_PROCESSES_CHECKBOX); SetWndText(hDlg, IDC_LOG_FILE, A2S(DEFAULT_LOG_FILE)); // If a partition name isn't selected, then only allow the salvage server option if (szPartitionName[0] == 0) { SetEnable(hDlg, IDC_PARTITION, ES_DISABLE); SetEnable(hDlg, IDC_VOLUME, ES_DISABLE); SetCheck(hDlg, IDC_SERVER); } else SetCheck(hDlg, IDC_PARTITION); // Close the Advanced portion of the dialog OnAdvanced(); }
void CardMgr::OnTouch(int child_tag) { bool all_finish = false; StageInfo& config = ConfigInfo::Instence().GetStageInfo(stage_id_); if(sub_stage_ >= sizeof(config.play_count_)/sizeof(config.play_count_[0])) all_finish = true; SetEnable(false); play_scene_->ShowProperty(false); if(child_tag == bingo_index_) { //猜对了 //这个时候已经finishsubstage,所以sub_stage_要减1 play_scene_->SubStageEnd(all_finish, true, sub_stage_-1); } else { play_scene_->SubStageEnd(all_finish, false, sub_stage_-1); } }
static void IsFirstServer(BOOL bIs) { ENABLE_STATE es; if (bIs) es = ES_ENABLE; else es = ES_DISABLE; SetEnable(hDlg, IDC_PRINCIPAL_LABEL, es); SetEnable(hDlg, IDC_PRINCIPAL, es); SetEnable(hDlg, IDC_SERVER_PW_FRAME, es); SetEnable(hDlg, IDC_SERVER_PW_LABEL, es); SetEnable(hDlg, IDC_SERVER_PW_PROMPT, es); SetEnable(hDlg, IDC_SERVER_PW, es); SetEnable(hDlg, IDC_VERIFY_PW_LABEL, es); SetEnable(hDlg, IDC_VERIFY_PW, es); CheckEnableButtons(); }
int ProcessFieldsTD::Process() { if (Enabled==false) return -1; if (CheckTimestep()==false) return GetNextInterval(); string filename = m_filename; float**** field = CalcField(); bool success = true; if (m_fileType==VTK_FILETYPE) { m_Vtk_Dump_File->SetTimestep(m_Eng_Interface->GetNumberOfTimesteps()); m_Vtk_Dump_File->ClearAllFields(); m_Vtk_Dump_File->AddVectorField(GetFieldNameByType(m_DumpType),field); success &= m_Vtk_Dump_File->Write(); } else if (m_fileType==HDF5_FILETYPE) { stringstream ss; ss << std::setw( pad_length ) << std::setfill( '0' ) << m_Eng_Interface->GetNumberOfTimesteps(); size_t datasize[]={numLines[0],numLines[1],numLines[2]}; success &= m_HDF5_Dump_File->WriteVectorField(ss.str(), field, datasize); float time[1]={m_Eng_Interface->GetTime(m_dualTime)}; success &= m_HDF5_Dump_File->WriteAtrribute("/FieldData/TD/"+ss.str(),"time",time,1); } else { success = false; cerr << "ProcessFieldsTD::Process: unknown File-Type" << endl; } Delete_N_3DArray<FDTD_FLOAT>(field,numLines); if (success==false) { SetEnable(false); cerr << "ProcessFieldsTD::Process: can't dump to file... disabled! " << endl; } return GetNextInterval(); }