本文整理汇总了C++中BCheckBox::SetEnabled方法的典型用法代码示例。如果您正苦于以下问题:C++ BCheckBox::SetEnabled方法的具体用法?C++ BCheckBox::SetEnabled怎么用?C++ BCheckBox::SetEnabled使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BCheckBox
的用法示例。
在下文中一共展示了BCheckBox::SetEnabled方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void
FadeView::UpdateStatus()
{
Window()->DisableUpdates();
bool enabled = fEnableCheckBox->Value() == B_CONTROL_ON;
fPasswordCheckBox->SetEnabled(enabled);
fTurnOffCheckBox->SetEnabled(enabled && fTurnOffScreenFlags != 0);
fRunSlider->SetEnabled(enabled);
fTurnOffSlider->SetEnabled(enabled && fTurnOffCheckBox->Value());
fPasswordSlider->SetEnabled(enabled && fPasswordCheckBox->Value());
fPasswordButton->SetEnabled(enabled && fPasswordCheckBox->Value());
Window()->EnableUpdates();
// Update the saved preferences
fSettings.SetWindowFrame(Frame());
fSettings.SetTimeFlags((enabled ? ENABLE_SAVER : 0)
| (fTurnOffCheckBox->Value() ? fTurnOffScreenFlags : 0));
fSettings.SetBlankTime(fRunSlider->Time());
bigtime_t offTime = fTurnOffSlider->Time() - fSettings.BlankTime();
fSettings.SetOffTime(offTime);
fSettings.SetSuspendTime(offTime);
fSettings.SetStandByTime(offTime);
fSettings.SetBlankCorner(fFadeNow->Corner());
fSettings.SetNeverBlankCorner(fFadeNever->Corner());
fSettings.SetLockEnable(fPasswordCheckBox->Value());
fSettings.SetPasswordTime(fPasswordSlider->Time());
// TODO - Tell the password window to update its stuff
}
示例2:
void
BMailProtocolConfigView::SetTo(MailAddonSettings& settings)
{
const BMessage* archive = &settings.Settings();
BString host = archive->FindString("server");
if (archive->HasInt32("port"))
host << ':' << archive->FindInt32("port");
SetTextControl(this,"host", host.String());
SetTextControl(this,"user", archive->FindString("username"));
char *password = get_passwd(archive, "cpasswd");
if (password) {
SetTextControl(this,"pass", password);
delete[] password;
} else
SetTextControl(this,"pass", archive->FindString("password"));
if (archive->HasInt32("flavor")) {
BMenuField *menu = (BMenuField *)(FindView("flavor"));
if (menu != NULL) {
if (BMenuItem *item = menu->Menu()->ItemAt(archive->FindInt32("flavor")))
item->SetMarked(true);
}
}
if (archive->HasInt32("auth_method")) {
BMenuField *menu = (BMenuField *)(FindView("auth_method"));
if (menu != NULL) {
if (BMenuItem *item = menu->Menu()->ItemAt(archive->FindInt32("auth_method"))) {
item->SetMarked(true);
if (item->Command() != 'none') {
enable_control("user");
enable_control("pass");
}
}
}
}
BCheckBox *box = (BCheckBox *)(FindView("leave_mail_on_server"));
if (box != NULL)
box->SetValue(archive->FindBool("leave_mail_on_server") ? B_CONTROL_ON : B_CONTROL_OFF);
box = (BCheckBox *)(FindView("delete_remote_when_local"));
if (box != NULL) {
box->SetValue(archive->FindBool("delete_remote_when_local") ? B_CONTROL_ON : B_CONTROL_OFF);
if (archive->FindBool("leave_mail_on_server"))
box->SetEnabled(true);
else
box->SetEnabled(false);
}
if (fBodyDownloadConfig)
fBodyDownloadConfig->SetTo(settings);
}
示例3: hide_show_serial_ctrls
void PrefsWindow::hide_show_serial_ctrls(void)
{
if (udptunnel_checkbox->Value() == B_CONTROL_ON) {
ether_checkbox->SetEnabled(false);
udpport_ctrl->SetEnabled(true);
} else {
ether_checkbox->SetEnabled(true);
udpport_ctrl->SetEnabled(false);
}
}
示例4: screen
void
FadeView::UpdateTurnOffScreen()
{
bool enabled = (fSettings.TimeFlags() & ENABLE_DPMS_MASK) != 0;
BScreen screen(Window());
uint32 dpmsCapabilities = screen.DPMSCapabilites();
fTurnOffScreenFlags = 0;
if (dpmsCapabilities & B_DPMS_OFF)
fTurnOffScreenFlags |= ENABLE_DPMS_OFF;
if (dpmsCapabilities & B_DPMS_STAND_BY)
fTurnOffScreenFlags |= ENABLE_DPMS_STAND_BY;
if (dpmsCapabilities & B_DPMS_SUSPEND)
fTurnOffScreenFlags |= ENABLE_DPMS_SUSPEND;
fTurnOffCheckBox->SetValue(enabled && fTurnOffScreenFlags != 0
? B_CONTROL_ON : B_CONTROL_OFF);
enabled = fEnableCheckBox->Value() == B_CONTROL_ON;
fTurnOffCheckBox->SetEnabled(enabled && fTurnOffScreenFlags != 0);
if (fTurnOffScreenFlags != 0) {
fTurnOffNotSupported->Hide();
fTurnOffSlider->Show();
} else {
fTurnOffSlider->Hide();
fTurnOffNotSupported->Show();
}
}
示例5: SetControlEnable
void SetControlEnable(bool enable)
{
if( mNameCtrl ) mNameCtrl->SetEnabled( enable );
if( mFileButton ) mFileButton->SetEnabled( enable );
if( mSkipBox ) mSkipBox->SetEnabled( enable );
}
示例6: rect
//----------------Real code----------------------
BMailProtocolConfigView::BMailProtocolConfigView(uint32 options_mask)
:
BView (BRect(0,0,100,20), "protocol_config_view", B_FOLLOW_LEFT
| B_FOLLOW_TOP, B_WILL_DRAW),
fBodyDownloadConfig(NULL)
{
BRect rect(5,5,245,25);
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
// determine font height
font_height fontHeight;
GetFontHeight(&fontHeight);
sItemHeight = (int32)(fontHeight.ascent + fontHeight.descent + fontHeight.leading) + 13;
rect.bottom = rect.top - 2 + sItemHeight;
if (options_mask & B_MAIL_PROTOCOL_HAS_HOSTNAME)
AddChild(AddTextField(rect, "host", B_TRANSLATE("Mail server:")));
if (options_mask & B_MAIL_PROTOCOL_HAS_USERNAME)
AddChild(AddTextField(rect, "user", B_TRANSLATE("Username:")));
if (options_mask & B_MAIL_PROTOCOL_HAS_PASSWORD) {
BTextControl *control = AddTextField(rect, "pass",
B_TRANSLATE("Password:"));
control->TextView()->HideTyping(true);
AddChild(control);
}
if (options_mask & B_MAIL_PROTOCOL_HAS_FLAVORS)
AddChild(AddMenuField(rect, "flavor", B_TRANSLATE("Connection type:")));
if (options_mask & B_MAIL_PROTOCOL_HAS_AUTH_METHODS)
AddChild(AddMenuField(rect, "auth_method", B_TRANSLATE("Login type:")));
// set divider
float width = FindWidestLabel(this);
for (int32 i = CountChildren();i-- > 0;) {
if (BTextControl *text = dynamic_cast<BTextControl *>(ChildAt(i)))
text->SetDivider(width + 6);
}
if (options_mask & B_MAIL_PROTOCOL_CAN_LEAVE_MAIL_ON_SERVER) {
AddChild(AddCheckBox(rect, "leave_mail_on_server",
B_TRANSLATE("Leave mail on server"), new BMessage('lmos')));
BCheckBox* box = AddCheckBox(rect, "delete_remote_when_local",
B_TRANSLATE("Remove mail from server when deleted"));
box->SetEnabled(false);
AddChild(box);
}
if (options_mask & B_MAIL_PROTOCOL_PARTIAL_DOWNLOAD) {
fBodyDownloadConfig = new BodyDownloadConfig();
fBodyDownloadConfig->MoveBy(0, rect.bottom + 5);
AddChild(fBodyDownloadConfig);
}
// resize views
float height;
GetPreferredSize(&width,&height);
ResizeTo(width,height);
for (int32 i = CountChildren();i-- > 0;) {
// this doesn't work with BTextControl, does anyone know why? -- axeld.
if (BView *view = ChildAt(i))
view->ResizeTo(width - 10,view->Bounds().Height());
}
}