Exemplo n.º 1
0
boolean StringBrowser::LeftButtonDown (Event& e) {
    boolean status = false;

    if (DoubleClicked(e)) {
        subject->SetValue(done[0]);
        status = true;

    } else if (uniqueSel) {
        if (Selections() == 0) {
            Select(Locate(e.x, e.y));
        } else {
            Unselect(Selection());
            if (!e.shift) {
                Select(Locate(e.x, e.y));
            }
        }

    } else {
        lastdot = lastmark = Locate(e.x, e.y);

        if (Selected(lastdot) && e.shift) {
            Unselect(lastdot);
            do {
                ScrollToView(e.x, e.y);
                UpdateSelection(lastdot, Locate(e.x, e.y), Plain);
                Poll(e);
            } while (e.leftmouse);

        } else {
            if (!e.shift) {
                UnselectAll();
            }
            Select(lastdot);
            do {
                ScrollToView(e.x, e.y);
                UpdateSelection(lastdot, Locate(e.x, e.y), highlight);
                Poll(e);
            } while (e.leftmouse);
        }
    }
    Note(e);
    if (singleClick) {
        subject->SetValue(done[0]);
        status = true;
    }
    return status;
}
Exemplo n.º 2
0
AppLauncherPlugin::AppLauncherPlugin(QWidget* parent, QString ID) : LDPlugin(parent, ID){
  QVBoxLayout *lay = new QVBoxLayout();
  this->setLayout(lay);
    lay->setContentsMargins(0,0,0,0);
  button = new OutlineToolButton(this);
    button->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
    button->setAutoRaise(true);
    button->setText("...\n..."); //Need to set something here so that initial sizing works properly
    button->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding);
  lay->addWidget(button, 0, Qt::AlignCenter);
	connect(button, SIGNAL(DoubleClicked()), this, SLOT(buttonClicked()) );
  button->setContextMenuPolicy(Qt::NoContextMenu);
  watcher = new QFileSystemWatcher(this);
	connect(watcher, SIGNAL(fileChanged(QString)), this, SLOT( loadButton()) );

  QTimer::singleShot(200,this, SLOT(loadButton()) );
}
Exemplo n.º 3
0
// MouseDown
void
DragSortableListView::MouseDown(BPoint where)
{
	int32 clicks = 1;
	uint32 buttons = 0;
	Window()->CurrentMessage()->FindInt32("clicks", &clicks);
	Window()->CurrentMessage()->FindInt32("buttons", (int32*)&buttons);
	int32 clickedIndex = -1;
	for (int32 i = 0; BListItem* item = ItemAt(i); i++) {
		if (ItemFrame(i).Contains(where)) {
			if (clicks == 2) {
				// only do something if user clicked the same item twice
				if (fLastClickedItem == item)
					DoubleClicked(i);
			} else {
				// remember last clicked item
				fLastClickedItem = item;
			}
			clickedIndex = i;
			break;
		}
	}
	if (clickedIndex == -1)
		fLastClickedItem = NULL;

	BListItem* item = ItemAt(clickedIndex);
	if (ListType() == B_MULTIPLE_SELECTION_LIST
		&& item && (buttons & B_SECONDARY_MOUSE_BUTTON)) {
		if (item->IsSelected())
			Deselect(clickedIndex);
		else
			Select(clickedIndex, true);
	} else {
		BListView::MouseDown(where);
	}
}