本文整理汇总了C++中BMessenger类的典型用法代码示例。如果您正苦于以下问题:C++ BMessenger类的具体用法?C++ BMessenger怎么用?C++ BMessenger使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了BMessenger类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
/*
BHandler *Target(BLooper **looper) const
@case 1 this is uninitialized, looper is NULL
@results should return NULL.
*/
void TargetTester::TargetTest1()
{
BMessenger messenger;
CHK(messenger.Target(NULL) == NULL);
}
示例2: IsTargetLocal
/*
bool IsTargetLocal() const
@case 1 this is uninitialized
@results should return false.
*/
void TargetTester::IsTargetLocalTest1()
{
BMessenger messenger;
CHK(messenger.IsTargetLocal() == false);
}
示例3: switch
void
NetworkPrefsView::MessageReceived (BMessage * msg)
{
switch (msg->what)
{
case M_NETWORK_DEFAULTS:
if (fActiveNetwork.HasString ("name"))
vision_app->SetNetwork (fActiveNetwork.FindString ("name"), &fActiveNetwork);
fActiveNetwork = vision_app->GetNetwork ("defaults");
fNetworkMenu->MenuItem ()->SetLabel ("Defaults");
SetupDefaults (fActiveNetwork);
fDupeItem->SetEnabled (false);
fRemoveItem->SetEnabled (false);
break;
case M_CHOOSE_NETWORK:
{
BMenuItem *item (NULL);
msg->FindPointer ("source", reinterpret_cast < void **>(&item));
SaveCurrentNetwork ();
fActiveNetwork = vision_app->GetNetwork (item->Label ());
fNetworkMenu->MenuItem ()->SetLabel (item->Label ());
UpdatePersonalData (fActiveNetwork);
UpdateNetworkData (fActiveNetwork);
if (BMessenger (fServerPrefs).IsValid ())
fServerPrefs->SetNetworkData (&fActiveNetwork);
fDupeItem->SetEnabled (true);
fRemoveItem->SetEnabled (true);
}
break;
case M_ADD_NEW_NETWORK:
{
if (msg->HasString ("text"))
{
fNetPrompt = NULL;
BString network (msg->FindString ("text"));
network.RemoveAll (" ");
BMenu *menu (fNetworkMenu->Menu ());
for (int32 i = 0; i < menu->CountItems (); i++)
{
BMenuItem *item (menu->ItemAt (i));
if (item && network == item->Label ())
{
dynamic_cast < BInvoker * >(item)->Invoke ();
return;
}
}
BMessage newNet (VIS_NETWORK_DATA);
newNet.AddString ("name", network.String ());
vision_app->SetNetwork (network.String (), &newNet);
BMenuItem *item (new BMenuItem (network.String (), new BMessage (M_CHOOSE_NETWORK)));
menu->AddItem (item, 0);
item->SetTarget (this);
dynamic_cast < BInvoker * >(item)->Invoke ();
}
else
{
BString promptText = B_TRANSLATE("Network Name");
promptText += ": ";
fNetPrompt = new PromptWindow (BPoint (Window ()->Frame ().left + Window ()->Frame ().Width () / 2, Window ()->Frame ().top + Window ()->Frame ().Height () / 2),
promptText.String(), B_TRANSLATE("Add Network"), NULL, this, new BMessage (M_ADD_NEW_NETWORK), NULL, false);
fNetPrompt->Show ();
}
}
break;
case M_REMOVE_CURRENT_NETWORK:
{
const char *name (fActiveNetwork.FindString ("name"));
vision_app->RemoveNetwork (name);
BMenu *menu (fNetworkMenu->Menu ());
for (int32 i = 0; i < menu->CountItems (); i++)
{
BMenuItem *item (menu->ItemAt (i));
if (!strcmp (item->Label (), name))
{
delete menu->RemoveItem (i);
fActiveNetwork.MakeEmpty ();
dynamic_cast < BInvoker * >(menu->ItemAt (0))->Invoke ();
break;
}
}
}
break;
case M_DUPE_CURRENT_NETWORK:
{
if (msg->HasString ("text"))
{
fDupePrompt = NULL;
BString network (msg->FindString ("text"));
network.RemoveAll (" ");
BMenu *menu (fNetworkMenu->Menu ());
for (int32 i = 0; i < menu->CountItems (); i++)
{
BMenuItem *item (menu->ItemAt (i));
if (item && network == item->Label ())
{
dynamic_cast < BInvoker * >(item)->Invoke ();
//.........这里部分代码省略.........
示例4: autolock
void
TBarApp::AddTeam(team_id team, uint32 flags, const char* sig, entry_ref* ref)
{
BAutolock autolock(sSubscriberLock);
if (!autolock.IsLocked())
return;
// have we already seen this team, is this another instance of
// a known app?
BarTeamInfo* multiLaunchTeam = NULL;
int32 teamCount = sBarTeamInfoList.CountItems();
for (int32 i = 0; i < teamCount; i++) {
BarTeamInfo* barInfo = (BarTeamInfo*)sBarTeamInfoList.ItemAt(i);
if (barInfo->teams->HasItem((void*)team))
return;
if (strcasecmp(barInfo->sig, sig) == 0)
multiLaunchTeam = barInfo;
}
if (multiLaunchTeam != NULL) {
multiLaunchTeam->teams->AddItem((void*)team);
int32 subsCount = sSubscribers.CountItems();
if (subsCount > 0) {
BMessage message(kAddTeam);
message.AddInt32("team", team);
message.AddString("sig", multiLaunchTeam->sig);
for (int32 i = 0; i < subsCount; i++)
((BMessenger*)sSubscribers.ItemAt(i))->SendMessage(&message);
}
return;
}
BFile file(ref, B_READ_ONLY);
BAppFileInfo appMime(&file);
BString name;
if (!gLocalizedNamePreferred
|| BLocaleRoster::Default()->GetLocalizedFileName(name, *ref)
!= B_OK) {
name = ref->name;
}
BarTeamInfo* barInfo = new BarTeamInfo(new BList(), flags, strdup(sig),
new BBitmap(IconRect(), kIconColorSpace), strdup(ref->name));
if ((barInfo->flags & B_BACKGROUND_APP) == 0
&& strcasecmp(barInfo->sig, kDeskbarSignature) != 0) {
FetchAppIcon(barInfo->sig, barInfo->icon);
}
barInfo->teams->AddItem((void*)team);
sBarTeamInfoList.AddItem(barInfo);
if (fSettings.expandNewTeams)
fBarView->AddExpandedItem(sig);
int32 subsCount = sSubscribers.CountItems();
if (subsCount > 0) {
for (int32 i = 0; i < subsCount; i++) {
BMessenger* messenger = (BMessenger*)sSubscribers.ItemAt(i);
BMessage message(B_SOME_APP_LAUNCHED);
BList* tList = new BList(*(barInfo->teams));
message.AddPointer("teams", tList);
BBitmap* icon = new BBitmap(barInfo->icon);
ASSERT(icon);
message.AddPointer("icon", icon);
message.AddInt32("flags", static_cast<int32>(barInfo->flags));
message.AddString("name", barInfo->name);
message.AddString("sig", barInfo->sig);
messenger->SendMessage(&message);
}
}
}
示例5: TRACE
status_t
TeamDebugHandler::_HandlerThread()
{
TRACE(("debug_server: TeamDebugHandler::_HandlerThread(): team %" B_PRId32
"\n", fTeam));
// get initial message
TRACE(("debug_server: TeamDebugHandler::_HandlerThread(): team %" B_PRId32
": getting message...\n", fTeam));
DebugMessage *message;
status_t error = _PopMessage(message);
int32 debugAction = kActionKillTeam;
if (error == B_OK) {
// handle the message
debugAction = _HandleMessage(message);
delete message;
} else {
debug_printf("TeamDebugHandler::_HandlerThread(): Failed to pop "
"initial message: %s", strerror(error));
}
bool isGuiServer = _IsGUIServer();
// kill the team or hand it over to the debugger
thread_id debuggerThread = -1;
if (debugAction == kActionKillTeam) {
// The team shall be killed. Since that is also the handling in case
// an error occurs while handing over the team to the debugger, we do
// nothing here.
} else if ((debuggerThread = _EnterDebugger(
debugAction == kActionSaveReportTeam)) >= 0) {
// wait for the "handed over" or a "team deleted" message
bool terminate = false;
do {
error = _PopMessage(message);
if (error != B_OK) {
debug_printf("TeamDebugHandler::_HandlerThread(): Failed to "
"pop message: %s", strerror(error));
debugAction = kActionKillTeam;
break;
}
if (message->Code() == B_DEBUGGER_MESSAGE_HANDED_OVER) {
// The team has successfully been handed over to the debugger.
// Nothing to do.
terminate = true;
} else if (message->Code() == B_DEBUGGER_MESSAGE_TEAM_DELETED) {
// The team died. Nothing to do.
terminate = true;
} else {
// Some message we can ignore. The debugger will take care of
// it.
// check whether the debugger thread still lives
thread_info threadInfo;
if (get_thread_info(debuggerThread, &threadInfo) != B_OK) {
// the debugger is gone
debug_printf("debug_server: The debugger for team %"
B_PRId32 " seems to be gone.", fTeam);
debugAction = kActionKillTeam;
terminate = true;
}
}
delete message;
} while (!terminate);
} else
debugAction = kActionKillTeam;
if (debugAction == kActionKillTeam) {
// kill the team
_KillTeam();
}
// remove this handler from the roster and delete it
TeamDebugHandlerRoster::Default()->RemoveHandler(fTeam);
if (isGuiServer) {
// wait till debugging is done
status_t dummy;
wait_for_thread(debuggerThread, &dummy);
// find the registrar port
port_id rosterPort = find_port(BPrivate::get_roster_port_name());
port_info info;
BMessenger messenger;
if (rosterPort >= 0 && get_port_info(rosterPort, &info) == B_OK) {
BMessenger::Private(messenger).SetTo(info.team, rosterPort,
B_PREFERRED_TOKEN);
}
messenger.SendMessage(kMsgRestartAppServer);
}
delete this;
return B_OK;
}
示例6: process_refs
/*!
\brief Tracker add-on entry
*/
extern "C" void
process_refs(entry_ref dir, BMessage* refs, void* /*reserved*/)
{
status_t status;
BAlert *alert;
BMessenger msgr;
BPoseView *view = NULL;
BMessage poseViewBackup;
BMessage poseViewColumnBackup;
uint32 poseViewModeBackup;
BString windowTitleBackup;
refs->PrintToStream();
status = refs->FindMessenger("TrackerViewToken", &msgr);
if (status < B_OK) {
Error(view, status);
return;
}
status = B_ERROR;
if (!msgr.LockTarget()) {
Error(view, status);
return;
}
status = B_BAD_HANDLER;
view = dynamic_cast<BPoseView *>(msgr.Target(NULL));
if (!view) {
Error(view, status);
return;
}
if (dynamic_cast<BWindow *>(view->Looper()) == NULL) {
Error(view, status, true);
return;
}
windowTitleBackup = view->Window()->Title();
view->SaveColumnState(poseViewColumnBackup);
view->SaveState(poseViewBackup);
view->SetDragEnabled(false);
view->SetSelectionRectEnabled(false);
view->SetPoseEditing(false);
poseViewModeBackup = view->ViewMode();
view->SetViewMode(kIconMode);
view->ShowBarberPole();
view->UnlockLooper();
alert = new BAlert("Error", "IconVader:\nClick on the icons to get points."
"\nAvoid symlinks!", "OK");
alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE);
alert->Go();
int32 score = 0;
int32 count = 300;
while (count--) {
status = B_ERROR;
if (!msgr.LockTarget()) {
Error(view, status);
return;
}
BPose *pose;
for (int32 i = 0; (pose = view->PoseAtIndex(i)); i++) {
if (pose->IsSelected()) {
if (pose->TargetModel()->IsFile())
score++;
if (pose->TargetModel()->IsDirectory())
score+=2;
if (pose->TargetModel()->IsSymLink())
score-=10;
pose->Select(false);
}
#ifdef __HAIKU__
BPoint location = pose->Location(view);
#else
BPoint location = pose->Location();
#endif
location.x += ((rand() % 20) - 10);
location.y += ((rand() % 20) - 10);
#ifdef __HAIKU__
pose->SetLocation(location, view);
#else
pose->SetLocation(location);
#endif
}
view->CheckPoseVisibility();
//.........这里部分代码省略.........
示例7: r
PeepsWindow::PeepsWindow(BMessenger target)
: BWindow(BRect(50,50,600,470), "Mr. Peeps!", B_DOCUMENT_WINDOW, B_NOT_ZOOMABLE | B_NOT_H_RESIZABLE)
{
float wmin,wmax,hmin,hmax;
GetSizeLimits(&wmin,&wmax,&hmin,&hmax);
wmin=500;
hmin=400;
SetSizeLimits(wmin,wmax,hmin,hmax);
ReadLocaleSettings();
if(fLocale.CountChars()>0)
{
locale_roster->SetLocale(fLocale.String());
gCurrentLocale=locale_roster->GetLocale();
}
BRect r(Bounds());
BMessage *msg;
r.bottom=20;
BMenuBar *mb=new BMenuBar(r,"menubar");
AddChild(mb);
fPeopleMenu=new BMenu(TRANSLATE("Person"));
fPeopleMenu->AddItem(new BMenuItem(TRANSLATE("New"),new BMessage(M_ADD_PERSON),'N'));
fPeopleMenu->AddSeparatorItem();
fPeopleMenu->AddItem(new BMenuItem(TRANSLATE("Previous"),new BMessage(M_PREV_ITEM),B_UP_ARROW));
fPeopleMenu->AddItem(new BMenuItem(TRANSLATE("Next"),new BMessage(M_NEXT_ITEM),B_DOWN_ARROW));
fPeopleMenu->AddSeparatorItem();
fActionsMenu=new BMenu(TRANSLATE("Actions"));
// Submenu for sending e-mail
BMenu *emailmenu=new BMenu(TRANSLATE("Send E-Mail to"));
fEmailPersonalItem=new BMenuItem(TRANSLATE("Personal Address"),new BMessage(M_SEND_PERSONAL_EMAIL));
emailmenu->AddItem(fEmailPersonalItem);
fEmailWorkItem=new BMenuItem(TRANSLATE("Work Address"),new BMessage(M_SEND_WORK_EMAIL));
emailmenu->AddItem(fEmailWorkItem);
fEmailAltItem=new BMenuItem(TRANSLATE("Alternate Address"),new BMessage(M_SEND_ALT_EMAIL));
emailmenu->AddItem(fEmailAltItem);
fActionsMenu->AddItem(emailmenu);
// Submenu for sending e-mail
BMenu *browsermenu=new BMenu(TRANSLATE("Go to Web Page"));
fBrowseHomeItem=new BMenuItem(TRANSLATE("Personal Web Address"),new BMessage(M_BROWSE_WWW_HOME));
browsermenu->AddItem(fBrowseHomeItem);
fBrowseWorkItem=new BMenuItem(TRANSLATE("Work Web Address"),new BMessage(M_BROWSE_WWW_WORK));
browsermenu->AddItem(fBrowseWorkItem);
fBrowseAltItem=new BMenuItem(TRANSLATE("Alternate Web Address"),new BMessage(M_BROWSE_WWW_ALT));
browsermenu->AddItem(fBrowseAltItem);
fActionsMenu->AddItem(browsermenu);
fActionsMenu->AddSeparatorItem();
fPastePhotoItem=new BMenuItem(TRANSLATE("Paste Photo from Clipboard"),new BMessage(M_PASTE_IMAGE));
fActionsMenu->AddItem(fPastePhotoItem);
fRemovePhotoItem=new BMenuItem(TRANSLATE("Remove Photo"),new BMessage(M_REMOVE_IMAGE));
fActionsMenu->AddItem(fRemovePhotoItem);
fActionsMenu->AddSeparatorItem();
fActionsMenu->AddItem(new BMenuItem(TRANSLATE("Move To Trash"),new BMessage(M_DELETE_PERSON),'T'));
fPeopleMenu->AddItem(fActionsMenu);
fActionsMenu->SetEnabled(false);
fPeopleMenu->AddSeparatorItem();
fPeopleMenu->AddItem(new BMenuItem(TRANSLATE("About..."),new BMessage(B_ABOUT_REQUESTED)));
mb->AddItem(fPeopleMenu);
fEditMenu=new BMenu(TRANSLATE("Edit"));
fEditMenu->AddItem(new BMenuItem(TRANSLATE("Undo"),new BMessage(M_UNDO),'Z'));
fEditMenu->AddSeparatorItem();
fEditMenu->AddItem(new BMenuItem(TRANSLATE("Cut"),new BMessage(M_CUT),'X'));
fEditMenu->AddItem(new BMenuItem(TRANSLATE("Copy"),new BMessage(M_COPY),'C'));
fEditMenu->AddItem(new BMenuItem(TRANSLATE("Paste"),new BMessage(M_PASTE),'V'));
mb->AddItem(fEditMenu);
fEditMenu->SetEnabled(false);
fTabMenu=new BMenu(TRANSLATE("Tab"));
fTabMenu->AddItem(new BMenuItem(TRANSLATE("Main"),new BMessage(M_TAB_1),'1'));
fTabMenu->AddItem(new BMenuItem(TRANSLATE("Personal"),new BMessage(M_TAB_2),'2'));
fTabMenu->AddItem(new BMenuItem(TRANSLATE("Work"),new BMessage(M_TAB_3),'3'));
fTabMenu->AddItem(new BMenuItem(TRANSLATE("Instant Message"),new BMessage(M_TAB_4),'4'));
fTabMenu->AddItem(new BMenuItem(TRANSLATE("Notes"),new BMessage(M_TAB_5),'5'));
mb->AddItem(fTabMenu);
fTabMenu->SetEnabled(false);
BMessage *menumsg;
BEntry toolentry;
// Note that I don't just simply have a way to iterate over whatever's in a folder
// because I want to control what tools are officially supported by Mr. Peeps!
// It's not that I don't want anyone helping -- I just want quality control with
// tool usability.
//.........这里部分代码省略.........
示例8: switch
//--------------------------------------------------------------------
void PrefWindow::MessageReceived(BMessage *message)
{
int32 lang = ENGLISH;
BMenuItem* item;
switch ( message->what )
{
case MSG_PREF_COLOR: {
rgb_color color = colSelector->ValueAsColor();
BMessage* msg = new BMessage(MSG_UPDATE_VIEW_COLOR);
msg->AddData("color", B_RGB_COLOR_TYPE, &color, sizeof(rgb_color));
BMessenger *msng = new BMessenger(mainWin);
msng->SendMessage(msg);
delete msng;
}
break;
case MSG_PREF_OK:
((InterApp*)be_app)->prefs->SetInfobarColor(colSelector->Value());
if (radFollow->Value() != 0)
((InterApp*)be_app)->prefs->SetMouseMode(PIC_FOLLOW_MOUSE);
else
((InterApp*)be_app)->prefs->SetMouseMode(PIC_FLEE_MOUSE);
item = languageMenu->Menu()->FindMarked();
if (item != NULL) {
if (strstr(item->Label(), "[EN]")) {
lang = ENGLISH;
} else if (strstr(item->Label(), "[FR]")) {
lang = FRENCH;
} else if (strstr(item->Label(), "[RU]")) {
lang = RUSSIAN;
} else if (strstr(item->Label(), "[BR]")) {
lang = PORTUGUES;
} else if (strstr(item->Label(), "[IT]")) {
lang = ITALIAN;
} else if (strstr(item->Label(), "[ES]")) {
lang = SPANISH;
} else if (strstr(item->Label(), "[EU]")) {
lang = BASQUE;
} else if (strstr(item->Label(), "[DE]")) {
lang = GERMAN;
}
}
if (lang != ((InterApp*)be_app)->prefs->GetLanguage()) {
((InterApp*)be_app)->prefs->SetLanguage(lang);
BAlert *theAlert = new BAlert("", StringsRsrc[STR_LANG_CHANGED_WARNING],
StringsRsrc[STR_OK]);
theAlert->Go();
}
SetAndWriteAttributes();
Hide();
break;
case MSG_PREF_CANCEL: {
// restore color
rgb_color color = ((InterApp*)be_app)->prefs->GetInfobarColor();
BMessage* msg = new BMessage(MSG_UPDATE_VIEW_COLOR);
msg->AddData("color", B_RGB_COLOR_TYPE, &color, sizeof(rgb_color));
BMessenger *msng = new BMessenger(mainWin);
msng->SendMessage(msg);
delete msng;
}
Hide();
break;
default:
BWindow::MessageReceived(message);
break;
}
}
示例9: BMessenger
status_t
PrintServerMessenger::GetPrintServerMessenger(BMessenger& messenger)
{
messenger = BMessenger(PSRV_SIGNATURE_TYPE);
return messenger.IsValid() ? B_OK : B_ERROR;
}
示例10: switch
void Win::MessageReceived(BMessage *msg) {
switch(msg->what) {
case B_ABOUT_REQUESTED: {
be_app_messenger.SendMessage(B_ABOUT_REQUESTED);
}break;
case B_QUIT_REQUESTED: {
PostMessage(B_QUIT_REQUESTED);
}break;
case PlugInLoaded: {
// printf("WIN: PlugInLoaded\n");
protocol_plugin *pobj=NULL;
// msg->PrintToStream();
msg->FindPointer("plugin",(void**)&pobj);
// printf("pobj: %p\n",pobj);
if (pobj!=NULL) {
// printf("Window: plugin loaded %c%c%c%c\n",(int)pobj->PlugID()>>24,(int)pobj->PlugID()>>16,(int)pobj->PlugID()>>8,(int)pobj->PlugID());
pobj->Window=this;
pobj->AddMenuItems(optionsmenu);
} else {
;//printf("Win: pobj was null\n");
}
}break;
case B_MOUSE_WHEEL_CHANGED :
{
//cout << "B_MOUSE_WHEEL_CHANGED" << endl;
// need to do the scrolling of the urlpopup here
// as the urlpopupwindow never gets focus and thus
// never get the mouse wheel messages
if( urlpopupwindow != NULL )
{
if( urlpopupwindow->vscroll != NULL )
{
float value = msg->FindFloat( "be:wheel_delta_y" );
value *= 10;
urlpopupwindow->Lock();
urlpopupwindow->urlpopupview->ulv->ScrollBy( 0, value );
urlpopupwindow->Unlock();
}
}
// i dunno where the scroll-recognition of the rendered site shall
// happen.. if here, then it should go into here later :D
}break;
case BUTTON_BACK :
{
// printf( "WIN: BUTTON_BACK\n" );
const char* previous = NULL;
previous = ( ( ThemisTab* )tabview->TabAt( tabview->Selection() ) )->GetHistory()->GetPreviousEntry();
if( previous != NULL )
{
// printf( "previous != NULL [ %s ]\n", previous );
BMessage* backmsg = new BMessage( URL_OPEN );
backmsg->AddString( "url_to_open", previous );
backmsg->AddBool( "no_history_add", true );
BMessenger* msgr = new BMessenger( this );
msgr->SendMessage( backmsg );
delete backmsg;
delete msgr;
}
break;
};
case BUTTON_FORWARD :
{
// printf( "WIN: BUTTON_FORWARD\n" );
const char* next = NULL;
next = ( ( ThemisTab* )tabview->TabAt( tabview->Selection() ) )->GetHistory()->GetNextEntry();
if( next != NULL )
{
// printf( "next != NULL [ %s ]\n", next );
BMessage* fwdmsg = new BMessage( URL_OPEN );
fwdmsg->AddString( "url_to_open", next );
fwdmsg->AddBool( "no_history_add", true );
BMessenger* msgr = new BMessenger( this );
msgr->SendMessage( fwdmsg );
delete fwdmsg;
delete msgr;
}
else
{
tabview->SetNavButtonsByTabHistory(); // needed to disable the fwd button
}
break;
}
case BUTTON_STOP :
{
break;
}
case BUTTON_HOME :
{
// printf( "WIN: BUTTON_HOME\n" );
BString homepage;
//.........这里部分代码省略.........
示例11: MouseWatcher
int32 MouseWatcher(void* data)
{
BMessenger *TheMessenger = (BMessenger*)data;
BPoint PreviousPos;
uint32 PreviousButtons = 0;
bool FirstCheck = true;
BMessage MessageToSend;
MessageToSend.AddPoint("where",BPoint(0,0));
MessageToSend.AddInt32("buttons",0);
while(true)
{
if (!TheMessenger->LockTarget())
{
delete TheMessenger;
return 0; // window is dead so exit
}
BLooper *TheLooper;
BView *TheView = (BView*)TheMessenger->Target(&TheLooper);
BPoint Where;
uint32 Buttons;
TheView->GetMouse(&Where,&Buttons,false);
if(FirstCheck)
{
PreviousPos = Where;
PreviousButtons = Buttons;
FirstCheck = false;
}
bool Send = false;
if(Buttons != PreviousButtons || Buttons == 0 || Where != PreviousPos)
{
if(Buttons == 0)
MessageToSend.what = MW_MOUSE_UP;
else if(Buttons != PreviousButtons)
MessageToSend.what = MW_MOUSE_DOWN;
else
MessageToSend.what = MW_MOUSE_MOVED;
MessageToSend.ReplacePoint("where",Where);
MessageToSend.ReplaceInt32("buttons",Buttons);
Send = true;
}
TheLooper->Unlock();
if(Send)
TheMessenger->SendMessage(&MessageToSend);
if(Buttons == 0)
{
//Button was released
delete TheMessenger;
return 0;
}
snooze(50 * 1000);
}
}
示例12: ReadyToRun
virtual void ReadyToRun()
{
unitTesterMessenger.SendMessage(MSG_READY_TO_RUN);
}
示例13: QuitRequested
virtual bool QuitRequested()
{
unitTesterMessenger.SendMessage(MSG_QUIT_REQUESTED);
return true;
}
示例14: RefsReceived
virtual void RefsReceived(BMessage *_message)
{
BMessage message(*_message);
message.what = MSG_REFS_RECEIVED;
unitTesterMessenger.SendMessage(&message);
}