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


C++ BFilePanel::SetButtonLabel方法代码示例

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


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

示例1: getMountFolder

		// getMountFolder()
		//
		void getMountFolder()
		{
			char path[B_PATH_NAME_LENGTH];
			entry_ref entryRef;

			find_directory(B_USER_DIRECTORY, 0, false, path, sizeof(path));
			BEntry entry(path, false);
			entry.GetRef(&entryRef);
			BFilePanel *filePanel = new BFilePanel(B_OPEN_PANEL, &be_app_messenger, &entryRef, B_DIRECTORY_NODE, false);
			filePanel->Show();
			filePanel->Window()->SetTitle("Mount Location");
			filePanel->SetButtonLabel(B_DEFAULT_BUTTON, "Mount");
		}
开发者ID:HaikuArchives,项目名称:BeServed,代码行数:15,代码来源:MyNetApp.cpp

示例2: msg


//.........这里部分代码省略.........


	//bool handled (false);

// ignore this part until some minor details with DCC Prefs are worked out
/*
		const char *directory = "/boot/home/";
		entry_ref ref;
		BEntry entry;

		create_directory (directory, 0777);
		if (entry.SetTo (directory) == B_NO_ERROR 
		if (entry.GetRef (&ref)     == B_NO_ERROR)
		{
			BDirectory dir (&ref);
			BEntry file_entry; 
			struct stat s;

			if (file_entry.SetTo (&dir, file.String()) == B_NO_ERROR
			&&  file_entry.GetStat (&s)       == B_NO_ERROR
			&&  S_ISREG (s.st_mode))
			{
				BString buffer;
				BAlert *alert;
				int32 which;

				buffer << "The file \""
					<< file
					<< "\" already exists in the specified folder.  "
						"Do you want to continue the transfer?";

				alert = new BAlert (
					"DCC Request",
					buffer.String(),
					"Refuse",
					"Get",
					"Resume",
					B_WIDTH_AS_USUAL,
					B_OFFSET_SPACING,
					B_WARNING_ALERT);

				which = alert->Go();

				if (which == 0)
				{
					return;
				}

				if (which == 2)
				{
					BFile file (&file_entry, B_READ_ONLY);
					off_t position;
					BPath path;

					file.GetSize (&position);
					file_entry.GetPath (&path);
					msg.AddString ("path", path.Path());
					msg.AddInt64 ("pos", position);

					AddResumeData (&msg);
					return;
				}
			}

			msg.AddRef ("directory", &ref);
			msg.AddString ("name", file);
			sMsgr.SendMessage (&msg);
			handled = true;
		}
	}
*/
	BFilePanel *panel;
	BString text;

	text << nick
		<< ": "
		<< file
		<< " ("
		<< size
		<< " bytes)";

	panel = new BFilePanel (
		B_SAVE_PANEL,
		&sMsgr,
		0,
		0,
		false,
		&msg);
	panel->SetButtonLabel (B_DEFAULT_BUTTON, "Accept");
	panel->SetButtonLabel (B_CANCEL_BUTTON, "Refuse");
	panel->SetSaveText (file.String());

	if (panel->Window()->Lock())
	{
		panel->Window()->SetTitle (text.String());
		panel->Window()->AddFilter (new DCCFileFilter (panel, msg));
		panel->Window()->Unlock();
	}
	panel->Show();
}
开发者ID:,项目名称:,代码行数:101,代码来源:

示例3: msg

void
ServerAgent::DCCGetDialog (
	BString nick,
	BString file,
	BString size,
	BString ip,
	BString port)
{
	BMessage msg (M_DCC_ACCEPT), reply;
	
	msg.AddString ("vision:nick", nick.String());
	msg.AddString ("vision:file", file.String());
	msg.AddString ("vision:size", size.String());
	msg.AddString ("vision:ip", ip.String());
	msg.AddString ("vision:port", port.String());

      BFilePanel *panel;
	  BString text;

	  text << nick
        << ": "
        << file
        << " ("
        << size
        << " bytes)";

	  panel = new BFilePanel (
        B_SAVE_PANEL,
        &fSMsgr,
        0,
        0,
        false,
        &msg);
      panel->SetButtonLabel (B_DEFAULT_BUTTON, "Accept");
      panel->SetButtonLabel (B_CANCEL_BUTTON, "Refuse");
      panel->SetSaveText (file.String());
      
      BWindow *panelWindow (panel->Window());

      if (panelWindow->Lock())
      {
        panelWindow->SetTitle (text.String());
        panelWindow->SetFlags (panelWindow->Flags() | B_AVOID_FOCUS); 
        panelWindow->AddFilter (new DCCFileFilter (panel, msg));
        if (vision_app->GetBool ("dccAutoAccept"))
        {
          BDirectory path (vision_app->GetString ("dccDefPath"));
          if (path.InitCheck() == B_OK)
            panel->SetPanelDirectory(&path);
        }
        if (vision_app->GetBool ("dccAutoAccept"))
        {
          panelWindow->Hide();
          BButton *button (dynamic_cast<BButton *>(panel->Window()->FindView ("default button")));
          if (button)
            button->Invoke();
        }
        panelWindow->Unlock();
        panel->Show();
        // hack trick to ensure that the file panel doesn't take over the keyboard focus
        // when it pops up
        panelWindow->Lock();
        panelWindow->SetFlags (panelWindow->Flags() & ~B_AVOID_FOCUS);
        panelWindow->Unlock();
      }
}
开发者ID:xray7224,项目名称:Vision,代码行数:66,代码来源:DCCHandler.cpp

示例4: firstWord


//.........这里部分代码省略.........
	
				// use BPath to resolve relative pathnames, above code forces it
				// to use /boot/home as a working dir as opposed to the app path
	
				BPath sendPath(filePath, NULL, true);
				
				// the BFile is used to verify if the file exists
				// based off the documentation get_ref_for_path *should*
				// return something other than B_OK if the file doesn't exist
				// but that doesn't seem to be working correctly
				
				BFile sendFile(sendPath.Path(), B_READ_ONLY);
				
				// if the file exists, send, otherwise drop to the file panel
				
				if (sendFile.InitCheck() == B_OK)
				{
					sendFile.Unset();
					entry_ref ref;
					get_ref_for_path(sendPath.Path(), &ref);
					msg->AddRef("refs", &ref);
					sMsgr.SendMessage(msg);	
					return true;	
				}
			}
			BFilePanel *myPanel (new BFilePanel);
			BString myTitle ("Sending a file to ");
	
			myTitle.Append (theNick);
			myPanel->Window()->SetTitle (myTitle.String());
	
			myPanel->SetMessage (msg);
	
			myPanel->SetButtonLabel (B_DEFAULT_BUTTON, "Send");
			myPanel->SetTarget (sMsgr);
			myPanel->Show();
		}
		else if (secondWord.ICompare ("CHAT") == 0
		&&       theNick != "-9z99")
		{
			BMessage msg (CHAT_ACTION);
	
			msg.AddString ("nick", theNick.String());
	
			sMsgr.SendMessage (&msg);
		}
		
		return true;
	}
	
	
	if (firstWord == "/DOP" || firstWord == "/DEOP")
	{
		BString theNick (RestOfString (data, 2));

		if (theNick != "-9z99")
		{
			BMessage send (M_SERVER_SEND);
	
			AddSend (&send, "MODE ");
			AddSend (&send, id);
			AddSend (&send, " -oooo ");
			AddSend (&send, theNick);
			AddSend (&send, endl);
		}
		
开发者ID:,项目名称:,代码行数:66,代码来源:


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