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


C++ BLooper::Name方法代码示例

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


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

示例1: cdactivate

static int cdactivate(cdCtxCanvas *ctxcanvas)
{
  BView* view = ctxcanvas->view;

  BLooper* looper = view->Looper();
  const char* ln = "";
  if (looper != NULL) {
	  ln = looper->Name();
  }
  printf("CD Activate view %p (%s), looper is %s\n", view, view->Name(), ln);

  BRect rect = view->Bounds();

  ctxcanvas->canvas->w = (int)(rect.Width());
  ctxcanvas->canvas->h = (int)(rect.Height());

  ctxcanvas->canvas->w_mm = ((double)ctxcanvas->canvas->w) / ctxcanvas->canvas->xres;
  ctxcanvas->canvas->h_mm = ((double)ctxcanvas->canvas->h) / ctxcanvas->canvas->yres;

  if (ctxcanvas->canvas->use_matrix)
    ctxcanvas->canvas->cxTransform(ctxcanvas, ctxcanvas->canvas->matrix);
  return CD_OK;
}
开发者ID:Vulcanior,项目名称:IUP,代码行数:23,代码来源:cdhaikunative.cpp

示例2: propInfo

BHandler*
BApplication::ResolveSpecifier(BMessage* message, int32 index,
	BMessage* specifier, int32 what, const char* property)
{
	BPropertyInfo propInfo(sPropertyInfo);
	status_t err = B_OK;
	uint32 data;

	if (propInfo.FindMatch(message, 0, specifier, what, property, &data) >= 0) {
		switch (data) {
			case kWindowByIndex:
			{
				int32 index;
				err = specifier->FindInt32("index", &index);
				if (err != B_OK)
					break;

				if (what == B_REVERSE_INDEX_SPECIFIER)
					index = CountWindows() - index;

				BWindow* window = WindowAt(index);
				if (window != NULL) {
					message->PopSpecifier();
					BMessenger(window).SendMessage(message);
				} else
					err = B_BAD_INDEX;
				break;
			}

			case kWindowByName:
			{
				const char* name;
				err = specifier->FindString("name", &name);
				if (err != B_OK)
					break;

				for (int32 i = 0;; i++) {
					BWindow* window = WindowAt(i);
					if (window == NULL) {
						err = B_NAME_NOT_FOUND;
						break;
					}
					if (window->Title() != NULL && !strcmp(window->Title(),
							name)) {
						message->PopSpecifier();
						BMessenger(window).SendMessage(message);
						break;
					}
				}
				break;
			}

			case kLooperByIndex:
			{
				int32 index;
				err = specifier->FindInt32("index", &index);
				if (err != B_OK)
					break;

				if (what == B_REVERSE_INDEX_SPECIFIER)
					index = CountLoopers() - index;

				BLooper* looper = LooperAt(index);
				if (looper != NULL) {
					message->PopSpecifier();
					BMessenger(looper).SendMessage(message);
				} else
					err = B_BAD_INDEX;

				break;
			}

			case kLooperByID:
				// TODO: implement getting looper by ID!
				break;

			case kLooperByName:
			{
				const char* name;
				err = specifier->FindString("name", &name);
				if (err != B_OK)
					break;

				for (int32 i = 0;; i++) {
					BLooper* looper = LooperAt(i);
					if (looper == NULL) {
						err = B_NAME_NOT_FOUND;
						break;
					}
					if (looper->Name() != NULL
						&& strcmp(looper->Name(), name) == 0) {
						message->PopSpecifier();
						BMessenger(looper).SendMessage(message);
						break;
					}
				}
				break;
			}

			case kApplication:
//.........这里部分代码省略.........
开发者ID:yunxiaoxiao110,项目名称:haiku,代码行数:101,代码来源:Application.cpp

示例3: reply

bool
BApplication::ScriptReceived(BMessage* message, int32 index,
	BMessage* specifier, int32 what, const char* property)
{
	BMessage reply(B_REPLY);
	status_t err = B_BAD_SCRIPT_SYNTAX;

	switch (message->what) {
		case B_GET_PROPERTY:
			if (strcmp("Loopers", property) == 0) {
				int32 count = CountLoopers();
				err = B_OK;
				for (int32 i=0; err == B_OK && i<count; i++) {
					BMessenger messenger(LooperAt(i));
					err = reply.AddMessenger("result", messenger);
				}
			} else if (strcmp("Windows", property) == 0) {
				int32 count = CountWindows();
				err = B_OK;
				for (int32 i=0; err == B_OK && i<count; i++) {
					BMessenger messenger(WindowAt(i));
					err = reply.AddMessenger("result", messenger);
				}
			} else if (strcmp("Window", property) == 0) {
				switch (what) {
					case B_INDEX_SPECIFIER:
					case B_REVERSE_INDEX_SPECIFIER:
					{
						int32 index = -1;
						err = specifier->FindInt32("index", &index);
						if (err != B_OK)
							break;

						if (what == B_REVERSE_INDEX_SPECIFIER)
							index = CountWindows() - index;

						err = B_BAD_INDEX;
						BWindow* window = WindowAt(index);
						if (window == NULL)
							break;

						BMessenger messenger(window);
						err = reply.AddMessenger("result", messenger);
						break;
					}

					case B_NAME_SPECIFIER:
					{
						const char* name;
						err = specifier->FindString("name", &name);
						if (err != B_OK)
							break;
						err = B_NAME_NOT_FOUND;
						for (int32 i = 0; i < CountWindows(); i++) {
							BWindow* window = WindowAt(i);
							if (window && window->Name() != NULL
								&& !strcmp(window->Name(), name)) {
								BMessenger messenger(window);
								err = reply.AddMessenger("result", messenger);
								break;
							}
						}
						break;
					}
				}
			} else if (strcmp("Looper", property) == 0) {
				switch (what) {
					case B_INDEX_SPECIFIER:
					case B_REVERSE_INDEX_SPECIFIER:
					{
						int32 index = -1;
						err = specifier->FindInt32("index", &index);
						if (err != B_OK)
							break;

						if (what == B_REVERSE_INDEX_SPECIFIER)
							index = CountLoopers() - index;

						err = B_BAD_INDEX;
						BLooper* looper = LooperAt(index);
						if (looper == NULL)
							break;

						BMessenger messenger(looper);
						err = reply.AddMessenger("result", messenger);
						break;
					}

					case B_NAME_SPECIFIER:
					{
						const char* name;
						err = specifier->FindString("name", &name);
						if (err != B_OK)
							break;
						err = B_NAME_NOT_FOUND;
						for (int32 i = 0; i < CountLoopers(); i++) {
							BLooper* looper = LooperAt(i);
							if (looper != NULL && looper->Name()
								&& strcmp(looper->Name(), name) == 0) {
								BMessenger messenger(looper);
//.........这里部分代码省略.........
开发者ID:yunxiaoxiao110,项目名称:haiku,代码行数:101,代码来源:Application.cpp


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