本文整理汇总了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;
}
示例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:
//.........这里部分代码省略.........
示例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);
//.........这里部分代码省略.........