Пример #1
0
status_t TVideoEditorText::Archive(BMessage* data, bool deep) const
{

	status_t myErr;

	Looper()->Lock();

	// Start by calling inherited archive
	myErr = BView::Archive(data, deep);

	if (myErr == B_OK) {
		// Add our class name to the archive
		data->AddString("class", "TVideoEditorText");

		// Add our member variables to the BMessage
		data->AddInt32("MessageID", fMessageID);
		data->AddFloat("TextSize", fTextSize);
		data->AddData("Font", B_ANY_TYPE, &fFont, sizeof(BFont) );
		data->AddData("Color", B_RGB_COLOR_TYPE, &fColor, sizeof(rgb_color) );
	}

	Looper()->Unlock();

	return myErr;
}
Пример #2
0
// destructor
IFSSaver::~IFSSaver()
{
	if (Looper()) {
		Looper()->RemoveHandler(this);
	}
	_Cleanup();
}
Пример #3
0
status_t TStageWindow::Archive(BMessage *data, bool deep) const
{		
	status_t myErr;
	
	Looper()->Lock();
	
	// Start by calling inherited archive
	myErr = BWindow::Archive(data, deep);
						
	if (myErr == B_OK)
	{					
		// Add our class name to the archive
		data->AddString("class", "TStageWindow");
		
		// Add our member variables to the archive		
				
		// Add attached views
		if (deep)
		{					
			//	StageView			
			if (m_StageView)
			{		
				BMessage childArchive;				
				if ( m_StageView->Archive(&childArchive, deep) == B_OK )
					data->AddMessage("StageView", &childArchive);
			}			
		}		
	}
	
	Looper()->Unlock();
	
	return myErr;
	
}	
Пример #4
0
void
BTitleView::MouseMoved(BPoint where, uint32 code, const BMessage *message)
{
	if (fTrackingState != NULL) {
		int32 buttons = 0;
		if (Looper() != NULL && Looper()->CurrentMessage() != NULL)
			Looper()->CurrentMessage()->FindInt32("buttons", &buttons);
		fTrackingState->MouseMoved(where, buttons);
		return;
	}

	switch (code) {
		default:
			if (InColumnResizeArea(where) && Window()->IsActive())
				SetViewCursor(&fHorizontalResizeCursor);
			else
				SetViewCursor(B_CURSOR_SYSTEM_DEFAULT);
			break;
			
		case B_EXITED_VIEW:
			SetViewCursor(B_CURSOR_SYSTEM_DEFAULT);
			break;
	}
	_inherited::MouseMoved(where, code, message);
}
Пример #5
0
/*!	Since we have set a mouse event mask, we don't want to forward all
	mouse downs to the slider - instead, we only invoke it, which causes a
	message to our target. Within the VolumeWindow, this will actually
	cause the window to close.
	Also, we need to mask out the dragger in this case, or else dragging
	us will also cause a volume update.
*/
void
VolumeControl::MouseDown(BPoint where)
{
	// Ignore clicks on the dragger
	int32 viewToken;
	if (Bounds().Contains(where) && Looper()->CurrentMessage() != NULL
		&& Looper()->CurrentMessage()->FindInt32("_view_token",
				&viewToken) == B_OK
		&& viewToken != _get_object_token_(this))
		return;

	// TODO: investigate why this does not work as expected (the dragger
	// frame seems to be off)
#if 0
	if (BView* dragger = ChildAt(0)) {
		if (!dragger->IsHidden() && dragger->Frame().Contains(where))
			return;
	}
#endif

	if (!IsEnabled() || !Bounds().Contains(where)) {
		Invoke();
		return;
	}

	BSlider::MouseDown(where);
}
Пример #6
0
status_t TCueSheetTimeView::Archive(BMessage *data, bool deep) const
{
		
	status_t myErr;
	
	Looper()->Lock();
	
	// Start by calling inherited archive
	myErr = BView::Archive(data, deep);
						
	if (myErr == B_OK)
	{					
		// Add our class name to the archive
		data->AddString("class", "TCueSheetTimeView");
		
		// Add our member variables to the archive		
				
		// Add attached views
		if (deep)
		{		
		
		}		
	}
	
	Looper()->Unlock();	
	
	return myErr;
}
Пример #7
0
status_t TaskFS::Load(void)
{
	status_t err = B_OK;
	BEntry *tmpEntry = new BEntry();
	TaskList	*newTaskList	= NULL;
	Task		*newTask		= NULL;
	tasks->MakeEmpty();
	taskLists->MakeEmpty();
	while (tasksDir.GetNextEntry(tmpEntry, false) == B_OK) {
		if (tmpEntry->IsDirectory()){
			newTaskList = DirectoryToList(tmpEntry);
			if (newTaskList != NULL){
				BMessage *msg = new BMessage();
				msg->AddPointer("tasklist",newTaskList);
				Looper()->SendNotices(ADD_TASK_LIST,msg);
				taskLists->AddItem(newTaskList);
			}
		}
	}
	while (tasksDir.GetNextEntry(tmpEntry, false) == B_OK) {
		if (tmpEntry->IsDirectory()){
			newTaskList = DirectoryToList(tmpEntry);
			if (newTaskList != NULL){
				BMessage *msg = new BMessage();
				msg->AddPointer("tasklist",newTaskList);
				Looper()->SendNotices(ADD_TASK_LIST,msg);
				taskLists->AddItem(newTaskList);
			}
		}
	}
	tasksDir.Rewind();
	return err;
}
Пример #8
0
status_t TExportZone::Archive(BMessage *data, bool deep) const
{
		
	status_t myErr;
	
	Looper()->Lock();
	
	// Start by calling inherited archive
	myErr = BView::Archive(data, deep);
						
	if (myErr == B_OK)
	{					
		// Add our class name to the archive
		data->AddString("class", "TExportZone");
		
		// Add our member variables to the archive		
		data->AddRect("ExportChannel", m_ExportChannel);
		data->AddRect("InRect", m_InRect);
		data->AddRect("OutRect", m_OutRect);

		// Add attached views
		if (deep)
		{		
		
		}		
	}
	
	Looper()->Unlock();	
	
	return myErr;
}
Пример #9
0
void TVideoEditorText::SetText(char* theText)
{
	sprintf(fText, theText);
	Looper()->Lock();
	Invalidate();
	Looper()->Unlock();
}
Пример #10
0
void NetPrefsServerView::SetNetworkData(BMessage* msg)
{
	// this shouldn't theoretically be able to happen but better safe than sorry
	BLooper* looper(Looper());
	if (looper == NULL) return;

	BAutolock lock(Looper());
	if (!lock.IsLocked()) return;
	// clear previous servers (if any)
	while (fServerList->CountRows() > 0) {
		BRow* row(fServerList->RowAt(0));
		fServerList->RemoveRow(row);
		delete row;
	}

	BString netString(S_PREFSERVER_SEL_STRING);
	netString += msg->FindString("name");
	netString += ":";
	type_code type;
	int32 count;
	ssize_t size;
	const ServerData* data;
	msg->GetInfo("server", &type, &count);
	for (int32 i = 0; i < count; i++) {
		msg->FindData("server", B_ANY_TYPE, i, reinterpret_cast<const void**>(&data), &size);
		AddServer(data);
	}
	fActiveNetwork = msg;
	fSelectTitleString->SetText(netString.String());
	fSelectTitleString->ResizeToPreferred();
}
Пример #11
0
status_t TCueSheetWindow::Archive(BMessage* data, bool deep) const
{

	status_t myErr;

	Looper()->Lock();

	// Start by calling inherited archive
	myErr = BWindow::Archive(data, deep);

	if (myErr == B_OK) {
		// Add our class name to the archive
		data->AddString("class", "TCueSheetWindow");

		// Add our member variables to the archive

		// Add attached views
		if (deep) {
			//	Archive StageWindow
			BMessage stageArchive;
			fStageWindow->Archive(&stageArchive, true);
			data->AddMessage("StageWindow", &stageArchive);

		}
	}


	Looper()->Unlock();

	return myErr;
}
Пример #12
0
void FSPanel::CheckCB()
{
	F83_RB->SetEnabled(GetISO9660());
	F31_RB->SetEnabled(GetISO9660());
	F37_RB->SetEnabled(GetISO9660());

	Joliet_CB->SetEnabled(GetISO9660());
	RockRidge_CB->SetEnabled(GetISO9660());
	HFS_CB->SetEnabled(GetISO9660());
	mappingCB->SetEnabled((HFS_CB->Value() == B_CONTROL_ON) && (HFS_CB->IsEnabled()));

	Looper()->PostMessage(JOLIET_CB_MSG, this);
	Looper()->PostMessage(ROCKRIDGE_CB_MSG, this);
	Looper()->PostMessage(MAPPING_CB_MSG, this);

	if (UDF_CB->IsEnabled()) {
		UDFDef_RB->SetEnabled(GetUDF());
		UDFDVD_RB->SetEnabled(GetUDF());
	} else {
		UDFDef_RB->SetEnabled(false);
		UDFDVD_RB->SetEnabled(false);
	}

	if (ISO9660_CB->Value() == B_CONTROL_OFF && UDF_CB->Value() == B_CONTROL_OFF &&
		BFS_CB->Value() == B_CONTROL_OFF) {

		BFS_CB->SetValue(B_CONTROL_ON);
		CheckCB();
	}
}
Пример #13
0
void
ClipView::KeyDown(const char* bytes, int32 numBytes)
{
	switch (bytes[0]) {
		case B_DELETE:
		{
			ClipItem* currentClip
				= dynamic_cast<ClipItem *>(ItemAt(CurrentSelection()));
			BMessage message(DELETE);
			message.AddPointer("clip", currentClip);
			Looper()->PostMessage(&message);
			break;
		}
		case B_LEFT_ARROW:
		case B_RIGHT_ARROW:
		{
			BMessage message(SWITCHLIST);
			message.AddInt32("listview", (int32)0);
			Looper()->PostMessage(&message);
			break;
		}
		default:
		{
			BListView::KeyDown(bytes, numBytes);
			break;
		}
	}
}
Пример #14
0
status_t VBoxClipboardService::_ServiceThread()
{
    printf("VBoxClipboardService::%s()\n", __FUNCTION__);

    /* The thread waits for incoming messages from the host. */
    for (;;)
    {
        uint32_t u32Msg;
        uint32_t u32Formats;
        int rc = VbglR3ClipboardGetHostMsg(fClientId, &u32Msg, &u32Formats);
        if (RT_SUCCESS(rc))
        {
            switch (u32Msg)
            {
                case VBOX_SHARED_CLIPBOARD_HOST_MSG_FORMATS:
                {
                    /*
                     * The host has announced available clipboard formats. Forward
                     * the information to the handler.
                     */
                    LogRelFlowFunc(("VBOX_SHARED_CLIPBOARD_HOST_MSG_FORMATS u32Formats=%x\n", u32Formats));
                    BMessage msg(VBOX_GUEST_CLIPBOARD_HOST_MSG_FORMATS);
                    msg.AddInt32("Formats", (uint32)u32Formats);
                    Looper()->PostMessage(&msg, this);
                    break;
                }

                case VBOX_SHARED_CLIPBOARD_HOST_MSG_READ_DATA:
                {
                    /* The host needs data in the specified format. */
                    LogRelFlowFunc(("VBOX_SHARED_CLIPBOARD_HOST_MSG_READ_DATA u32Formats=%x\n", u32Formats));
                    BMessage msg(VBOX_GUEST_CLIPBOARD_HOST_MSG_READ_DATA);
                    msg.AddInt32("Formats", (uint32)u32Formats);
                    Looper()->PostMessage(&msg, this);
                    break;
                }

                case VBOX_SHARED_CLIPBOARD_HOST_MSG_QUIT:
                {
                    /* The host is terminating. */
                    LogRelFlowFunc(("VBOX_SHARED_CLIPBOARD_HOST_MSG_QUIT\n"));
                    fExiting = true;
                    return VERR_INTERRUPTED;
                }

                default:
                    Log(("VBoxClipboardService::%s: Unsupported message from host! Message = %u\n", __FUNCTION__, u32Msg));
            }
        }
        else
            fExiting = true;

        LogRelFlow(("processed host event rc = %d\n", rc));

        if (fExiting)
            break;
    }
    return 0;
}
void TTextControlComponent::MouseDown(BPoint point)
{
	if (Looper()->Lock())
	{
		MouseDownComponent("Component",DRAG_COMPONENT,this,point);
		Looper()->Unlock();
	}
}
void TRadioButtonComponent::MouseDown(BPoint point)
{
	if (Looper()->Lock())
	{
		MouseDownComponent("Component",DRAG_COMPONENT,this,point);
		Looper()->Unlock();
	}
}
Пример #17
0
void TMediaTabView::MessageReceived(BMessage* message)
{
	// Check for messages to switch the view
	bool buttonMsg = false;
	EChildID newView;
	switch (message->what)
	{
	case MEDIA_TAB_LIST_VIEW_MSG:
		newView = kElementsView;
		buttonMsg = true;
		break;
	case MEDIA_TAB_THUMBNAIL_VIEW_MSG:
		newView = kThumbnailView;
		buttonMsg = true;
		break;
	case MEDIA_TAB_ICON_VIEW_MSG:
		newView = kIconView;
		buttonMsg = true;
		break;
	}
	if (buttonMsg) {
		if (newView != fCurrentView) {
			// Protect this section of code.
			Looper()->Lock();

			DeactivateView(fCurrentView);
			fCurrentView = newView;
			ActivateView(fCurrentView);

			Looper()->Unlock();
		}

		return;
	}

	// Accept messages from the sorter object
	switch (message->what)
	{
	case SORTER_SELECT_MSG:
	case SORTER_INVOKE_MSG:
		if (fCurrentView == kElementsView)
			ChildAt(fCurrentView)->MessageReceived(message);
		return;

	// Some cue is adding an entry_ref to our browser
	// TODO: include the other two views in this. They can
	// have a new REF as well.
	case ADD_REF_MSG:
		if (fCurrentView == kElementsView)
			ChildAt(fCurrentView)->MessageReceived(message);
		return;
	}

	// Default handler
	BView::MessageReceived(message);
}
Пример #18
0
status_t ArpConfigureFile::StopWatcher(void)
{
    ArpD(cdb << ADH << "Stopping watcher..." << endl);
    status_t err = B_NO_ERROR;
    if( mNode != node_ref() ) {
        err = watch_node(&mNode, B_STOP_WATCHING, this);
    }
    if( Looper() ) Looper()->RemoveHandler(this);

    return err;
}
void
MediaReplicant::MouseDown(BPoint point)
{
	int32 buttons = B_PRIMARY_MOUSE_BUTTON;
	if (Looper() != NULL && Looper()->CurrentMessage() != NULL)
		Looper()->CurrentMessage()->FindInt32("buttons", &buttons);

	BPoint where = ConvertToScreen(point);

	if ((buttons & B_SECONDARY_MOUSE_BUTTON) != 0) {
		BPopUpMenu* menu = new BPopUpMenu("", false, false);
		menu->SetFont(be_plain_font);

		menu->AddItem(new BMenuItem(
			B_TRANSLATE("Media preferences" B_UTF8_ELLIPSIS),
			new BMessage(kMsgOpenMediaSettings)));
		menu->AddItem(new BMenuItem(
			B_TRANSLATE("Sound preferences" B_UTF8_ELLIPSIS),
			new BMessage(kMsgOpenSoundSettings)));

		menu->AddSeparatorItem();

		menu->AddItem(new BMenuItem(B_TRANSLATE("Open MediaPlayer"),
			new BMessage(kMsgOpenMediaPlayer)));

		menu->AddSeparatorItem();

		BMenu* subMenu = new BMenu(B_TRANSLATE("Options"));
		menu->AddItem(subMenu);

		BMenuItem* item = new BMenuItem(B_TRANSLATE("Control physical output"),
			new BMessage(kMsgVolumeWhich));
		item->SetMarked(fVolumeWhich == VOLUME_USE_PHYS_OUTPUT);
		subMenu->AddItem(item);

		item = new BMenuItem(B_TRANSLATE("Beep"),
			new BMessage(kMsgToggleBeep));
		item->SetMarked(!fDontBeep);
		subMenu->AddItem(item);

		menu->SetTargetForItems(this);
		subMenu->SetTargetForItems(this);

		menu->Go(where, true, true, BRect(where - BPoint(4, 4),
			where + BPoint(4, 4)));
	} else {
		// Show VolumeWindow
		fVolumeSlider = new VolumeWindow(BRect(where.x, where.y,
			where.x + 207, where.y + 19), fDontBeep, fVolumeWhich);
		fVolumeSlider->Show();
	}
}
void TScrollViewComponent::MouseDown(BPoint point)
{
	printf("TScrollViewComponent::MouseDown X: %f Y: %f\n",point.x,point.y);

	if (Looper()->Lock())
	{
		MouseDownComponent("Component",DRAG_COMPONENT,this,point);	
		Looper()->Unlock();
	}
	//BPoint truc(0,0);
	FrameMoved(point);		
	
}
Пример #21
0
void
KeyboardLayoutView::MouseDown(BPoint point)
{
	fClickPoint = point;
	fDragKey = NULL;
	fDropPoint.x = -1;

	Key* key = _KeyAt(point);
	if (key == NULL)
		return;

	int32 buttons = 0;
	if (Looper() != NULL && Looper()->CurrentMessage() != NULL)
		Looper()->CurrentMessage()->FindInt32("buttons", &buttons);

	if ((buttons & B_TERTIARY_MOUSE_BUTTON) != 0
		&& (fButtons & B_TERTIARY_MOUSE_BUTTON) == 0) {
		// toggle the "deadness" of dead keys via middle mouse button
		if (fKeymap != NULL) {
			bool isEnabled = false;
			uint8 deadKey
				= fKeymap->DeadKey(key->code, fModifiers, &isEnabled);
			if (deadKey > 0) {
				fKeymap->SetDeadKeyEnabled(key->code, fModifiers, !isEnabled);
				_InvalidateKey(key);
			}
		}
	} else {
		if (fKeymap != NULL && fKeymap->IsModifierKey(key->code)) {
			if (_KeyState(key->code)) {
				uint32 modifier = fKeymap->Modifier(key->code);
				if ((modifier & modifiers()) == 0) {
					_SetKeyState(key->code, false);
					fModifiers &= ~modifier;
					Invalidate();
				}
			} else {
				_SetKeyState(key->code, true);
				fModifiers |= fKeymap->Modifier(key->code);
				Invalidate();
			}

			// TODO: if possible, we could handle the lock keys for real
		} else {
			_SetKeyState(key->code, true);
			_InvalidateKey(key);
		}
	}

	fButtons = buttons;
}
/*!	\brief		Get the view color, register the handler, update targets of children.
 */
void		EventEditor_ReminderView::AttachedToWindow()
{
	if ( this->Parent() ) {
		this->SetViewColor( Parent()->ViewColor() );
	}
	
	if ( Looper() && Looper()->Lock() ) {
		Looper()->AddHandler( this );
		Looper()->Unlock();
	}
	
	fReminderEnabler->SetTarget( this );
	fHourMinControl->SetTarget( this );
	
}	// <-- end of function EventEditor_ReminderView::AttachedToWindow
Пример #23
0
void
ClipView::_ShowPopUpMenu(BPoint screen)
{
	if (fShowingPopUpMenu)
		return;

	ContextPopUp* menu = new ContextPopUp("PopUpMenu", this);
	ClipItem* currentClip = dynamic_cast<ClipItem *>(ItemAt(CurrentSelection()));
	BMessage* msg = NULL;

	msg = new BMessage(PASTE_SPRUNGE);
	msg->AddPointer("clip", currentClip);
	BMenuItem* item = new BMenuItem(B_TRANSLATE("Paste to Sprunge.us"), msg, 'P');
	menu->AddItem(item);

	msg = new BMessage(FAV_ADD);
	msg->AddPointer("clip", currentClip);
	item = new BMenuItem(B_TRANSLATE("Add to favorites"), msg, 'A');
	menu->AddItem(item);

	msg = new BMessage(DELETE);
	msg->AddPointer("clip", currentClip);
	item = new BMenuItem(B_TRANSLATE("Remove"), msg);
	menu->AddItem(item);

	menu->SetTargetForItems(Looper());
	menu->Go(screen, true, true, true);
	fShowingPopUpMenu = true;
}
Пример #24
0
/*******************************************************
*   Our wonderful BWindow, ya its kewl like that.
*   we dont do much here but set up the menubar and 
*   let the view take over.  We also nead some message
*   redirection and handling
*******************************************************/
ToolTipWindow::ToolTipWindow() : BWindow(BRect(0,0,100,19),"Tool Tip",
      B_NO_BORDER_WINDOW_LOOK,
      B_FLOATING_ALL_WINDOW_FEEL,
      B_ASYNCHRONOUS_CONTROLS|B_NOT_RESIZABLE|B_AVOID_FRONT|B_AVOID_FOCUS){
   
   Looper()->SetName(TOOL_TIP_WINDOW);
   
   BView *v = new BView(Bounds(),"",B_FOLLOW_ALL,0);
   v->SetViewColor(255,255,120);
   AddChild(v);
   
   BRect b = v->Bounds();
   b.Set(b.left-1,b.top-1,b.right+1,b.bottom+1);
   BBox *bb = new BBox(b,"",B_FOLLOW_ALL);
   v->AddChild(bb);
   
   b = bb->Frame();
   b.InsetBy(1,1);
   b.left = 4;
   b.bottom --;
   tipv = new BStringView(b,"","...",B_FOLLOW_ALL);
   tipv->SetAlignment(B_ALIGN_CENTER);
   bb->AddChild(tipv);
   
   Run();
}
Пример #25
0
void
NetPrefsServerView::RemoveServer ()
{
  BAutolock lock (Looper ());

  if (!lock.IsLocked ())
    return;

  BRow *row (fServerList->CurrentSelection ());
  if (row)
  {
    BStringField *field ((BStringField *) row->GetField (1));

    int32 count;
    ssize_t size;
    type_code type;
    fActiveNetwork->GetInfo ("server", &type, &count);

    const ServerData *data;
    for (int32 i = 0; i < count; i++)
    {
      fActiveNetwork->FindData ("server", B_ANY_TYPE, i, reinterpret_cast < const void **>(&data),
        &size);

      if (!strcmp (data->serverName, field->String ()))
      {
        fActiveNetwork->RemoveData ("server", i);
        break;
      }
	}
    fServerList->RemoveRow (row);
    delete row;
  }
}
Пример #26
0
void
NetPrefsServerView::AddServer (const ServerData * data)
{
  BAutolock lock (Looper ());
  if (!lock.IsLocked ())
    return;

  BRow *row (new BRow);
  switch (data->state)
    {
      case SERVER_PRIMARY:
        row->SetField (new BStringField ("*"), 0);
        break;

      case SERVER_SECONDARY:
        row->SetField (new BStringField ("+"), 0);
        break;

      case SERVER_DISABLED:
        row->SetField (new BStringField ("-"), 0);
        break;
    }
  BString server ("");
  server = data->serverName;
  BStringField *serverField (new BStringField (server.String ()));
  row->SetField (serverField, 1);
  server = "";
  server << data->port;
  BStringField *portField (new BStringField (server.String ()));
  row->SetField (portField, 2);
  fServerList->AddRow (row);
}
Пример #27
0
		void	Looper(uint32_t key, mori::ErrCode ec)
		{
			if ( AsyncThreadPool_->IsStop() )
			{
				return;
			}

			TimerMap::iterator itor;
			{
				std::lock_guard<std::mutex> lock(TimerMutex_);
				itor = TimerMap_.find(key);
				if ( itor == TimerMap_.end() )
				{
					return;
				}
			}

			auto& info = itor->second;

			info.Ftr_(ec);
			info.TimerPtr_->expires_from_now(info.Tick_);
			info.TimerPtr_->async_wait([this,key](mori::ErrCode ec)
			{
				Looper(key, ec);
			});
		}
Пример #28
0
void MyView::MouseDown(BPoint where)
{
	SetMouseEventMask(B_POINTER_EVENTS, B_LOCK_WINDOW_FOCUS);
	int32		buttons;
	Looper()->CurrentMessage()->FindInt32("buttons", &buttons);
	fLastPos = where;
	if (buttons == B_PRIMARY_MOUSE_BUTTON)
	{
		fTracking = true;
		fMovingLayer = FindLayer(topLayer, where);
		if (fMovingLayer == topLayer)
			fMovingLayer = NULL;
		if (fMovingLayer)
		{
			BRect	bounds(fMovingLayer->Bounds());
			fMovingLayer->ConvertToScreen2(&bounds);
			BRect	resizeRect(bounds.right-10, bounds.bottom-10, bounds.right, bounds.bottom);
			if (resizeRect.Contains(where))
				fIsResize = true;
			else
				fIsResize = false;
		}
	}
	else if (buttons == B_SECONDARY_MOUSE_BUTTON)
	{
		fIs2ndButton = true;
	}
	else if (buttons == B_TERTIARY_MOUSE_BUTTON)
	{
		DrawSubTree(topLayer);
	}
}
Пример #29
0
void
MemoryView::MouseDown(BPoint point)
{
	if (!IsFocus())
		MakeFocus(true);

	if (fTargetBlock == NULL)
		return;

	int32 buttons;
	if (Looper()->CurrentMessage()->FindInt32("buttons", &buttons) != B_OK)
		buttons = B_PRIMARY_MOUSE_BUTTON;

	if (buttons == B_SECONDARY_MOUSE_BUTTON) {
		_HandleContextMenu(point);
		return;
	}

	int32 offset = _GetOffsetAt(point);
	if (offset < fSelectionStart || offset > fSelectionEnd) {
		BRegion oldSelectionRegion;
		_GetSelectionRegion(oldSelectionRegion);
		fSelectionBase = offset;
		fSelectionStart = fSelectionBase;
		fSelectionEnd = fSelectionBase;
		Invalidate(oldSelectionRegion.Frame());
	}

	SetMouseEventMask(B_POINTER_EVENTS, B_NO_POINTER_HISTORY);
	fTrackingMouse = true;
}
Пример #30
0
void PanelView::InvertSelection(void)
////////////////////////////////////////////////////////////////////////
{
	if (m_PanelMode==PM_DISKS) return;

	int n = m_CustomListView->CountItems();

	// We have to clear the selection message to avoid message queue from overrun...
	m_CustomListView->SetSelectionMessage(NULL);

	for (int i=0;i<n;i++)
	{
		switch(m_CustomListView->IsItemSelected(i))
		{
			case true:
				m_CustomListView->Deselect(i);
				break;
			case false:
				m_CustomListView->Select(i,true);
				break;
		}
	}

	// Let's set again the selection message,
	m_CustomListView->SetSelectionMessage(new BMessage(MSG_FILELISTVIEW_SELECTION));
	// and generate a selection changed message...
	Looper()->PostMessage(new BMessage(MSG_FILELISTVIEW_SELECTION), NULL);
}