Example #1
0
void CharismaWindow::Minimize(bool minimize)
{
	const float margin=4.0f;
	BRect r;
	
	// en réalité, minimize est ignoré
	
	if(!isminim){
		menubar->Hide();
		setupview->MoveTo(B_ORIGIN);
		modemenu->MoveTo(margin,margin);
	
		r=modemenu->Frame();
		ResizeTo(r.right+margin,r.bottom+margin);
		
		SetLook(B_MODAL_WINDOW_LOOK);

		isminim=1;
	}else{
		menubar->Show();
		setupview->MoveTo(0,menubar->Frame().bottom);
		modemenu->MoveTo(10.0f,10.0f);

		r=setupview->Frame();
		ResizeTo(r.right,r.bottom);

		SetLook(B_TITLED_WINDOW_LOOK);

		isminim=0;
	}
}
Example #2
0
int CharismaWindow::saveprefs()
{
	FILE *f;
	BMenu *m;
	char fname[B_PATH_NAME_LENGTH];
	int r;
	BRect rect;
	
	r=find_directory(B_COMMON_SETTINGS_DIRECTORY,0,true,fname,sizeof fname);
	if(r) return r;
	strcat(fname,"/");
	strcat(fname,"Charisma_settings");
	
	f=fopen(fname,"w");
	if(!f)return -1;

	fprintf(f,"Charisma_settings\n");
	fprintf(f,"version=1\n");
	fprintf(f,"directory=%s\n",g_webdir);
	m=modemenu->Menu();
	fprintf(f,"mode=%d\n",m->IndexOf(m->FindMarked()));
	m=smartrefresh->Menu();
	fprintf(f,"smart_refresh=%d\n",m->IndexOf(m->FindMarked()));
	fprintf(f,"external_control=%s\n",extcontrol_item->IsMarked()?"yes":"no");
	fprintf(f,"netpositive_autoset=%s\n",netposautoset_item->IsMarked()?"yes":"no");
	rect=Frame();
	fprintf(f,"position=%f,%f\n",rect.left,rect.top);
	fprintf(f,"minimized=%s\n",isminim?"yes":"no");

	fclose(f);
	
	return 0;
}
Example #3
0
/***********************************************************
 * SetFrom
 ***********************************************************/
void
HAddressView::SetFrom(const char* in_address)
{
	if( ::strlen(in_address) == 0)
		return;
	BString address(in_address);
	
	// Compare existing accounts	
	char name[B_FILE_NAME_LENGTH];
	BPath path;
	::find_directory(B_USER_SETTINGS_DIRECTORY,&path);
	path.Append(APP_NAME);
	path.Append("Accounts");
	BDirectory dir(path.Path());
	status_t err = B_OK;
	BEntry entry;
	bool changed = false;
	
	while(err == B_OK)
	{
		if( (err = dir.GetNextEntry(&entry)) != B_OK  )
			break;
		BFile file(&entry,B_READ_ONLY);
		if(file.InitCheck() == B_OK && entry.IsFile())
		{
			BMessage msg;
			msg.Unflatten(&file);
			BString myAddress;
			PRINT(("%s\n",in_address));
			if(msg.FindString("address",&myAddress) != B_OK)
				myAddress = "";
			// Change account
			if(address.FindFirst(myAddress) != B_ERROR)
			{
				entry.GetName(name);	
				ChangeAccount(name);
				// Set From menu
				BMenuField *field = cast_as(FindView("FromMenu"),BMenuField);
				BMenu *menu = field->Menu();
				BMenuItem *item = menu->FindItem(name);
				if(item)
					item->SetMarked(true);
				changed=true;
				break;
			}
		}
	}
	
	if(!changed && cast_as(Window()->FindView("HMailView"),BTextView))
	{
		BMenuField *field = cast_as(FindView("FromMenu"),BMenuField);
		BMenuItem *item(NULL);
		item = field->Menu()->FindMarked();
		if(item)
		{
			ChangeAccount(item->Label());
			item->SetMarked(true);	
		}
	}
}
Example #4
0
quadruplet<BTextControl*, BPopUpMenu*, BMenuField*, BStringView*> CheckView::MakeField(uint16 width,
	string name, uint16* xpos, uint16* ypos)
{
	BStringView* sv = new BStringView(BRect((*xpos), (*ypos), 
		(*xpos) + width, (*ypos) + 10),
		(name + "Text").c_str(), name.c_str());
	BFont font;
	sv->GetFont(&font);
	font.SetSize(10);
	sv->SetFont(&font);
	AddChild(sv);
	BTextControl* tc = new BTextControl(BRect((*xpos) - 5, (*ypos) + 10, 
		(*xpos) + width, (*ypos) + 10), (name + "Field").c_str(), 
		"", "", 0);
	(*xpos) += width;
	tc->SetDivider(0);
	AddChild(tc);
	BPopUpMenu* pu = new BPopUpMenu("", true, false);
	BMenuField* mf = new BMenuField(BRect((*xpos) + 2, (*ypos) + 9, 
		(*xpos) + 2, (*ypos) + 9), (name + "Menu").c_str(), "", pu);
	mf->SetDivider(0);
	AddChild(mf);
	(*xpos) += 30;
	
	return quadruplet<BTextControl*, BPopUpMenu*, BMenuField*, BStringView*>(tc, pu, mf, sv);
}
Example #5
0
void
HWindow::Pulse()
{
	HEventRow* row = (HEventRow*)fEventList->CurrentSelection();
	BMenuField* menufield = dynamic_cast<BMenuField*>(FindView("filemenu"));
	BButton* button = dynamic_cast<BButton*>(FindView("play"));
	BButton* stop = dynamic_cast<BButton*>(FindView("stop"));

	if (menufield == NULL || button == NULL || stop == NULL)
		return;

	if (row != NULL) {
		menufield->SetEnabled(true);

		const char* path = row->Path();
		if (path != NULL && strcmp(path, ""))
			button->SetEnabled(true);
		else
			button->SetEnabled(false);
	} else {
		menufield->SetEnabled(false);
		button->SetEnabled(false);
	}

	if (fPlayer != NULL) {
		if (fPlayer->IsPlaying())
			stop->SetEnabled(true);
		else
			stop->SetEnabled(false);
	} else
		stop->SetEnabled(false);
}
Example #6
0
void
JobSetupView::AddPopUpMenu(const DriverSpecificCap* capability,
	BGridLayout* gridLayout, int& row)
{
	const char* label = capability->fLabel.c_str();
	BPopUpMenu* popUpMenu = new BPopUpMenu(label);
	popUpMenu->SetRadioMode(true);

	PrinterCap::CapID category = static_cast<PrinterCap::CapID>(
		capability->ID());

	const BaseCap** categoryCapabilities = fPrinterCap->GetCaps(category);

	int categoryCount = fPrinterCap->CountCap(category);

	string value = GetDriverSpecificValue(category, capability->Key());
	PrinterCap::KeyPredicate predicate(value.c_str());

	FillCapabilityMenu(popUpMenu, kMsgNone, categoryCapabilities,
		categoryCount, predicate);

	BString menuLabel = label;
	menuLabel << ":";
	BMenuField* menuField = new BMenuField(label, menuLabel.String(),
		popUpMenu);
	popUpMenu->SetTargetForItems(this);

	gridLayout->AddItem(menuField->CreateLabelLayoutItem(),
		0, row);
	gridLayout->AddItem(menuField->CreateMenuBarLayoutItem(),
		1, row);
	row ++;

	fDriverSpecificPopUpMenus[category] = popUpMenu;
}
	virtual void 	Visit(BStringContactField* field)
	{
		int count = fOwner->fControls.CountItems();
		BGridLayout* layout = fOwner->GridLayout();
		if (field->FieldType() != B_CONTACT_SIMPLE_GROUP) {
			ContactFieldTextControl* control = new ContactFieldTextControl(field);

			layout->AddItem(control->CreateLabelLayoutItem(), 1, count);
			layout->AddItem(control->CreateTextViewLayoutItem(), 2, count);
			fOwner->fControls.AddItem(control);
		} else {
			const char* label = 
				BContactField::ExtendedLabel(field);

			fOwner->fGroups = new BPopUpMenu(label);
			fOwner->fGroups->SetRadioMode(false);
			fOwner->BuildGroupMenu(field);

			BMenuField* field = new BMenuField("", "", fOwner->fGroups);
			BTextControl* control = new BTextControl("simpleGroup",
				NULL, NULL, NULL);

			field->SetEnabled(true);
			layout->AddItem(field->CreateLabelLayoutItem(), 1, 0, count);
			layout->AddItem(field->CreateMenuBarLayoutItem(), 1, 1, count);
			layout->AddItem(control->CreateLabelLayoutItem(), 2, 0, count);
			layout->AddItem(control->CreateTextViewLayoutItem(), 2, 1, count);
		}
	}
Example #8
0
ConfigView::ConfigView()
	:	BView(BRect(0,0,10,10),"notifier_config",B_FOLLOW_LEFT | B_FOLLOW_TOP,0)
{
	SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));

	// determine font height
	font_height fontHeight;
	GetFontHeight(&fontHeight);
	float itemHeight = (int32)(fontHeight.ascent + fontHeight.descent + fontHeight.leading) + 6;
	
	BRect frame(5,2,250,itemHeight + 2);
	BPopUpMenu *menu = new BPopUpMenu(B_EMPTY_STRING,false,false);

	const char *notifyMethods[] = {
		MDR_DIALECT_CHOICE ("Beep","音"),
		MDR_DIALECT_CHOICE ("Alert","窓(メール毎)"),
		MDR_DIALECT_CHOICE ("Keyboard LEDs","キーボードLED"),
		MDR_DIALECT_CHOICE ("Central alert","窓(一括)"),
		"Central beep","Log window"};
	for (int32 i = 0,j = 1;i < 6;i++,j *= 2)
		menu->AddItem(new BMenuItem(notifyMethods[i],new BMessage(kMsgNotifyMethod)));

	BMenuField *field = new BMenuField(frame,"notify",
		MDR_DIALECT_CHOICE ("Method:","方法:"),menu);
	field->ResizeToPreferred();
	field->SetDivider(field->StringWidth(
		MDR_DIALECT_CHOICE ("Method:","方法:")) + 6);
	AddChild(field);

	ResizeToPreferred();
}		
Example #9
0
void HDialog::SetValue(const char *id, int value)
{
	BView *v = FindView(id);
	if (v == NULL) THROW(("View '%s' not found", id));

	if (typeid(*v) == typeid(BMenuField))
	{
		BMenuField *mf = static_cast<BMenuField*>(v);
		BMenuItem *item = mf->Menu()->ItemAt(value - 1);
		if (item)
			item->SetMarked(true);
		return;
	}
	else if (typeid(*v) == typeid(BTextControl))
	{
		char b[32];
		sprintf(b, "%d", value);
		SetText(id, b);
		return;
	}
	else if (typeid(*v) == typeid(BSlider))
	{
		static_cast<BSlider*>(v)->SetValue(value);
		return;
	}

	THROW(("view '%s' not found", id));
} // HDialog::SetValue
Example #10
0
void SplitWindow::AddCat()
{
	ResizeBy(0, 25);
	uint16 xpos = 20;
	uint16 width = 150;
	BTextControl* tc = new BTextControl(BRect(xpos - 5, ypos + 10, 
		xpos + width, ypos + 10), "CatField", "", "", 0);
	xpos += width;
	tc->SetDivider(0);
	catTexts.push_back(tc);
	v->AddChild(tc);
	BPopUpMenu* pu = new BPopUpMenu("", true, false);
	BMenuField* mf = new BMenuField(BRect(xpos + 2, ypos + 9, 
		xpos + 2, ypos + 9), "CatMenu", "", pu);
	mf->SetDivider(0);
	v->AddChild(mf);
	xpos += 30;
	tc = new BTextControl(BRect(xpos - 5, ypos + 10, 
		xpos + 75, ypos + 10), "AmountField", "", "", 0);
	tc->SetDivider(0);
	tc->SetAlignment(B_ALIGN_LEFT, B_ALIGN_RIGHT);
	tc->SetModificationMessage(new BMessage(AmountModifiedMSG));
	amtTexts.push_back(tc);
	v->AddChild(tc);
	ypos += 25;

	for (cas::iterator ci = catS->begin(); ci != catS->end(); ci++)
	{
		if ((*ci)->IsRoot())
		{
			pu->AddItem(MakeCatMenu(*ci));
		}
	}
	catnum++;
}
Example #11
0
void CPasteFunctionDialog::PostInit()
{
	fCellView = fOwner->GetCellView();
	
	BAutolock lock(this);
	if (!lock.IsLocked())
		THROW((errLockWindow));

	fList = (BListView *)FindView("list");
	fList->SetInvocationMessage(new BMessage(msg_OK));
	fList->SetSelectionMessage(new BMessage(msg_FuncChanged));
//	fList->SetFont(be_plain_font);

	fFuncDescription = (BTextView *)FindView("desc");

	BMenuField *mf = dynamic_cast<BMenuField *>(FindView("group"));
	fMenu = mf->Menu();
	fMenu->AddItem(new BMenuItem("All", new BMessage(msg_MenuChanged)));
	fMenu->AddSeparatorItem();
	fMenu->AddItem(new BMenuItem("Cell", new BMessage(msg_MenuChanged)));
	fMenu->AddItem(new BMenuItem("Date-Time", new BMessage(msg_MenuChanged)));
	fMenu->AddItem(new BMenuItem("Financial", new BMessage(msg_MenuChanged)));
	fMenu->AddItem(new BMenuItem("Math", new BMessage(msg_MenuChanged)));
	fMenu->AddItem(new BMenuItem("Statistical", new BMessage(msg_MenuChanged)));
	fMenu->AddItem(new BMenuItem("Text", new BMessage(msg_MenuChanged)));
	fMenu->AddItem(new BMenuItem("Logical", new BMessage(msg_MenuChanged)));
	fMenu->AddItem(new BMenuItem("Engineering", new BMessage(msg_MenuChanged)));
	fMenu->AddItem(new BMenuItem("Plugins", new BMessage(msg_MenuChanged)));

	fMenu->FindItem("All")->SetMarked(true);

	FillList();
	
	Show();
} /* CPasteFunctionDialog::CPasteFunctionDialog */
Example #12
0
void PecoApp::NoRenamer() {
	if (fRenameMode == MODE_NONE) return;

	fWindow->Lock();
	BMenuField	*myField = (BMenuField *)fWindow->FindView("selectMode");
	BMenu		*myMenu = myField->Menu();
	
	myMenu->FindMarked()->SetMarked(false);

	myField->MenuItem()->SetLabel(STR_PLEASE_SELECT);
	
	BView	*bottomView = fWindow->FindView("bottomView");
	bottomView->RemoveChild((BView *)((PecoApp *)be_app)->fRenamers[fRenameMode]);

	fRenameMode = MODE_NONE;

	float deltaHeight = - be_plain_font->Size()*2 - 40;

	float min_h, max_h, min_v, max_v;
	fWindow->GetSizeLimits( &min_h, &max_h, &min_v, &max_v );
	fWindow->SetSizeLimits( min_h, max_h, min_v + deltaHeight, max_v );

	fWindow->FindView("topView")->SetResizingMode(0);
	fWindow->FindView("bottomView")->SetResizingMode(B_FOLLOW_TOP_BOTTOM);	
	fWindow->ResizeBy(0, deltaHeight);
	fWindow->FindView("topView")->SetResizingMode(B_FOLLOW_TOP_BOTTOM);
	fWindow->FindView("bottomView")->SetResizingMode(B_FOLLOW_BOTTOM);	

	fWindow->Unlock();

}
Example #13
0
void PecoApp::ChangeRenamer() {
	BMenuField	*myField = (BMenuField *)fWindow->FindView("selectMode");
	BMenu		*myMenu = myField->Menu();
	if (fRenameMode != myMenu->IndexOf(myField->Menu()->FindMarked())) {
		BView	*bottomView = fWindow->FindView("bottomView");
		fWindow->Lock();
		if (fRenameMode != -1) 
			bottomView->RemoveChild((BView *)((PecoApp *)be_app)->fRenamers[fRenameMode]);
		else {
			float deltaHeight = be_plain_font->Size()*2 + 40;
			fWindow->FindView("topView")->SetResizingMode(0);
			fWindow->FindView("bottomView")->SetResizingMode(B_FOLLOW_TOP_BOTTOM);	
			fWindow->ResizeBy(0, deltaHeight);
			fWindow->FindView("topView")->SetResizingMode(B_FOLLOW_TOP_BOTTOM);
			fWindow->FindView("bottomView")->SetResizingMode(B_FOLLOW_BOTTOM);	
			float min_h, max_h, min_v, max_v;
			fWindow->GetSizeLimits( &min_h, &max_h, &min_v, &max_v );
			fWindow->SetSizeLimits( min_h, max_h, min_v + deltaHeight, max_v );
		}
		fRenameMode = myMenu->IndexOf(myField->Menu()->FindMarked());
		bottomView->AddChild(((PecoApp *)be_app)->fRenamers[fRenameMode]);
		if (((PecoApp *)be_app)->fRenamers[fRenameMode]->ChildAt(0) != NULL) 
			((PecoApp *)be_app)->fRenamers[fRenameMode]->ChildAt(0)->MakeFocus();
		else
			fWindow->FindView("DoIt")->MakeFocus();
		fWindow->Unlock();
		MakeList();
	}
}
Example #14
0
int CharismaWindow::getprefs()
{
	FILE *f;
	char s[200],param[200];
	int d;
	char fname[B_PATH_NAME_LENGTH];
	int r;
	float x,y;

	r=find_directory(B_COMMON_SETTINGS_DIRECTORY,0,true,fname,sizeof fname);
	if(r) return r;
	strcat(fname,"/");
	strcat(fname,"Charisma_settings");
	
	f=fopen(fname,"r");
	if(!f)return -1;

	if(!fgets(s,sizeof s,f)) goto error;
	if(strcmp(s,"Charisma_settings\n")) goto error;
	
	if(!fgets(s,sizeof s,f)) goto error;
	if(!sscanf(s,"version=%d",&d)) goto error;

	if(!fgets(s,sizeof s,f)) goto error;
	if(!sscanf(s,"directory=%[^\n]",g_webdir)) goto error;

	if(!fgets(s,sizeof s,f)) goto error;
	if(!sscanf(s,"mode=%d",&d)) goto error;
	modemenu->Menu()->ItemAt(d)->SetMarked(true);

	if(!fgets(s,sizeof s,f)) goto error;
	if(!sscanf(s,"smart_refresh=%d",&d)) goto error;
	smartrefresh->Menu()->ItemAt(d)->SetMarked(true);

	if(!fgets(s,sizeof s,f)) goto error;
	if(!sscanf(s,"external_control=%s",param)) goto error;
	extcontrol_item->SetMarked(!strcmp(param,"yes"));

	if(!fgets(s,sizeof s,f)) goto error;
	if(!sscanf(s,"netpositive_autoset=%s",param)) goto error;
	netposautoset_item->SetMarked(!strcmp(param,"yes"));

	if(!fgets(s,sizeof s,f)) goto error;
	if(2!=sscanf(s,"position=%f,%f\n",&x,&y)) goto error;
	MoveTo(x,y);

	if(!fgets(s,sizeof s,f)) goto error;
	if(!sscanf(s,"minimized=%s",&param)) goto error;
	if(!strcmp(param,"yes")) Minimize(true);

	fclose(f);
	update_proxy_settings();
	return 0;
	
error:
	fclose(f);
	update_proxy_settings();
	return -1;
}
Example #15
0
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);
}
Example #16
0
// --------------------------------------------------------------
NetworkSetupWindow::NetworkSetupWindow(const char *title)
    :
    BWindow(BRect(100, 100, 300, 300), title, B_TITLED_WINDOW,
           B_ASYNCHRONOUS_CONTROLS | B_NOT_ZOOMABLE | B_AUTO_UPDATE_SIZE_LIMITS),
    fAddonCount(0)
{
    // ---- Profiles section
    BMenu *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);

    // ---- Settings section

    fPanel = new BTabView("showview_box");

    fApplyButton = new BButton("apply", B_TRANSLATE("Apply"),
                               new BMessage(kMsgApply));
    SetDefaultButton(fApplyButton);

    fRevertButton = new BButton("revert", B_TRANSLATE("Revert"),
                                new BMessage(kMsgRevert));
    // fRevertButton->SetEnabled(false);

    // Enable boxes resizing modes
    //fPanel->SetResizingMode(B_FOLLOW_ALL);

    // Build the layout
    SetLayout(new BGroupLayout(B_VERTICAL));

    AddChild(BGroupLayoutBuilder(B_VERTICAL, B_USE_SMALL_SPACING)
             .AddGroup(B_HORIZONTAL, B_USE_SMALL_SPACING)
             .Add(profilesMenuField)
             .AddGlue()
             .End()
             .Add(fPanel)
             .AddGroup(B_HORIZONTAL, B_USE_DEFAULT_SPACING)
             .Add(fRevertButton)
             .AddGlue()
             .Add(fApplyButton)
             .End()
             .SetInsets(B_USE_SMALL_SPACING, B_USE_SMALL_SPACING,
                        B_USE_SMALL_SPACING, B_USE_SMALL_SPACING)
            );

    _BuildShowTabView(kMsgAddonShow);

    fPanel->SetExplicitMinSize(BSize(fMinAddonViewRect.Width(),
                                     fMinAddonViewRect.Height()));

    fAddonView = NULL;

    CenterOnScreen();
}
SMTPConfigView::SMTPConfigView(MailAddonSettings& settings,
	BMailAccountSettings& accountSettings)
	:
	BMailProtocolConfigView(B_MAIL_PROTOCOL_HAS_AUTH_METHODS
		| B_MAIL_PROTOCOL_HAS_USERNAME | B_MAIL_PROTOCOL_HAS_PASSWORD
		| B_MAIL_PROTOCOL_HAS_HOSTNAME
#ifdef USE_SSL
		| B_MAIL_PROTOCOL_HAS_FLAVORS
#endif
		)
{
#if defined(USE_SSL) || defined(B_COLLECTING_CATKEYS)
	static const char* kUnencryptedStr = B_TRANSLATE_MARK("Unencrypted");
	static const char* kSSLStr = B_TRANSLATE_MARK("SSL");
	static const char* kSTARTTLSStr = B_TRANSLATE_MARK("STARTTLS");
#endif

#ifdef USE_SSL
	AddFlavor(B_TRANSLATE_NOCOLLECT(kUnencryptedStr));
	AddFlavor(B_TRANSLATE(kSSLStr));
	AddFlavor(B_TRANSLATE(kSTARTTLSStr));
#endif

	AddAuthMethod(B_TRANSLATE("None"), false);
	AddAuthMethod(B_TRANSLATE("ESMTP"));
	AddAuthMethod(B_TRANSLATE("POP3 before SMTP"), false);

	BTextControl *control = (BTextControl *)(FindView("host"));
	control->SetLabel(B_TRANSLATE("SMTP server:"));

	// Reset the dividers after changing one
	float widestLabel = 0;
	for (int32 i = CountChildren(); i-- > 0;) {
		if (BTextControl *text = dynamic_cast<BTextControl *>(ChildAt(i)))
			widestLabel = MAX(widestLabel,text->StringWidth(text->Label()) + 5);
	}
	for (int32 i = CountChildren(); i-- > 0;) {
		if (BTextControl *text = dynamic_cast<BTextControl *>(ChildAt(i)))
			text->SetDivider(widestLabel);
	}

	BMenuField *field = (BMenuField *)(FindView("auth_method"));
	field->SetDivider(widestLabel);

	SetTo(settings);

	fFileView = new BMailFileConfigView(B_TRANSLATE("Destination:"), "path",
		false, BPrivate::default_mail_out_directory().Path());
	fFileView->SetTo(&settings.Settings(), NULL);
	AddChild(fFileView);
	float w, h;
	BMailProtocolConfigView::GetPreferredSize(&w, &h);
	fFileView->MoveBy(0, h - 10);
	GetPreferredSize(&w, &h);
	ResizeTo(w, h);
}
Example #18
0
void
BMailProtocolConfigView::AddFlavor(const char *label)
{
	BMenuField *menu = (BMenuField *)(FindView("flavor"));
	if (menu != NULL) {
		menu->Menu()->AddItem(new BMenuItem(label,NULL));
		if (menu->Menu()->FindMarked() == NULL)
			menu->Menu()->ItemAt(0)->SetMarked(true);
	}
}
Example #19
0
/***********************************************************
 * AccountName
 ***********************************************************/
const char*
HAddressView::AccountName()
{
	BMenuField *field = cast_as(FindView("FromMenu"),BMenuField);
	BMenu *menu = field->Menu();
	BMenuItem *item = menu->FindMarked();
	if(!item)
		return NULL;
	return item->Label();
}
Example #20
0
void CharismaWindow::setdefaults()
{
	extcontrol_item->SetMarked(1);
	netposautoset_item->SetMarked(0);
		
	modemenu->Menu()->ItemAt(k_offline)->SetMarked(true);
	smartrefresh->Menu()->ItemAt(3)->SetMarked(true);

	update_proxy_settings();
}
Example #21
0
void
HWindow::_InitGUI()
{
	fEventList = new HEventList();
	fEventList->SetType(BMediaFiles::B_SOUNDS);
	fEventList->SetSelectionMode(B_SINGLE_SELECTION_LIST);

	BMenu* menu = new BMenu("file");
	menu->SetRadioMode(true);
	menu->SetLabelFromMarked(true);
	menu->AddSeparatorItem();
	menu->AddItem(new BMenuItem(B_TRANSLATE("<none>"),
		new BMessage(M_NONE_MESSAGE)));
	menu->AddItem(new BMenuItem(B_TRANSLATE("Other" B_UTF8_ELLIPSIS),
		new BMessage(M_OTHER_MESSAGE)));

	BString label(B_TRANSLATE("Sound file:"));
	BMenuField* menuField = new BMenuField("filemenu", label, menu);
	menuField->SetDivider(menuField->StringWidth(label) + 10);

	BSize buttonsSize(be_plain_font->Size() * 2.5, be_plain_font->Size() * 2.5);

	BButton* stopbutton = new BButton("stop", "\xE2\x96\xA0",
		new BMessage(M_STOP_MESSAGE));
	stopbutton->SetEnabled(false);
	stopbutton->SetExplicitSize(buttonsSize);

	// We need at least one view to trigger B_PULSE_NEEDED events which we will
	// intercept in DispatchMessage to trigger the buttons enabling or disabling.
	stopbutton->SetFlags(stopbutton->Flags() | B_PULSE_NEEDED);

	BButton* playbutton = new BButton("play", "\xE2\x96\xB6",
		new BMessage(M_PLAY_MESSAGE));
	playbutton->SetEnabled(false);
	playbutton->SetExplicitSize(buttonsSize);

	BLayoutBuilder::Group<>(this, B_VERTICAL)
		.SetInsets(B_USE_WINDOW_SPACING)
		.Add(fEventList)
		.AddGroup(B_HORIZONTAL)
			.Add(menuField)
			.AddGroup(B_HORIZONTAL, 0)
				.Add(playbutton)
				.Add(stopbutton)
			.End()
		.End();

	// setup file menu
	_SetupMenuField();
	BMenuItem* noneItem = menu->FindItem(B_TRANSLATE("<none>"));
	if (noneItem != NULL)
		noneItem->SetMarked(true);

	_UpdateZoomLimits();
}
Example #22
0
void TeamListView::UpdatePopUpPriorityMenu()
{
	BMenuField *Priority = (BMenuField *)slayer->mainWindow->FindView("MainPriorityField");
	BMenu *menu = Priority->Menu();
	BMenuItem *item;
	int32 i;
	for (i = 2; (item = menu->ItemAt(i)); i++) {
		priorityMenu->ItemAt(i-2)->SetMarked(item->IsMarked());
		priorityMenu->ItemAt(i-2)->SetEnabled(item->IsEnabled());
	}
}
Example #23
0
void
BMailProtocolConfigView::AttachedToWindow()
{
	BMenuField *menu = (BMenuField *)(FindView("auth_method"));
	if (menu != NULL)
		menu->Menu()->SetTargetForItems(this);

	BCheckBox *box = (BCheckBox *)(FindView("leave_mail_on_server"));
	if (box != NULL)
		box->SetTarget(this);
}
Example #24
0
void _EndpointList::SelectionChanged()
{
	inherited::SelectionChanged();
	_EndpointRow*	row = dynamic_cast<_EndpointRow*>( CurrentSelection() );
	if (row && row->mIsValid) {
		row->SelectionSetup(this);
		if (mDeviceTarget && !mDeviceTarget->IsEnabled() ) mDeviceTarget->SetEnabled(true);
		if (mLabelTarget && !mLabelTarget->IsEnabled() ) mLabelTarget->SetEnabled(true);
	} else {
		if (mDeviceTarget && mDeviceTarget->IsEnabled() ) mDeviceTarget->SetEnabled(false);
		if (mLabelTarget && mLabelTarget->IsEnabled() ) mLabelTarget->SetEnabled(false);
	}
}
Example #25
0
void
BMailProtocolConfigView::AddAuthMethod(const char *label,bool needUserPassword)
{
	BMenuField *menu = (BMenuField *)(FindView("auth_method"));
	if (menu != NULL) {
		BMenuItem *item = new BMenuItem(label,new BMessage(needUserPassword ? 'some' : 'none'));

		menu->Menu()->AddItem(item);

		if (menu->Menu()->FindMarked() == NULL) {
			menu->Menu()->ItemAt(0)->SetMarked(true);
			MessageReceived(menu->Menu()->ItemAt(0)->Message());
		}
	}
}
Example #26
0
void
TestWindow::AddTest(Test* test)
{
	if (test == NULL || fTests.HasItem(test))
		return;

	if (!fTests.AddItem(test)) {
		delete test;
		return;
	}

	BMessage* message = new BMessage(MSG_SELECT_TEST);
	message->AddInt32("index", fTests.CountItems() - 1);

	BMenuItem* item = new BMenuItem(test->Name(), message);
	if (!fTestSelectionField->Menu()->AddItem(item)) {
		fTests.RemoveItem(fTests.CountItems() - 1);
		delete test;
		delete item;
		return;
	}

	if (fTests.CountItems() == 1)
		SetToTest(0);
}
Example #27
0
status_t
NotifierConfigView::SaveInto(BMailAddOnSettings& settings) const
{
	int32 method = 0;

	BMenuField *field;
	if ((field = dynamic_cast<BMenuField *>(FindView("notify"))) != NULL) {
		for (int32 i = field->Menu()->CountItems(); i-- > 0;) {
			BMenuItem *item = field->Menu()->ItemAt(i);
			if (item->IsMarked())
				method |= 1L << i;
		}
	}

	return settings.SetInt32("notification_method", method);
}
Example #28
0
void
AccountView::AttachedToWindow()
{
	// Once we are attached to window, the GUI is already created
	// so we can set our window as target for messages
	for (int32 i = 0; i < CountChildren(); i++) {
		BView* child = ChildAt(i);

		BMenu* menu = dynamic_cast<BMenu*>(child);
		BMenuField* menuField
			= dynamic_cast<BMenuField*>(child);
		BTextControl* textControl
			= dynamic_cast<BTextControl*>(child);
		NotifyingTextView* textView
			= dynamic_cast<NotifyingTextView*>(child);
		BCheckBox* checkBox = dynamic_cast<BCheckBox*>(child);

		if (menuField)
			menu = menuField->Menu();

		if (menu) {
			for (int32 j = 0; j < menu->CountItems(); j++) {
				BMenuItem* item = menu->ItemAt(j);
				item->SetMessage(new BMessage(kChanged));
				item->SetTarget(Window());
			}

			menu->SetTargetForItems(Window());
		}

		if (textControl) {
			textControl->SetMessage(new BMessage(kChanged));
			textControl->SetTarget(Window());
		}

		if (checkBox) {
			checkBox->SetMessage(new BMessage(kChanged));
			checkBox->SetTarget(Window());
		}

		if (textView) {
			textView->SetMessage(new BMessage(kChanged));
			textView->SetTarget(Window());
		}
	}
}
Example #29
0
void ConfigView::SetTo(const BMessage *archive)
{
	int32 method = archive->FindInt32("notification_method");
	if (method < 0)
		method = 1;

	BMenuField *field;
	if ((field = dynamic_cast<BMenuField *>(FindView("notify"))) == NULL)
		return;

	for (int32 i = field->Menu()->CountItems();i-- > 0;)
	{
		BMenuItem *item = field->Menu()->ItemAt(i);
		item->SetMarked((method & (1L << i)) != 0);
	}
	UpdateNotifyText();
}
OpenGLView::OpenGLView()
	:
	BGroupView("OpenGLView", B_VERTICAL)
{

	BGLView* glView = new BGLView(BRect(0, 0, 1, 1), "gl info", B_FOLLOW_NONE, 0,
		BGL_RGB | BGL_DOUBLE);
	glView->Hide();
	AddChild(glView);

	glView->LockGL();

    BMenu* menu = new BMenu(B_TRANSLATE("Automatic"));
    menu->SetRadioMode(true);
    menu->SetLabelFromMarked(true);
    menu->AddItem(new BMenuItem(B_TRANSLATE("Automatic"),
        new BMessage(MENU_AUTO_MESSAGE)));
    menu->AddSeparatorItem();
    menu->AddItem(new BMenuItem(B_TRANSLATE("Software Rasterizer"),
        new BMessage(MENU_SWRAST_MESSAGE)));
    menu->AddItem(new BMenuItem(B_TRANSLATE("Gallium Software Pipe"),
        new BMessage(MENU_SWPIPE_MESSAGE)));
    menu->AddItem(new BMenuItem(B_TRANSLATE("Gallium LLVM Pipe"),
        new BMessage(MENU_SWLLVM_MESSAGE)));
    BMenuField* menuField = new BMenuField("renderer",
        B_TRANSLATE("3D Rendering Engine:"), menu);
	// TODO:  Set current Renderer
	menuField->SetEnabled(false);

	BTabView *tabView = new BTabView("tab view", B_WIDTH_FROM_LABEL);
	tabView->AddTab(new InfoView());
	tabView->AddTab(new CapabilitiesView());
	tabView->AddTab(new ExtensionsView());

	glView->UnlockGL();

	GroupLayout()->SetSpacing(0);
	BLayoutBuilder::Group<>(this)
		.SetInsets(B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING,
			B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING)
		.Add(menuField)
		.AddGroup(B_HORIZONTAL)
			.Add(tabView)
			.SetInsets(0, B_USE_DEFAULT_SPACING, 0, 0);
}