|
|
@ -29,6 +29,7 @@ ProgramListBox::ProgramListBox(const String name, int numCols) : Component(name) |
|
|
|
selectedPgm = -1; |
|
|
|
selectedPgm = -1; |
|
|
|
hasContent = false; |
|
|
|
hasContent = false; |
|
|
|
dragCandidate = -1; |
|
|
|
dragCandidate = -1; |
|
|
|
|
|
|
|
pgmCandidate = -1; |
|
|
|
readOnly = false; |
|
|
|
readOnly = false; |
|
|
|
programNames.clear(); |
|
|
|
programNames.clear(); |
|
|
|
} |
|
|
|
} |
|
|
@ -101,29 +102,36 @@ int ProgramListBox::programPosition(int x, int y) { |
|
|
|
return (y / cellHeight) + ((x / cellWidth) * rows); |
|
|
|
return (y / cellHeight) + ((x / cellWidth) * rows); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void ProgramListBox::mouseDoubleClick(const MouseEvent &event) { |
|
|
|
void ProgramListBox::mouseDown(const MouseEvent &event) { |
|
|
|
|
|
|
|
pgmCandidate = -1; |
|
|
|
|
|
|
|
|
|
|
|
if ( ! hasContent ) |
|
|
|
if ( ! hasContent ) |
|
|
|
return; |
|
|
|
return; |
|
|
|
if ( ! event.mods.isLeftButtonDown() ) |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int pos = programPosition(event.getMouseDownX(), event.getMouseDownY()); |
|
|
|
if ( event.mods.isRightButtonDown() ) { |
|
|
|
if ( listener != nullptr ) |
|
|
|
int pos = programPosition(event.getMouseDownX(), event.getMouseDownY()); |
|
|
|
listener->programSelected(this, pos); |
|
|
|
if ( listener != nullptr ) |
|
|
|
|
|
|
|
listener->programRightClicked(this, pos); |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pgmCandidate = programPosition(event.getMouseDownX(), event.getMouseDownY()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void ProgramListBox::mouseDown(const MouseEvent &event) { |
|
|
|
void ProgramListBox::mouseUp(const MouseEvent &event) { |
|
|
|
if ( ! hasContent ) |
|
|
|
if ( pgmCandidate == -1 ) |
|
|
|
return; |
|
|
|
|
|
|
|
if ( ! event.mods.isRightButtonDown() ) |
|
|
|
|
|
|
|
return; |
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
int pos = programPosition(event.getMouseDownX(), event.getMouseDownY()); |
|
|
|
int pos = programPosition(event.getMouseDownX(), event.getMouseDownY()); |
|
|
|
if ( listener != nullptr ) |
|
|
|
if ( pgmCandidate == pos) { |
|
|
|
listener->programRightClicked(this, pos); |
|
|
|
if ( listener != nullptr ) |
|
|
|
|
|
|
|
listener->programSelected(this, pgmCandidate); |
|
|
|
|
|
|
|
pgmCandidate = -1; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void ProgramListBox::mouseDrag(const MouseEvent &event) { |
|
|
|
void ProgramListBox::mouseDrag(const MouseEvent &event) { |
|
|
|
|
|
|
|
pgmCandidate = -1; |
|
|
|
if ( ! hasContent ) |
|
|
|
if ( ! hasContent ) |
|
|
|
return; |
|
|
|
return; |
|
|
|
if ( dragCandidate != -1 ) |
|
|
|
if ( dragCandidate != -1 ) |
|
|
|