当前位置: 首页>>代码示例>>C++>>正文


C++ BCheckBox::SetValue方法代码示例

本文整理汇总了C++中BCheckBox::SetValue方法的典型用法代码示例。如果您正苦于以下问题:C++ BCheckBox::SetValue方法的具体用法?C++ BCheckBox::SetValue怎么用?C++ BCheckBox::SetValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BCheckBox的用法示例。


在下文中一共展示了BCheckBox::SetValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: BView

BView *PrefsWindow::create_serial_pane(void)
{
    BView *pane = new BView(BRect(0, 0, top_frame.right-20, top_frame.bottom-80), GetString(STR_SERIAL_NETWORK_PANE_TITLE), B_FOLLOW_NONE, B_WILL_DRAW);
    pane->SetViewColor(fill_color);
    float right = pane->Bounds().right-10;

    BMenuField *menu_field;
    BPopUpMenu *menu_a = new BPopUpMenu("");
    add_serial_names(menu_a, MSG_SER_A);
    menu_field = new BMenuField(BRect(10, 5, right, 20), "seriala", GetString(STR_SERIALA_CTRL), menu_a);
    menu_field->SetDivider(90);
    pane->AddChild(menu_field);
    set_serial_label(menu_a, "seriala");

    BPopUpMenu *menu_b = new BPopUpMenu("");
    add_serial_names(menu_b, MSG_SER_B);
    menu_field = new BMenuField(BRect(10, 26, right, 41), "serialb", GetString(STR_SERIALB_CTRL), menu_b);
    menu_field->SetDivider(90);
    pane->AddChild(menu_field);
    set_serial_label(menu_b, "serialb");

    ether_checkbox = new BCheckBox(BRect(10, 47, right, 62), "ether", GetString(STR_ETHER_ENABLE_CTRL), new BMessage(MSG_ETHER));
    pane->AddChild(ether_checkbox);
    ether_checkbox->SetValue(PrefsFindString("ether") ? B_CONTROL_ON : B_CONTROL_OFF);

    udptunnel_checkbox = new BCheckBox(BRect(10, 67, right, 72), "udptunnel", GetString(STR_UDPTUNNEL_CTRL), new BMessage(MSG_UDPTUNNEL));
    pane->AddChild(udptunnel_checkbox);
    udptunnel_checkbox->SetValue(PrefsFindBool("udptunnel") ? B_CONTROL_ON : B_CONTROL_OFF);

    udpport_ctrl = new NumberControl(BRect(10, 87, right / 2, 105), 118, "udpport", GetString(STR_UDPPORT_CTRL), PrefsFindInt32("udpport"), NULL);
    pane->AddChild(udpport_ctrl);

    hide_show_serial_ctrls();
    return pane;
}
开发者ID:AlexandreCo,项目名称:macemu,代码行数:35,代码来源:prefs_editor_beos.cpp

示例2:

void
FadeView::AttachedToWindow()
{
    fEnableCheckBox->SetTarget(this);
    fRunSlider->SetTarget(this);
    fTurnOffCheckBox->SetTarget(this);
    fTurnOffSlider->SetTarget(this);
    fFadeNow->SetTarget(this);
    fFadeNever->SetTarget(this);
    fPasswordCheckBox->SetTarget(this);
    fPasswordSlider->SetTarget(this);

    fEnableCheckBox->SetValue(
        fSettings.TimeFlags() & ENABLE_SAVER ? B_CONTROL_ON : B_CONTROL_OFF);
    fRunSlider->SetTime(fSettings.BlankTime());
    fTurnOffSlider->SetTime(fSettings.OffTime() + fSettings.BlankTime());
    fFadeNow->SetCorner(fSettings.BlankCorner());
    fFadeNever->SetCorner(fSettings.NeverBlankCorner());
    fPasswordCheckBox->SetValue(fSettings.LockEnable());
    fPasswordSlider->SetTime(fSettings.PasswordTime());

    _UpdateColors();
    UpdateTurnOffScreen();
    UpdateStatus();
}
开发者ID:AmirAbrams,项目名称:haiku,代码行数:25,代码来源:ScreenSaverWindow.cpp

示例3: dir

BRect
LibraryWindow::ScanFolder(BPoint location, const char *path, float *maxwidth)
{
    BDirectory dir(path);
    if (dir.InitCheck() != B_OK)
        return BRect(0,0,-1,-1);
    
    float width = 0.0;
    dir.Rewind();
    entry_ref ref;
    BRect r(location.x,location.y,location.x + 1,location.y + 1);
    
    while (dir.GetNextRef(&ref) == B_OK)
    {
        BString str(ref.name);
        
        int32 soPos = str.FindLast(".so");
        int32 aPos = str.FindLast(".a");
        
        if (soPos < 0 && aPos < 0)
            continue;
        
        if (soPos >= 0 && soPos < str.CountChars() - 3)
            continue;
        
        if (aPos >= 0 && aPos < str.CountChars() - 2)
            continue;
        
        Lock();	
        BMessage *msg = new BMessage(M_TOGGLE_LIB);
        msg->AddRef("ref",&ref);
        msg->AddString("path",path);
        BCheckBox *box = new BCheckBox(r,ref.name,ref.name,msg);
        box->ResizeToPreferred();
        r = box->Frame();
        fCheckList->AddChild(box);
        fSystemLibs.AddItem(box);
        
        // Make sure that there isn't any shortcut normalization
        BPath dirpath(path);
        dirpath.Append(ref.name);
        
        if (fProject && fProject->HasLibrary(dirpath.Path()))
            box->SetValue(B_CONTROL_ON);
        else
            box->SetValue(B_CONTROL_OFF);
        Unlock();
        
        
        width = MAX(r.right,width);
        r.OffsetBy(0,r.Height());
    }
    
    if (r.Height() == 1)
        r.Set(0, 0, -1, -1);
    
    *maxwidth = width;
    return r;
}
开发者ID:passick,项目名称:Paladin,代码行数:59,代码来源:LibWindow.cpp

示例4:

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);
}
开发者ID:mylegacy,项目名称:haiku,代码行数:58,代码来源:ProtocolConfigView.cpp

示例5: SetPrefs

    void SetPrefs(const BMessage* prefs)
    {
        if( !prefs ) return;
        mOldPrefs.MakeEmpty();
        mOldPrefs = *prefs;
        delete mRef;
        mRef = 0;
        bool		b;
        const char*	str;
        entry_ref	ref;
        if( mOnBox && prefs->FindBool( "on", &b ) == B_OK ) mOnBox->SetValue( (b) ? B_CONTROL_ON : B_CONTROL_OFF );
        if( mNameCtrl && prefs->FindString( "name", &str ) == B_OK ) mNameCtrl->SetText( str );
        if( prefs->FindRef( "ref", &ref ) == B_OK ) mRef = new entry_ref( ref );
        if( mSkipBox && prefs->FindBool( "skip", &b ) == B_OK ) mSkipBox->SetValue( (b) ? B_CONTROL_ON : B_CONTROL_OFF );
    }
开发者ID:dtbinh,项目名称:Sequitur,代码行数:15,代码来源:SeqPrefWin.cpp

示例6: 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();
    }
}
开发者ID:,项目名称:,代码行数:29,代码来源:

示例7: BCheckBox

void
JobSetupView::AddCheckBox(const DriverSpecificCap* capability,
    BGridLayout* gridLayout, int& row)
{
    PrinterCap::CapID category = static_cast<PrinterCap::CapID>(
        capability->ID());
    const BooleanCap* booleanCap = fPrinterCap->FindBooleanCap(category);
    if (booleanCap == NULL) {
        fprintf(stderr, "Internal error: BooleanCap for '%s' not found!\n",
            capability->Label());
        return;
    }

    const char* key = capability->Key();
    BString name;
    name << "pds_" << key;
    BCheckBox* checkBox = new BCheckBox(name.String(), capability->Label(),
        NULL);

    bool value = booleanCap->DefaultValue();
    if (fJobData->Settings().HasBoolean(key))
        value = fJobData->Settings().GetBoolean(key);
    if (value)
        checkBox->SetValue(B_CONTROL_ON);

    gridLayout->AddView(checkBox, 0, row, 2);
    row ++;

    fDriverSpecificCheckBoxes[capability->Key()] = checkBox;
}
开发者ID:,项目名称:,代码行数:30,代码来源:

示例8: fParent

DetailsBuilder::DetailsBuilder(BView* parent, BView* details, BRect bounds, Statement* group, const BMessage& settings)
    : fParent(parent)
    , fDetails(details)
    , fBounds(bounds)
    , fGroup(group)
    , fMenu(NULL)
    , fMenuField(NULL)
    , fSettings(settings)
{
    fKeyword = fGroup.GetGroupName();

    if (fKeyword == NULL) return;

    fValue = settings.FindString(fKeyword);
        
    const char* label = fGroup.GetGroupTranslation();
    if (label == NULL) {
        label = fKeyword;
    }

    BView* view = NULL;
    if (fGroup.GetType() == GroupStatement::kPickOne) {
        fMenu = new BMenu("<pick one>");
        fMenu->SetRadioMode(true);
        fMenu->SetLabelFromMarked(true);
        fMenuField = new BMenuField(fBounds, "menuField", label, fMenu);
        view = fMenuField;
    } else if (fGroup.GetType() == GroupStatement::kBoolean) {
        BMessage* message = GetMessage(kMsgBooleanChanged, "");
        BCheckBox* cb = new BCheckBox(fBounds, "", label, message);
        view = cb;
        cb->SetValue((fValue != NULL && strcmp(fValue, "True") == 0)
            ? B_CONTROL_ON
            : B_CONTROL_OFF);
    }

    AddView(view);
}
开发者ID:SummerSnail2014,项目名称:haiku,代码行数:38,代码来源:PPDConfigView.cpp

示例9: ValueChanged

void MessageView::ValueChanged(void)
{
    char		*name; 
    uint32		type; 
    int32		count;
    #ifdef B_ZETA_VERSION_1_0_0
    for (int32 i = 0; configMessage->GetInfo(B_ANY_TYPE, i,(const char **) &name, &type, &count) == B_OK; i++)
    #else
    for (int32 i = 0; configMessage->GetInfo(B_ANY_TYPE, i,(char **) &name, &type, &count) == B_OK; i++)
    #endif
    {
        //calculate the Position where to add the next View
        float top = ItemTop();
        BRect rect = BRect(MARGIN_SPACE,top,Bounds().right-MARGIN_SPACE,top);
        switch(type)
        {
            case B_STRING_TYPE:
            {
                char		*string;
                configMessage->FindString(name,count-1,(const char **)&string);
                BTextControl	*stringItem	= new BTextControl(rect,name,name,string,NULL);
                AddChild(stringItem);
                BMessage	*tmpMessage = new BMessage(B_CONTROL_INVOKED);
                tmpMessage->AddString("name",name);
                tmpMessage->AddInt32("count",count-1);
                tmpMessage->AddInt32("type",type);
                stringItem->SetMessage(tmpMessage);
                break;
            }
            case B_RECT_TYPE:
            {
                BRect	valueRect;
                configMessage->FindRect(name,count-1,&valueRect);
                RectItem	*rectItem	= new RectItem(rect,name,valueRect);
                AddChild(rectItem);
                BMessage	*tmpMessage = new BMessage(B_CONTROL_INVOKED);
                tmpMessage->AddString("name",name);
                tmpMessage->AddInt32("count",count-1);
                tmpMessage->AddInt32("type",type);
                rectItem->SetMessage(tmpMessage);
                break;
            }
            case B_FLOAT_TYPE:
            {
                float	value;
                configMessage->FindFloat(name,count-1,&value);
                BString	floatString;
                floatString<<value;
                BTextControl	*stringItem	= new BTextControl(rect,name,name,floatString.String(),NULL);
                AddChild(stringItem);
                BMessage	*tmpMessage = new BMessage(B_CONTROL_INVOKED);
                tmpMessage->AddString("name",name);
                tmpMessage->AddInt32("count",count-1);
                tmpMessage->AddInt32("type",type);
                stringItem->SetMessage(tmpMessage);
                break;
            }
            case B_INT8_TYPE:
            case B_INT16_TYPE:
            case B_INT32_TYPE:
            {
                int32	value;
                configMessage->FindInt32(name,count-1,&value);
                BString	intString;
                intString<<value;
                BTextControl	*stringItem	= new BTextControl(rect,name,name,intString.String(),NULL);
                AddChild(stringItem);
                BMessage	*tmpMessage = new BMessage(B_CONTROL_INVOKED);
                tmpMessage->AddString("name",name);
                tmpMessage->AddInt32("count",count-1);
                tmpMessage->AddInt32("type",type);
                stringItem->SetMessage(tmpMessage);
                break;
            }
            case B_BOOL_TYPE:
            {
                bool	value;
                configMessage->FindBool(name,count-1,&value);
                BCheckBox	*boolItem	= new BCheckBox(rect,name,name,NULL);
                AddChild(boolItem);
                boolItem->SetValue(value);
                BMessage	*tmpMessage = new BMessage(B_CONTROL_INVOKED);
                tmpMessage->AddString("name",name);
                tmpMessage->AddInt32("count",count-1);
                tmpMessage->AddInt32("type",type);
                boolItem->SetMessage(tmpMessage);
                break;
            }
        }

    } 
}
开发者ID:BackupTheBerlios,项目名称:projectconcepto-svn,代码行数:92,代码来源:MessageView.cpp

示例10: NewFileView

BView* SeqPrefWin::NewFileView(BRect bounds, const BMessage& prefs) const
{
    BView*		v = new BView( bounds, FILE_STR, B_FOLLOW_ALL, 0 );
    if( !v ) return v;
    v->SetViewColor( Prefs().Color(AM_AUX_WINDOW_BG_C) );
    float		fh = view_font_height(v);
    float		bfh = bold_font_height();
    float		openH = bfh + 5 + fh + 5 + fh + 5 + fh;
    /* The Remember Open Songs preference.
     */
    float		w = v->StringWidth("Remember open songs") + 25;
    BRect		f(bounds.left + 5, bounds.top + 5, bounds.left + 5 + w, bounds.top + 5 + fh);
    BCheckBox*	cb = new BCheckBox( f, REMEMBER_OPEN_STR, "Remember open songs", new BMessage(REMEMBER_OPEN_MSG) );
    if( cb ) {
        bool	b;
        if( prefs.FindBool(REMEBER_OPEN_SONGS_PREF, &b) != B_OK ) b = false;
        cb->SetValue( (b) ? B_CONTROL_ON : B_CONTROL_OFF );
        v->AddChild( cb );
    }
    /* The Skin preference.
     */
    BMenu*		menu = new BMenu("skin_menu");
    BMessage	skinMsg(CHANGE_SKIN_MSG);
    BMenuItem*	item = new BMenuItem( "Default", new BMessage(CHANGE_SKIN_TO_DEFAULT_MSG) );
    item->SetMarked(true);
    menu->AddItem(item);
    menu->AddSeparatorItem();
    menu->SetLabelFromMarked(true);
    if( seq_make_skin_menu(menu, &skinMsg) == B_OK ) {
        const char*	label = "Choose skin:";
        f.Set(f.left, f.bottom + 8, bounds.right - 5, f.bottom + 8 + fh + 10);
        BMenuField*	field = new BMenuField(f, "skin_field", label, menu);
        if (field) {
            field->SetDivider( v->StringWidth(label) + 10 );
            v->AddChild(field);
        } else delete menu;
    } else delete menu;

    /* The Open New Songs preferences.
     */
    f.Set(bounds.left + 5, f.bottom + 10, bounds.right - 5, f.bottom + 10 + openH + 10);
    BBox*		box = new BBox( f,
                                "open_new_songs",
                                B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP);
    if( box ) {
        box->SetLabel( "Open New Songs" );
        BRect		boxB = box->Bounds();
        BRect		sf(boxB.left + 5, boxB.top + 5 + bfh, boxB.right - 5, boxB.top + 5 + bfh + fh);
        const char*	choice;
        if( prefs.FindString(OPEN_NEW_SONG_PREF, &choice) != B_OK ) choice = 0;
        BRadioButton*	button = new BRadioButton( sf, OPEN_BLANK_STR, "Blank", new BMessage(OPEN_BLANK_MSG), B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP );
        if( button ) {
            if( choice && strcmp(choice, "blank") == 0 ) button->SetValue( B_CONTROL_ON );
            box->AddChild( button );
        }
        sf.OffsetBy( 0, 5 + fh );
        button = new BRadioButton( sf, OPEN_FOUR_STR, "With two channels of each device", new BMessage(OPEN_FOUR_MSG), B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP );
        if( button ) {
            if( choice && strcmp(choice, "channels") == 0 ) button->SetValue( B_CONTROL_ON );
            box->AddChild( button );
        }
        sf.OffsetBy( 0, 5 + fh );
        button = new BRadioButton( sf, OPEN_FILE_STR, "From file: <click to select>", new BMessage(OPEN_FILE_MSG), B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP );
        if( button ) {
            if( choice && strcmp(choice, "file") == 0 ) button->SetValue( B_CONTROL_ON );
            entry_ref	ref;
            if( prefs.FindRef(OPEN_NEW_SONG_FILE_PREF, &ref) == B_OK )
                button->SetLabel( label_for_open_new_from_file(&ref).String() );
            box->AddChild( button );
        }
        v->AddChild( box );
        f.OffsetBy(0, f.bottom - f.top + 10 );
    }
    /* The Open From Query preferences
     */
    f.bottom = bounds.bottom - 27;
    box = new BBox( f, "open_from_query", B_FOLLOW_ALL);
    if( box ) {
        box->SetLabel("Open From Query");

        BRect			boxB = box->Bounds();
        BRect			tableF(boxB.left + 5, boxB.top + 5 + bfh, boxB.right - 5, boxB.bottom - 35);
        mOwqTable = new _OwqList( tableF, mPreferences );
        if( mOwqTable ) {
            mOwqTable->SetLatchWidth( 0 );
            box->AddChild( mOwqTable );
            mOwqTable->AddColumn( new BStringColumn(ON_STR, 40, 20, 100, B_TRUNCATE_END), 0 );
            mOwqTable->AddColumn( new BStringColumn(NAME_STR, 100, 20, 150, B_TRUNCATE_END), 1 );
            mOwqTable->AddColumn( new BStringColumn(QUERY_STR, 180, 20, 450, B_TRUNCATE_MIDDLE), 2 );
//			mOwqTable->AddColumn( new BStringColumn(SKIP_TOP_LEVEL_STR, 100, 20, 250, B_TRUNCATE_END), 3 );
            mOwqTable->SetSortColumn(mOwqTable->ColumnAt(1), false, true);
//			mOwqTable->SetSortColumn(mOwqTable->ColumnAt(), true, true);
            mOwqTable->SetSelectionMode( B_SINGLE_SELECTION_LIST );

            BRect		bF(tableF.left, tableF.bottom + 5, tableF.left + 55, tableF.Height() - 10);
            BButton*	add = new BButton( bF, "owq_add", "Add", new BMessage(OWQ_INVOKE_ADD), B_FOLLOW_LEFT | B_FOLLOW_BOTTOM );
            if( add ) box->AddChild( add );
            bF.OffsetBy( bF.Width() + 5, 0 );
            BButton*	change = new BButton( bF, "owq_change", "Change", new BMessage(OWQ_CHANGE), B_FOLLOW_LEFT | B_FOLLOW_BOTTOM );
            if( change ) {
//.........这里部分代码省略.........
开发者ID:dtbinh,项目名称:Sequitur,代码行数:101,代码来源:SeqPrefWin.cpp

示例11: _CreateConnectionPage

BView* PreferencesWindow::_CreateConnectionPage(float spacing)
{
/*
    BStringView* addingLabel 		= new BStringView("", B_TRANSLATE("Adding"));
    BStringView* downloadingLabel 	= new BStringView("", B_TRANSLATE("Downloading"));
    //BStringView* seedingLabel 	= new BStringView("", B_TRANSLATE("Seeding Limits"));
    
    addingLabel->SetFont(be_bold_font);
    downloadingLabel->SetFont(be_bold_font);
*/
    BStringView* peerPortLabel = new BStringView("", B_TRANSLATE("Peer Port"));
    BStringView* limitsLabel = new BStringView("", B_TRANSLATE("Limits"));
    BStringView* otherLabel = new BStringView("", B_TRANSLATE("Other"));
    peerPortLabel->SetFont(be_bold_font);
    limitsLabel->SetFont(be_bold_font);
    otherLabel->SetFont(be_bold_font);
    

    BStringView* fListeningPortLabel = new BStringView("", B_TRANSLATE("Incoming port:"));
    BStringView* fMaxConnectionLabel = new BStringView("", B_TRANSLATE("Max connections:"));
    BStringView* fTorrentMaxConnectionLabel	= new BStringView("", B_TRANSLATE("Connected peers limit:"));
    //BStringView* fTorrentUploadSlotsLabel = new BStringView("", B_TRANSLATE("Connected peers per torrent limit:"));

    
    
    fListeningPort = new BTextControl("_name", NULL, "", NULL);
    fRandomPort = new BButton("", B_TRANSLATE("Random"), new BMessage(MSG_INCOMING_PORT_RANDOM_BEHAVIOR_CHANGED));
    fApplyPort = new BButton("", B_TRANSLATE("Apply"), new BMessage(MSG_INCOMING_PORT_BEHAVIOR_CHANGED));
    fEnableForwardingPort = new BCheckBox("", B_TRANSLATE("Enable UPnP / NAT-PMP port forwarding"), new BMessage(MSG_PORT_FORWARDING_BEHAVIOR_CHANGED));	
    fMaxConnection = new BTextControl("_name", "", "", NULL);
    fApplyMaxConnection = new BButton("", B_TRANSLATE("Apply"), new BMessage(MSG_PEER_LIMIT_BEHAVIOR_CHANGED));
    fTorrentMaxConnection = new BTextControl("_name", "", "", NULL);
    fApplyTorrentMaxConnection = new BButton("", B_TRANSLATE("Apply"), new BMessage(MSG_PEER_LIMIT_PER_TORRENT_BEHAVIOR_CHANGED));
    //BTextControl* fTorrentUploadSlots = new BTextControl("_name", "", "", NULL);
    BCheckBox* fEnableDHTValue = new BCheckBox("", B_TRANSLATE("Enable Distributed Hash Table (DHT)"), new BMessage(MSG_DISTRIBUTED_HASH_TABLE_BEHAVIOR_CHANGED));
    BCheckBox* fEnablePEXValue = new BCheckBox("", B_TRANSLATE("Enable Bit Torrent Peer EXchange (PEX)"), new BMessage(MSG_TORRENT_PEER_EXCHANGE_BEHAVIOR_CHANGED));
    BCheckBox* fEnableUTPValue = new BCheckBox("", B_TRANSLATE("Enable Micro Transport Protocol (" UTF8_GREEK_MU_LETTER "TP)"), new BMessage(MSG_MICRO_TRANSPORT_PROTOCOL_BEHAVIOR_CHANGED));
    BCheckBox* fEnableLPDValue = new BCheckBox("", B_TRANSLATE("Enable Local Peer Discovery (LPD)"), new BMessage(MSG_LOCAL_PEER_DISCOVERY_BEHAVIOR_CHANGED));
    
    //
    BPopUpMenu* menu = new BPopUpMenu("");
    
    
    fEncryptionMenuItem[0] = new BMenuItem(B_TRANSLATE("Off"), _CreateEncryptionMenuMessage(0));
    fEncryptionMenuItem[1] = new BMenuItem(B_TRANSLATE("Enabled"), _CreateEncryptionMenuMessage(1));
    fEncryptionMenuItem[2] = new BMenuItem(B_TRANSLATE("Required"), _CreateEncryptionMenuMessage(2));
    
    menu->AddItem(fEncryptionMenuItem[0]);
    menu->AddItem(fEncryptionMenuItem[1]);
    menu->AddItem(fEncryptionMenuItem[2]);
    
    fEncryptionMenu = new BMenuField("", B_TRANSLATE("Encryption:"), menu);
    
    //
    BString textBuffer;	
    
    textBuffer << (int32)fTorrentPreferences->IncomingPort();
    fListeningPort->SetText(textBuffer);
    
    textBuffer = B_EMPTY_STRING;
    textBuffer << (int32)fTorrentPreferences->PeerLimit();
    fMaxConnection->SetText(textBuffer);
    
    textBuffer = B_EMPTY_STRING;
    textBuffer << (int32)fTorrentPreferences->PeerLimitPerTorrent();
    fTorrentMaxConnection->SetText(textBuffer);
    
    //textBuffer << (int32)fTorrentPreferences->IncomingPort();
    //fTorrentUploadSlots->SetText(textBuffer);
    

    fEnableForwardingPort->SetValue(fTorrentPreferences->PortForwardingEnabled() ? B_CONTROL_ON : B_CONTROL_OFF);
    fEnableDHTValue->SetValue(fTorrentPreferences->DistributedHashTableEnabled() ? B_CONTROL_ON : B_CONTROL_OFF);
    fEnablePEXValue->SetValue(fTorrentPreferences->PeerExchangeEnabled() ? B_CONTROL_ON : B_CONTROL_OFF);
    fEnableUTPValue->SetValue(fTorrentPreferences->MicroTransportProtocolEnabled() ? B_CONTROL_ON : B_CONTROL_OFF);
    fEnableLPDValue->SetValue(fTorrentPreferences->LocalPeerDiscoveryEnabled() ? B_CONTROL_ON : B_CONTROL_OFF);
    fEncryptionMenuItem[fTorrentPreferences->EncryptionMode()]->SetMarked(true);
    
    //
    fListeningPort->SetExplicitMaxSize(BSize(60, 40));
    fMaxConnection->SetExplicitMaxSize(BSize(60, 40));
    fTorrentMaxConnection->SetExplicitMaxSize(BSize(60, 40));
    //fTorrentUploadSlots->SetExplicitMaxSize(BSize(60, 40));
    
    //
    //
    BView* view = BGroupLayoutBuilder(B_VERTICAL, spacing / 2)
        .Add(peerPortLabel)
        .Add(BGridLayoutBuilder(-1, spacing / 2)
            .SetInsets(spacing / 2, -1, -1, -1)
            .Add(fListeningPortLabel, 0, 0)
            //.Add(BSpaceLayoutItem::CreateHorizontalStrut(spacing), 1, 0)
            .Add(fListeningPort, 1, 0)
            .Add(fRandomPort, 2, 0)
            .Add(fApplyPort, 3, 0)
            
            //.Add(BSpaceLayoutItem::CreateGlue(), 2, 0)
            //.Add(BSpaceLayoutItem::CreateGlue(), 3, 0)
            //.Add(BSpaceLayoutItem::CreateGlue(), 4, 0)
            
//.........这里部分代码省略.........
开发者ID:Prodito,项目名称:Torrentor,代码行数:101,代码来源:PreferencesWindow.cpp

示例12: _CreateTorrentsPage

BView* PreferencesWindow::_CreateTorrentsPage(float spacing)
{
    BStringView* addingLabel 		= new BStringView("", B_TRANSLATE("Adding"));
    BStringView* downloadingLabel 	= new BStringView("", B_TRANSLATE("Downloading"));
    //BStringView* seedingLabel 	= new BStringView("", B_TRANSLATE("Seeding Limits"));
    
    addingLabel->SetFont(be_bold_font);
    downloadingLabel->SetFont(be_bold_font);
    
    //
    //
    //
    //fAutoAddTorrentsFrom = new BCheckBox("auto_add_torrents_from",
    //	B_TRANSLATE("Automatically add torrents from:"), 
    //	new BMessage(MSG_ADD_TORRENT_FROM_FOLDER_CHANGED));
    //fAutoAddTorrentsFrom->SetValue(B_CONTROL_OFF);
    //
    //
    //fAutoAddTorrentsFromFolder = new FolderSelect("auto_add_torrents_from_folder",
    //	NULL, "/test/path"/*new BMessage(MSG_DOWNLOAD_FOLDER_CHANGED)*/);
    //
    //fAutoAddTorrentsFromFolder->SetEnabled(false);


    BCheckBox* fShowOptionsDialog = new BCheckBox("Show options dialog",
        B_TRANSLATE("Show options dialog"),
        NULL /*new BMessage(MSG_AUTO_HIDE_INTERFACE_BEHAVIOR_CHANGED)*/);
    fShowOptionsDialog->SetValue(B_CONTROL_OFF);
    
    BCheckBox* fStartWhenAdded = new BCheckBox("start_when_added",
        B_TRANSLATE("Start when added"),
        new BMessage(MSG_START_WHEN_ADDED_BEHAVIOR_CHANGED));
    fStartWhenAdded->SetValue(fTorrentPreferences->StartWhenAddedEnabled() ? B_CONTROL_ON : B_CONTROL_OFF);
    
    fIncompleteFileNaming = new BCheckBox("incomplete_file_naming",
        B_TRANSLATE("Append \".part\" to incomplete files' names"), 
        new BMessage(MSG_INCOMPLETE_FILENAMING_BEHAVIOR_CHANGED));
    fIncompleteFileNaming->SetValue(fTorrentPreferences->IncompleteFileNamingEnabled() ? B_CONTROL_ON : B_CONTROL_OFF);
    
    BStringView* fTorrentSaveLocation = new BStringView("", B_TRANSLATE("Save to Location:"));
    fTorrentSaveLocationPath = new FolderSelect("download_folder_select", 
        fTorrentPreferences->DownloadFolder(), new BMessage(MSG_DOWNLOAD_FOLDER_BEHAVIOR_CHANGED));
        
    fIncompleteDirEnabled = new BCheckBox("incomplete_torrent_folder",
        B_TRANSLATE("Incomplete torrents folder"),
        new BMessage(MSG_INCOMPLETE_FOLDER_BEHAVIOR_CHANGED));
    fIncompleteDirEnabled->SetValue(fTorrentPreferences->IncompleteFolderEnabled() ? B_CONTROL_ON : B_CONTROL_OFF);
    
    fIncompleteDirPath = new FolderSelect("incomplete_torrent_folder_path", 
        fTorrentPreferences->IncompleteFolder(), new BMessage(MSG_INCOMPLETE_FOLDER_PATH_BEHAVIOR_CHANGED));
    fIncompleteDirPath->SetEnabled(fTorrentPreferences->IncompleteFolderEnabled());
    
    //
    //
    //
    BView* view = BGroupLayoutBuilder(B_VERTICAL, spacing / 2)
        .Add(addingLabel)
        //.Add(BGridLayoutBuilder(spacing / 2, spacing / 2)
        //	.Add(fAutoAddTorrentsFrom, 0, 0)
        //	.Add(fAutoAddTorrentsFromFolder, 1, 0)
        //)
        .Add(BGridLayoutBuilder(spacing, spacing / 2)
            .SetInsets(spacing / 2, -1, -1, -1)
            .Add(fShowOptionsDialog, 0, 0)
            .Add(fStartWhenAdded, 0, 1)
        )
        .Add(downloadingLabel)
        .Add(BGridLayoutBuilder(spacing, spacing / 2)
            .SetInsets(spacing / 2, -1, -1, -1)
            .Add(fIncompleteFileNaming, 0, 0, 2, 1)
            .Add(fTorrentSaveLocation, 0, 1)
            .Add(fTorrentSaveLocationPath, 1, 1)
            .Add(fIncompleteDirEnabled, 0, 2)
            .Add(fIncompleteDirPath, 1, 2)
        )
        .Add(BSpaceLayoutItem::CreateHorizontalStrut(spacing))
        .SetInsets(spacing, spacing, spacing, spacing)
        .TopView()
    ;
    view->SetName("Torrents");
    return view;

}
开发者ID:Prodito,项目名称:Torrentor,代码行数:83,代码来源:PreferencesWindow.cpp

示例13: BMessage


//.........这里部分代码省略.........
    // ---- Separator line between Profiles section and Settings section
    line = new BBox(BRect(r.left, r.top, r.right, r.top + 1), NULL,
                         B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP );
    top_box->AddChild(line);

    _BuildProfilesMenu(profiles_menu, SELECT_PROFILE_MSG);

    r.top += 2 + V_MARGIN;

    // ---- Settings section

    // Make the show popup field half the whole width and centered
    menu_field = new BMenuField(r, "show_menu", SHOW_LABEL, show_menu);
    menu_field->SetFont(be_bold_font);
    menu_field->SetDivider(be_bold_font->StringWidth(SHOW_LABEL "#"));
    top_box->AddChild(menu_field);

    menu_field->ResizeToPreferred();
    menu_field->GetPreferredSize(&w, &h);
    r.top += h+1 + V_MARGIN;
    
    min_size = max_c(min_size, (H_MARGIN + w + H_MARGIN));
    

    r = fMinAddonViewRect.OffsetByCopy(H_MARGIN, r.top);
    fPanel = new BBox(r, "showview_box", B_FOLLOW_NONE,
                        B_WILL_DRAW | B_FRAME_EVENTS | B_NAVIGABLE_JUMP,
                        B_PLAIN_BORDER);
    top_box->AddChild(fPanel);
    top_box->ResizeTo(Bounds().Width(), r.bottom + 1 + V_MARGIN);

    // ---- Bottom globals buttons section
    r = Bounds();
    r.top = top_box->Frame().bottom + 1;
    bottom_box = new BBox(r, NULL, B_FOLLOW_NONE,
                        B_WILL_DRAW | B_FRAME_EVENTS | B_NAVIGABLE_JUMP,
                        B_PLAIN_BORDER);
    AddChild(bottom_box); 

    r.OffsetTo(0, 0);
    r.InsetBy(H_MARGIN, V_MARGIN);

    check = new BCheckBox(r, "dont_touch", DONT_TOUCH_LABEL,
                    new BMessage(DONT_TOUCH_MSG),
                    B_FOLLOW_TOP | B_FOLLOW_LEFT);
    check->GetPreferredSize(&w, &h);
    check->ResizeToPreferred();
    check->SetValue(B_CONTROL_ON);
    check->MoveTo(H_MARGIN, r.top);
    bottom_box->AddChild(check);
    
    size = w;

    button = new BButton(r, "apply_now", APPLY_NOW_LABEL,
                    new BMessage(APPLY_NOW_MSG),
                    B_FOLLOW_TOP | B_FOLLOW_RIGHT);
    button->GetPreferredSize(&w, &h);
    button->ResizeToPreferred();
    x = r.right - w;
    button->MoveTo(x, r.top);
    bottom_box->AddChild(button);

    fApplyNowButton = button;
    
    size += SMALL_MARGIN + w;
    
    button = new BButton(r, "revert", REVERT_LABEL, new BMessage(REVERT_MSG), 
        B_FOLLOW_TOP | B_FOLLOW_RIGHT);
        
    button->GetPreferredSize(&w, &h);
    button->ResizeToPreferred();
    button->MoveTo(x - w - SMALL_MARGIN, r.top);
    bottom_box->AddChild(button);

    fRevertButton = button;
    fRevertButton->SetEnabled(false);

    size += SMALL_MARGIN + w;

    min_size = max_c(min_size, (H_MARGIN + size + H_MARGIN));
    
    r.bottom = r.top + h;
    r.InsetBy(-H_MARGIN, -V_MARGIN);
    
    bottom_box->ResizeTo(Bounds().Width(), r.Height());

    // Resize window to enclose top and bottom boxes
    ResizeTo(Bounds().Width(), bottom_box->Frame().bottom);
    
    // Enable boxes resizing modes
    top_box->SetResizingMode(B_FOLLOW_ALL);
    fPanel->SetResizingMode(B_FOLLOW_ALL);
    bottom_box->SetResizingMode(B_FOLLOW_BOTTOM | B_FOLLOW_LEFT_RIGHT);

    // Set default/minimal window size
    ResizeTo(min_size, Bounds().Height());
    SetSizeLimits(min_size, 20000, Bounds().Height(), 20000);	
    
    fAddonView = NULL;
}
开发者ID:mmanley,项目名称:Antares,代码行数:101,代码来源:NetworkSetupWindow.cpp

示例14: BMessage

NetworkWindow::NetworkWindow()
    :
    BWindow(BRect(100, 100, 400, 400), B_TRANSLATE("Network"), B_TITLED_WINDOW,
        B_ASYNCHRONOUS_CONTROLS | B_NOT_ZOOMABLE | B_AUTO_UPDATE_SIZE_LIMITS),
    fServicesItem(NULL),
    fDialUpItem(NULL),
    fOtherItem(NULL)
{
    // Profiles section
#if ENABLE_PROFILES
    BPopUpMenu* profilesPopup = new BPopUpMenu("<none>");
    _BuildProfilesMenu(profilesPopup, kMsgProfileSelected);

    BMenuField* profilesMenuField = new BMenuField("profiles_menu",
        B_TRANSLATE("Profile:"), profilesPopup);

    profilesMenuField->SetFont(be_bold_font);
    profilesMenuField->SetEnabled(false);
#endif

    // Settings section

    fRevertButton = new BButton("revert", B_TRANSLATE("Revert"),
        new BMessage(kMsgRevert));

    BMessage* message = new BMessage(kMsgToggleReplicant);
    BCheckBox* showReplicantCheckBox = new BCheckBox("showReplicantCheckBox",
        B_TRANSLATE("Show network status in Deskbar"), message);
    showReplicantCheckBox->SetExplicitMaxSize(
        BSize(B_SIZE_UNLIMITED, B_SIZE_UNSET));
    showReplicantCheckBox->SetValue(_IsReplicantInstalled());

    fListView = new BOutlineListView("list", B_SINGLE_SELECTION_LIST,
        B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE | B_FRAME_EVENTS | B_NAVIGABLE);
    fListView->SetSelectionMessage(new BMessage(kMsgItemSelected));

    BScrollView* scrollView = new BScrollView("ScrollView", fListView,
        0, false, true);
    scrollView->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, B_SIZE_UNSET));

    fAddOnShellView = new BView("add-on shell", 0,
        new BGroupLayout(B_VERTICAL));
    fAddOnShellView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));

    fInterfaceView = new InterfaceView();

    // Build the layout
    BLayoutBuilder::Group<>(this, B_VERTICAL)
        .SetInsets(B_USE_DEFAULT_SPACING)

#if ENABLE_PROFILES
        .AddGroup(B_HORIZONTAL, B_USE_SMALL_SPACING)
            .Add(profilesMenuField)
            .AddGlue()
        .End()
#endif
        .AddGroup(B_HORIZONTAL, B_USE_DEFAULT_SPACING)
            .Add(scrollView)
            .Add(fAddOnShellView)
            .End()
        .Add(showReplicantCheckBox)
        .AddGroup(B_HORIZONTAL, B_USE_DEFAULT_SPACING)
            .Add(fRevertButton)
            .AddGlue()
        .End();

    gNetworkWindow = this;

    _ScanInterfaces();
    _ScanAddOns();
    _UpdateRevertButton();

    fListView->Select(0);
    _SelectItem(fListView->ItemAt(0));
        // Call this manually, so that CenterOnScreen() below already
        // knows the final window size.

    // Set size of the list view from its contents
    float width;
    float height;
    fListView->GetPreferredSize(&width, &height);
    width += 2 * be_control_look->DefaultItemSpacing();
    fListView->SetExplicitSize(BSize(width, B_SIZE_UNSET));
    fListView->SetExplicitMinSize(BSize(width, std::min(height, 400.f)));

    CenterOnScreen();

    fSettings.StartMonitoring(this);
    start_watching_network(B_WATCH_NETWORK_INTERFACE_CHANGES
        | B_WATCH_NETWORK_LINK_CHANGES | B_WATCH_NETWORK_WLAN_CHANGES, this);
}
开发者ID:kodybrown,项目名称:haiku,代码行数:91,代码来源:NetworkWindow.cpp

示例15: InitFlagsBoxes

//------------------------------------------------------------------------------
void WindowEditor::InitFlagsBoxes()
{
    BRect work = Bounds();
    work.left = 10;
    work.top = 100;
    work.bottom -= 5;
    work.right -= 10;
    work.right -= 10;
    int i = 20;
    int inc = 10;
    BBox* box = new BBox(work, "flags");
    BCheckBox* cbox;
    BMessage* msg;
    box->SetLabel("Window Flags");
    uint32 flags = fWindowInfo.flags;
    bool longLabel;

    for (int index = 0; WindowFlags[index].name; ++index)
    {
        longLabel = strlen(WindowFlags[index].label) > 20;
        // First column of checkboxes
        msg = new BMessage(MSG_WINDOW_SET_FLAG);
        msg->AddInt32("flags", WindowFlags[index].flag);
        cbox = new BCheckBox(BRect(10, i, longLabel ? 210 : 125, i + inc),
                             WindowFlags[index].name, WindowFlags[index].label, msg);
        fFlagBoxes.push_back(cbox);
        box->AddChild(cbox);
        if (WindowFlags[index].flip == (flags & WindowFlags[index].flag))
        {
            cbox->SetValue(B_CONTROL_ON);
        }

        // We skip to the next row as needed to make room for long labels
        if (!longLabel && WindowFlags[index + 1].name)
        {
            ++index;
            // Second column of checkboxes
            msg = new BMessage(MSG_WINDOW_SET_FLAG);
            msg->AddInt32("flags", WindowFlags[index].flag);
            cbox = new BCheckBox(BRect(130, i, 210, i + inc),
                                 WindowFlags[index].name,
                                 WindowFlags[index].label,
                                 msg);
            fFlagBoxes.push_back(cbox);
            box->AddChild(cbox);
            if (WindowFlags[index].flip == (flags & WindowFlags[index].flag))
            {
                cbox->SetValue(B_CONTROL_ON);
            }
        }

        i += inc * 2;
    }
#if 0
    msg = new BMessage(MSG_WINDOW_SET_FLAG);
    msg->AddInt32("flags",B_NOT_MOVABLE);
    box->AddChild(new BCheckBox(BRect(10,i,120,i+inc),"nmov","Movable",msg));
    msg = new BMessage(MSG_WINDOW_SET_FLAG);
    msg->AddInt32("flags",B_NOT_CLOSABLE);
    box->AddChild(new BCheckBox(BRect(130,i,210,i+inc),"clos","Closable",msg));
    msg = new BMessage(MSG_WINDOW_SET_FLAG);
    i+= inc*2;
    msg->AddInt32("flags",B_NOT_ZOOMABLE);
    box->AddChild(new BCheckBox(BRect(10,i,120,i+inc),"zoom","Zoomable",msg));
    msg = new BMessage(MSG_WINDOW_SET_FLAG);
    msg->AddInt32("flags",B_NOT_MINIMIZABLE);
    box->AddChild(new BCheckBox(BRect(130,i,210,i+inc),"mini","Minimizable",msg));
    msg = new BMessage(MSG_WINDOW_SET_FLAG);
    i+= inc*2;
    msg->AddInt32("flags",B_NOT_H_RESIZABLE);
    box->AddChild(new BCheckBox(BRect(10,i,210,i+inc),"hres","Horizontally Resizable",msg));
    msg = new BMessage(MSG_WINDOW_SET_FLAG);
    i+= inc*2;
    msg->AddInt32("flags",B_NOT_V_RESIZABLE);
    box->AddChild(new BCheckBox(BRect(10,i,125,i+inc),"vres","Vertically Resizable",msg));
    menubox = new BCheckBox(BRect(130,i,210,i+inc),"menus","Menu Bar",new BMessage(MSG_WINDOW_ADD_MENU));
    box->AddChild(menubox);
    if (fWindowInfo.has_menu)
        menubox->SetValue(B_CONTROL_ON);
    msg = new BMessage(MSG_WINDOW_SET_FLAG);
    i+= inc*2;
    msg->AddInt32("flags",B_OUTLINE_RESIZE);
    box->AddChild(new BCheckBox(BRect(10,i,210,i+inc),"roiw","Resize with Outline Instead of Window",msg));
    msg = new BMessage(MSG_WINDOW_SET_FLAG);
    i+= inc*2;
    msg->AddInt32("flags",B_WILL_ACCEPT_FIRST_CLICK);
    box->AddChild(new BCheckBox(BRect(10,i,210,i+inc),"wafc","Will Accept First Click",msg));
    msg = new BMessage(MSG_WINDOW_SET_FLAG);
    i+= inc*2;
    msg->AddInt32("flags",B_AVOID_FRONT);
    box->AddChild(new BCheckBox(BRect(10,i,120,i+inc),"avfr","Avoid Front",msg));
    msg = new BMessage(MSG_WINDOW_SET_FLAG);
    msg->AddInt32("flags",B_AVOID_FOCUS);
    box->AddChild(new BCheckBox(BRect(130,i,210,i+inc),"avfo","Avoid Focus",msg));
    msg = new BMessage(MSG_WINDOW_SET_FLAG);
    i+= inc*2;
    msg->AddInt32("flags",B_NO_WORKSPACE_ACTIVATION);
    box->AddChild(new BCheckBox(BRect(10,i,210,i+inc),"nwoa","Do Not Activate Workspace",msg));
    msg = new BMessage(MSG_WINDOW_SET_FLAG);
//.........这里部分代码省略.........
开发者ID:HaikuArchives,项目名称:Resourcer,代码行数:101,代码来源:WindowEditor.cpp


注:本文中的BCheckBox::SetValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。