Skip to content

Commit

Permalink
Move refresh button to the titlebar
Browse files Browse the repository at this point in the history
  • Loading branch information
anjaldoshi committed Sep 6, 2024
1 parent 342ad7b commit a549ee2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
13 changes: 9 additions & 4 deletions Source/NeuropixEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ RefreshButton::RefreshButton() : Button ("Refresh")

void RefreshButton::paintButton(Graphics& g, bool isMouseOver, bool isButtonDown)
{
Colour buttonColour = findColour (ThemeColours::defaultText);
Colour buttonColour = Colours::darkgrey;

if (isMouseOver)
buttonColour = buttonColour.brighter (0.4f);
if (isMouseOver && isEnabled())
buttonColour = Colours::white;

refreshIcon->replaceColour (Colours::black, buttonColour);

Expand All @@ -55,6 +55,11 @@ void RefreshButton::paintButton(Graphics& g, bool isMouseOver, bool isButtonDown
refreshIcon->replaceColour (buttonColour, Colours::black);
}

void RefreshButton::parentSizeChanged()
{
setBounds (getParentWidth() - 65, 4, 16, 16);
}

SlotButton::SlotButton (Basestation* bs, NeuropixThread* thread_) : Button (String (bs->slot))
{
isEnabled = true;
Expand Down Expand Up @@ -600,7 +605,7 @@ NeuropixEditor::NeuropixEditor (GenericProcessor* parentNode, NeuropixThread* t)
addChildComponent (addSyncChannelButton.get());

refreshButton = std::make_unique<RefreshButton> ();
refreshButton->setBounds (90 * basestations.size() + 100, 102, 20, 20);
refreshButton->setBounds (desiredWidth - 65, 4, 16, 16);
refreshButton->addListener (this);
refreshButton->setTooltip ("Re-scan basestation for hardware changes.");
addChildComponent (refreshButton.get());
Expand Down
3 changes: 3 additions & 0 deletions Source/NeuropixEditor.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ class RefreshButton : public Button

void paintButton (Graphics& g, bool isMouseOver, bool isButtonDown) override;

/** Sets the button bounds when editor is resized */
void parentSizeChanged() override;

private:

std::unique_ptr<Drawable> refreshIcon;
Expand Down

0 comments on commit a549ee2

Please sign in to comment.