本文整理汇总了C++中BCheckBox::Value方法的典型用法代码示例。如果您正苦于以下问题:C++ BCheckBox::Value方法的具体用法?C++ BCheckBox::Value怎么用?C++ BCheckBox::Value使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BCheckBox
的用法示例。
在下文中一共展示了BCheckBox::Value方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void
AGMSBayesianSpamFilterConfig::MessageReceived (BMessage *msg)
{
switch (msg->what)
{
case kAddSpamToSubjectPressed:
fAddSpamToSubject = fAddSpamToSubjectCheckBoxPntr->Value ();
break;
case kAutoTrainingPressed:
fAutoTraining = fAutoTrainingCheckBoxPntr->Value ();
break;
case kNoWordsMeansSpam:
fNoWordsMeansSpam = fNoWordsMeansSpamCheckBoxPntr->Value ();
break;
case kQuitWhenFinishedPressed:
fQuitServerWhenFinished =
fQuitServerWhenFinishedCheckBoxPntr->Value ();
break;
case kServerSettingsPressed:
ShowSpamServerConfigurationWindow ();
break;
default:
BView::MessageReceived (msg);
}
}
示例2:
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
}
示例3: message
void
AutomountSettingsPanel::_SendSettings(bool rescan)
{
BMessage message(kSetAutomounterParams);
message.AddBool("autoMountAll", (bool)fAutoMountAllCheck->Value());
message.AddBool("autoMountAllBFS", (bool)fAutoMountAllBFSCheck->Value());
if (fAutoMountAllBFSCheck->Value())
message.AddBool("autoMountAllHFS", false);
message.AddBool("suspended", (bool)fScanningDisabledCheck->Value());
message.AddBool("rescanNow", rescan);
message.AddBool("initialMountAll", (bool)fInitialMountAllCheck->Value());
message.AddBool("initialMountAllBFS",
(bool)fInitialMountAllBFSCheck->Value());
message.AddBool("initialMountRestore",
(bool)fInitialMountRestoreCheck->Value());
if (fInitialDontMountCheck->Value())
message.AddBool("initialMountAllHFS", false);
message.AddBool("ejectWhenUnmounting",
(bool)fEjectWhenUnmountingCheckBox->Value());
fTarget.SendMessage(&message);
}
示例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: 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);
}
}
示例6: GetPrefs
status_t GetPrefs(BMessage& pref)
{
if( !mOnBox || !mNameCtrl ) return B_ERROR;
// if( !mOnBox || !mNameCtrl || !mSkipBox ) return B_ERROR;
BMessage msg('null');
if( msg.AddBool( "on", (mOnBox->Value() == B_CONTROL_ON) ? true : false ) != B_OK ) return B_ERROR;
if( msg.AddString( "name", mNameCtrl->Text() ) != B_OK ) return B_ERROR;
if( mRef ) msg.AddRef( "ref", mRef );
// if( msg.AddBool( "skip", (mSkipBox->Value() == B_CONTROL_ON) ? true : false ) != B_OK ) return B_ERROR;
if( pref.AddMessage("new item", &msg) != B_OK ) return B_ERROR;
return B_OK;
}
示例7:
void
FadeView::MessageReceived(BMessage *message)
{
switch (message->what) {
case B_COLORS_UPDATED:
_UpdateColors();
break;
case kMsgRunSliderChanged:
case kMsgRunSliderUpdate:
if (fRunSlider->Value() > fTurnOffSlider->Value())
fTurnOffSlider->SetValue(fRunSlider->Value());
if (fRunSlider->Value() > fPasswordSlider->Value())
fPasswordSlider->SetValue(fRunSlider->Value());
break;
case kMsgTurnOffSliderChanged:
case kMsgTurnOffSliderUpdate:
if (fRunSlider->Value() > fTurnOffSlider->Value())
fRunSlider->SetValue(fTurnOffSlider->Value());
break;
case kMsgPasswordSliderChanged:
case kMsgPasswordSliderUpdate:
if (fPasswordSlider->Value() < fRunSlider->Value())
fRunSlider->SetValue(fPasswordSlider->Value());
break;
case kMsgTurnOffCheckBox:
fTurnOffSlider->SetEnabled(
fTurnOffCheckBox->Value() == B_CONTROL_ON);
break;
}
switch (message->what) {
case kMsgRunSliderChanged:
case kMsgTurnOffSliderChanged:
case kMsgPasswordSliderChanged:
case kMsgPasswordCheckBox:
case kMsgEnableScreenSaverBox:
case kMsgFadeCornerChanged:
case kMsgNeverFadeCornerChanged:
UpdateStatus();
fSettings.Save();
break;
default:
BView::MessageReceived(message);
}
}
示例8: ToggleTestIcons
void MenuWindow::ToggleTestIcons(BMessage* message)
{
if (! Valid()) {
return;
}
void* pSrc;
icon_size size = B_MINI_ICON;
if (message->FindPointer("source", &pSrc) == B_OK) {
BCheckBox* pCheckBox = reinterpret_cast<BCheckBox*>(pSrc);
size = (pCheckBox->Value() == B_CONTROL_ON) ? B_LARGE_ICON : B_MINI_ICON;
}
ReplaceTestMenu(m_pFullMenuBar, size);
ReplaceTestMenu(m_pHiddenMenuBar, size);
}
示例9: MessageReceived
//------------------------------------------------------------------------------
void WindowEditor::MessageReceived(BMessage *msg)
{
BMessage fwd;
switch (msg->what)
{
case MSG_WINDOW_SET_TITLE:
fwd.what = msg->what;
fwd.AddString("title", fTitleText->Text());
fEditWindow.SendMessage(&fwd);
break;
case MSG_WINDOW_SET_LOOK:
fEditWindow.SendMessage(msg);
break;
case MSG_WINDOW_SET_FLAG:
fwd.what = msg->what;
fwd.AddInt32("flags", MakeBitmask());
fEditWindow.SendMessage(&fwd);
break;
case MSG_WINDOW_ADD_MENU:
{
BCheckBox* cbox;
msg->FindPointer("source",(void **)(&cbox));
fwd.what = msg->what;
fwd.AddBool("addmenu", cbox->Value() == B_CONTROL_ON);
fEditWindow.SendMessage(&fwd);
break;
}
case MSG_WINDOW_SET_FEEL:
fEditWindow.SendMessage(msg);
break;
default:
BView::MessageReceived(msg);
break;
}
}
示例10: ToggleUserMenus
void MenuWindow::ToggleUserMenus(BMessage* message)
{
if (! Valid()) {
return;
}
void* pSrc;
bool useFullMenus = false;
if (message->FindPointer("source", &pSrc) == B_OK) {
BCheckBox* pCheckBox = reinterpret_cast<BCheckBox*>(pSrc);
useFullMenus = (pCheckBox->Value() == B_CONTROL_OFF);
}
if ((! useFullMenus) && m_bUsingFullMenuBar) {
RemoveChild(m_pFullMenuBar);
AddChild(m_pHiddenMenuBar);
m_bUsingFullMenuBar = false;
} else if (useFullMenus && (! m_bUsingFullMenuBar)) {
RemoveChild(m_pHiddenMenuBar);
AddChild(m_pFullMenuBar);
m_bUsingFullMenuBar = true;
}
}
示例11:
void
PartitionsPage::PageCompleted()
{
BGridLayout* layout = (BGridLayout*)fPartitions->GetLayout();
int32 index = 0;
for (int32 row = 0; row < layout->CountRows(); row += 3, index++) {
BCheckBox* showBox
= dynamic_cast<BCheckBox*>(layout->ItemAt(0, row)->View());
BTextControl* nameControl
= dynamic_cast<BTextControl*>(layout->ItemAt(1, row)->View());
if (nameControl == NULL || showBox == NULL)
debugger("partitions page is broken");
BMessage partition;
if (fSettings->FindMessage("partition", index, &partition) != B_OK)
continue;
partition.ReplaceBool("show", showBox->Value() != 0);
partition.ReplaceString("name", nameControl->Text());
fSettings->ReplaceMessage("partition", index, &partition);
}
}
示例12: MessageReceived
void PrefsWindow::MessageReceived(BMessage* message)
{
switch(message->what)
{
case PrefsConstants::K_PREFS_VIEW_RESET_COLOUR_DEFAULTS:
{
ResetToDefaults(PrefsConstants::K_RESET_COLOUR_PREFS);
}
break;
case PrefsConstants::K_PREFS_VIEW_RESET_COMMAND_DEFAULTS:
{
ResetToDefaults(PrefsConstants::K_RESET_COMMAND_PREFS);
}
break;
case PrefsConstants::K_PREFS_VIEW_RESET_TOOLBAR_DEFAULTS:
{
ResetToDefaults(PrefsConstants::K_RESET_TOOLBAR_PREFS);
}
break;
case PrefsConstants::K_PREFS_VIEW_RESET_GENERAL_DEFAULTS:
{
ResetToDefaults(PrefsConstants::K_RESET_GENERAL_PREFS);
}
break;
case PrefsConstants::K_PREFS_UPDATE:
{
//update the preferences message, from view values
BString prefsID;
if (message->FindString(K_PREFS_ID, &prefsID) == B_OK)
{
BView *changedView = m_parent->FindView(prefsID.String());
prefsLock.Lock();
//different view have different kinds of values
if (is_instance_of(changedView, BTextControl))
{
//a textcontrol value was changed, update preferences with new text
BTextControl *textControl = dynamic_cast<BTextControl*>(changedView);
preferences.ReplaceString(prefsID.String(), textControl->Text());
}
else if (is_instance_of(changedView, BCheckBox))
{
//a checkbox value was changed, update preferences with new bool value(on/off)
BCheckBox *checkBox = dynamic_cast<BCheckBox*>(changedView);
preferences.ReplaceBool(prefsID.String(), checkBox->Value());
}
else if (is_instance_of(changedView, BSlider))
{
//a slider value was changed, update preferences with new slider value
BSlider *slider = dynamic_cast<BSlider*>(changedView);
preferences.ReplaceInt32(prefsID.String(), slider->Value());
}
else if (is_instance_of(changedView, ColourButton))
{
//a colourcontrol value was changed, update preferences with new colour
ColourButton *colourControl = dynamic_cast<ColourButton*>(changedView);
preferences.ReplaceData(prefsID.String(),B_RGB_COLOR_TYPE, &colourControl->Value(), sizeof(rgb_color));
}
prefsLock.Unlock();
}
}
break;
case PrefsConstants::K_LOAD_PREFERENCES:
{
//set preferences view values to values of the preferences message
BString prefsID;
if (message->FindString(K_PREFS_ID, &prefsID) == B_OK)
{
//find out which view value has to be updated
BView *changedView = m_parent->FindView(prefsID.String());
prefsLock.Lock();
char *name;
uint32 type;
int32 count;
for (int32 i = 0; preferences.GetInfo(B_ANY_TYPE, i, &name, &type, &count) == B_OK; i++)
{
//find out what kind of field we are using
switch (type)
{
case B_INT32_TYPE:
{
int32 value;
preferences.FindInt32(name, &value);
if (is_instance_of(changedView, BSlider))
{
BSlider *slider = dynamic_cast<BSlider*>(changedView);
slider->SetValue(value);
}
}
break;
case B_BOOL_TYPE:
{
bool value;
preferences.FindBool(name, &value);
if (is_instance_of(changedView, BCheckBox))
{
BCheckBox *checkBox = dynamic_cast<BCheckBox*>(changedView);
checkBox->SetValue(value);
}
}
break;
//.........这里部分代码省略.........
示例13: _Save
status_t
ProtocolSettings::Save(const char* account, BView* parent)
{
if (!parent)
debugger("Couldn't save protocol's settings GUI on a NULL parent!");
BMessage* settings = new BMessage();
BMessage cur;
for (int32 i = 0; fTemplate->FindMessage("setting", i, &cur) == B_OK; i++) {
const char* name = cur.FindString("name");
// Skip NULL names
if (!name)
continue;
int32 type = -1;
if (cur.FindInt32("type", &type) != B_OK)
continue;
BView* view = parent->FindView(name);
if (!view)
continue;
BTextControl* textControl
= dynamic_cast<BTextControl*>(view);
if (textControl) {
switch (type) {
case B_STRING_TYPE:
settings->AddString(name, textControl->Text());
break;
case B_INT32_TYPE:
settings->AddInt32(name, atoi(textControl->Text()));
break;
default:
return B_ERROR;
}
}
BMenuField* menuField
= dynamic_cast<BMenuField*>(view);
if (menuField) {
BMenuItem* item = menuField->Menu()->FindMarked();
if (!item)
return B_ERROR;
switch (type) {
case B_STRING_TYPE:
settings->AddString(name, item->Label());
break;
case B_INT32_TYPE:
settings->AddInt32(name, atoi(item->Label()));
break;
default:
return B_ERROR;
}
}
BCheckBox* checkBox
= dynamic_cast<BCheckBox*>(view);
if (checkBox)
settings->AddBool(name, (checkBox->Value() == B_CONTROL_ON));
NotifyingTextView* textView
= dynamic_cast<NotifyingTextView*>(view);
if (textView)
settings->AddString(name, textView->Text());
}
return _Save(account, settings);
}
示例14: receivedFromUpdate
/*! \brief Main function of the View.
* \details Receives and parses the messages and updates the preferences if needed.
* \param[in] in The message to be parsed.
*/
void CalendarModulePreferencesView::MessageReceived( BMessage* in )
{
CalendarModulePreferences* prefs = NULL;
uint32 tempUint32 = 0;
int8 tempInt8 = 0;
int tempInt = 0;
BString sb;
BAlert* alert = NULL;
BCheckBox* cb = NULL;
BMessage* toSend;
CalendarModule* calModule = NULL;
CategoryListView* catListView = NULL;
CategoryListItem* catListItem = NULL;
Category receivedFromUpdate( BString("") );
ColorUpdateWindow* cuWindow = NULL;
bool weekend, weekday, viewer, service;
switch ( in->what )
{
case kCalendarModuleChosen:
if ( B_OK != in->FindString( "Module ID" , &sb ) )
return BView::MessageReceived( in );
BuildInterfaceForModule( sb );
break;
case kCalendarModuleFirstDayOfWeekSelected:
if ( ( B_OK != in->FindString( "Calendar module", &sb ) ) ||
( B_OK != in->FindInt32( "Day", ( int32* )&tempUint32 ) ) ||
( ( prefs = pref_GetPreferencesForCalendarModule( sb ) ) == NULL ) )
{
// Can't update - don't know what the module is!
BView::MessageReceived( in );
}
prefs->SetFirstDayOfWeek( tempUint32 );
// Refresh the view
BuildInterfaceForModule( sb );
break;
case kCalendarModuleWeekendDaySelected:
if ( ( B_OK != in->FindString( "Calendar module", &sb ) ) ||
( B_OK != in->FindInt32( "Weekday const", ( int32* )&tempUint32 ) ) ||
( ( prefs = pref_GetPreferencesForCalendarModule( sb ) ) == NULL ) )
{
// Can't update - don't know what the module is!
BView::MessageReceived( in );
}
calModule = utl_FindCalendarModule( sb );
sb.SetTo( "Weekday" );
sb << tempUint32;
if ( B_OK != ( cb = ( BCheckBox* )this->FindView( sb.String() ) ) )
BView::MessageReceived( in );
if ( cb->Value() == 0 ) // Deselected - removing from weekends
{
prefs->RemoveFromWeekends( tempUint32 );
} else { // Selected - adding to weekends
prefs->AddToWeekends( tempUint32 );
}
// :)
if ( calModule ) {
if ( prefs->GetNumberOfWeekends() == calModule->GetDaysInWeek() ) {
alert = new BAlert( "I envy you!",
"Wow! Nice week you have! I really envy you!",
":)",
NULL,
NULL,
B_WIDTH_AS_USUAL,
B_EVEN_SPACING,
B_IDEA_ALERT );
if ( alert )
alert->Go();
}
}
break;
case ( kCategoryInvoked ):
catListView = dynamic_cast< CategoryListView* >( this->FindView( "Colors list view" ) );
if ( !catListView ) {
break;
}
// Modifying currently existing category
tempInt = catListView->CurrentSelection();
if ( tempInt < 0 )
{
//.........这里部分代码省略.........
示例15: MessageReceived
void SeqPrefWin::MessageReceived(BMessage* msg)
{
switch (msg->what) {
case OK_MSG:
if (mOwqTable) mOwqTable->ReplacePreferences( mPreferences );
seq_app->SetPreferences(&mPreferences);
if (mUndoLevelCtrl) AmGlobals().SetUndoHistory(mUndoLevelCtrl->Value() );
if (mRefreshWindows != 0) RefreshWindows();
PostMessage(B_QUIT_REQUESTED);
break;
case CANCEL_MSG:
PostMessage(B_QUIT_REQUESTED);
break;
case CHANGE_SKIN_MSG:
{
const char* skin;
if (msg->FindString("seq:skin", &skin) == B_OK) {
SetStringPref(CURRENT_SKIN_PREF, skin);
new_skin_warning();
}
}
break;
case CHANGE_SKIN_TO_DEFAULT_MSG:
{
if( mPreferences.HasString(CURRENT_SKIN_PREF) ) mPreferences.RemoveData(CURRENT_SKIN_PREF);
new_skin_warning();
}
break;
case REMEMBER_OPEN_MSG:
{
BCheckBox* cb = dynamic_cast<BCheckBox*>( FindView(REMEMBER_OPEN_STR) );
if( cb ) SetBoolPref( REMEBER_OPEN_SONGS_PREF, cb->Value() );
}
break;
case OPEN_BLANK_MSG:
SetStringPref( OPEN_NEW_SONG_PREF, "blank" );
break;
case OPEN_FOUR_MSG:
SetStringPref( OPEN_NEW_SONG_PREF, "channels" );
SetInt32Pref( OPEN_NEW_SONG_CHANNEL_PREF, 2 );
break;
case OPEN_FILE_MSG:
SetStringPref( OPEN_NEW_SONG_PREF, "file" );
/* Open a file panel to select a new file.
*/
if (!mFilePanel ) mFilePanel = new BFilePanel(B_OPEN_PANEL, 0, 0, 0,
false);
if (mFilePanel->IsShowing() ) break;
if (mFilePanel->Window() ) {
mFilePanel->Window()->SetTitle("Select File" B_UTF8_ELLIPSIS);
}
mFilePanel->SetTarget(BMessenger(this));
mFilePanel->SetMessage( new BMessage('nfen') );
mFilePanel->Show();
break;
case 'nfen':
{
entry_ref ref;
if( msg->FindRef( "refs", &ref ) == B_OK ) {
SetOpenNewFromFileRef( &ref );
}
}
break;
case CHANGE_UNDO_HISTORY_MSG:
if (mUndoLevelCtrl) SetInt32Pref(UNDO_HISTORY_PREF, mUndoLevelCtrl->Value() );
break;
case TRACK_WIN_FOLLOW_MSG:
if (mTrackWinFollowCtrl) SetBoolPref(TRACK_WIN_FOLLOW_PREF, mTrackWinFollowCtrl->Value() == B_CONTROL_ON);
break;
case TRACK_WIN_PLAY_TO_END_MSG:
if (mTrackWinPlayToEndCtrl) SetBoolPref(TRACK_WIN_PLAY_TO_END_PREF, mTrackWinPlayToEndCtrl->Value() == B_CONTROL_ON);
break;
case TRACK_HEIGHT_MSG:
if (mTrackHeightCtrl) SetInt32Pref(TRACK_HEIGHT_PREF, mTrackHeightCtrl->Value() );
break;
case LABEL_HEIGHT_MSG:
if (mLabelHeightCtrl) {
SetInt32Pref(PHRASE_LABEL_HEIGHT_PREF, mLabelHeightCtrl->Value() );
mRefreshWindows |= SEQ_REFRESH_PHRASES;
}
break;
case VIEW_ROW_SELECTED_MSG:
FactoryRowSelected();
break;
default:
inherited::MessageReceived(msg);
break;
}
}