mirror of
https://github.com/AquaMorph/Droplets.git
synced 2025-04-30 01:35:34 +00:00
Menu item data structure
This commit is contained in:
parent
39bf2f940f
commit
ab58175b6f
@ -4,6 +4,7 @@
|
|||||||
#define CASCADE_MENU_H_
|
#define CASCADE_MENU_H_
|
||||||
|
|
||||||
#include "daisy_patch.h"
|
#include "daisy_patch.h"
|
||||||
|
#include "menu_item.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "droplets/droplet_manager.h"
|
#include "droplets/droplet_manager.h"
|
||||||
|
|
||||||
@ -11,8 +12,6 @@
|
|||||||
|
|
||||||
using namespace daisy;
|
using namespace daisy;
|
||||||
|
|
||||||
enum class MenuState {kSplit, kChange, kVCO, kNoise};
|
|
||||||
|
|
||||||
class Menu {
|
class Menu {
|
||||||
private:
|
private:
|
||||||
DaisyPatch* patch;
|
DaisyPatch* patch;
|
||||||
|
63
src/menu_item.cpp
Normal file
63
src/menu_item.cpp
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
#include "menu_item.h"
|
||||||
|
|
||||||
|
MenuItem::MenuItem(MenuState m_state, char* m_title) {
|
||||||
|
state = m_state;
|
||||||
|
this->SetTitle(m_title);
|
||||||
|
visible = true;
|
||||||
|
previous = NULL;
|
||||||
|
next = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
char* MenuItem::GetTitle() {
|
||||||
|
return title;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MenuItem::SetTitle(char* m_title) {
|
||||||
|
title = m_title;
|
||||||
|
}
|
||||||
|
|
||||||
|
MenuItem* MenuItem::GetPrevious() {
|
||||||
|
return previous;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MenuItem::SetPrevious(MenuItem* item) {
|
||||||
|
previous = item;
|
||||||
|
}
|
||||||
|
|
||||||
|
MenuItem* MenuItem::GetNext() {
|
||||||
|
return next;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MenuItem::SetNext(MenuItem* item) {
|
||||||
|
next = item;
|
||||||
|
}
|
||||||
|
|
||||||
|
MenuItem* MenuItem::GetPreviousVisible() {
|
||||||
|
if (this->GetPrevious() == NULL ||
|
||||||
|
this->GetPrevious()->IsVisible()) {
|
||||||
|
return this->GetPrevious();
|
||||||
|
} else {
|
||||||
|
return this->GetPrevious()->GetPreviousVisible();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
MenuItem* MenuItem::GetNextVisible() {
|
||||||
|
if (this->GetNext() == NULL ||
|
||||||
|
this->GetNext()->IsVisible()) {
|
||||||
|
return this->GetNext();
|
||||||
|
} else {
|
||||||
|
return this->GetNext()->GetNextVisible();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool MenuItem::IsVisible() {
|
||||||
|
return visible;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MenuItem::SetVisibility(bool m_visible) {
|
||||||
|
visible = m_visible;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MenuItem::ToggleVisibility() {
|
||||||
|
visible = !visible;
|
||||||
|
}
|
93
src/menu_item.h
Normal file
93
src/menu_item.h
Normal file
@ -0,0 +1,93 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#ifndef CASCADE_MENU_ITEM_H_
|
||||||
|
#define CASCADE_MENU_ITEM_H_
|
||||||
|
|
||||||
|
enum class MenuState {kSplit, kChange, kVCO, kNoise};
|
||||||
|
|
||||||
|
class MenuItem {
|
||||||
|
private:
|
||||||
|
MenuState state;
|
||||||
|
char* title;
|
||||||
|
bool visible;
|
||||||
|
MenuItem* previous;
|
||||||
|
MenuItem* next;
|
||||||
|
public:
|
||||||
|
MenuItem(MenuState m_state, char* m_title);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Returns the title of the menu item.
|
||||||
|
*
|
||||||
|
* @return menu item title
|
||||||
|
*/
|
||||||
|
char* GetTitle();
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Sets the title for a munu item.
|
||||||
|
*
|
||||||
|
* @param menu title
|
||||||
|
*/
|
||||||
|
void SetTitle(char* m_title);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Returns the previous menu item.
|
||||||
|
*
|
||||||
|
* @return prvious menu item
|
||||||
|
*/
|
||||||
|
MenuItem* GetPrevious();
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Sets the previous menu item.
|
||||||
|
*
|
||||||
|
* @param previous menu item
|
||||||
|
*/
|
||||||
|
void SetPrevious(MenuItem* item);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Returns the next menu item.
|
||||||
|
*
|
||||||
|
* @return next menu item
|
||||||
|
*/
|
||||||
|
MenuItem* GetNext();
|
||||||
|
/*
|
||||||
|
* Sets the next menu item,
|
||||||
|
*
|
||||||
|
* @param next menu item
|
||||||
|
*/
|
||||||
|
void SetNext(MenuItem* item);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Returns the previous visible menu item.
|
||||||
|
*
|
||||||
|
* @return previous visible munu item
|
||||||
|
*/
|
||||||
|
MenuItem* GetPreviousVisible();
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Returns the next visible menu item.
|
||||||
|
*
|
||||||
|
* @return next visible menu item
|
||||||
|
*/
|
||||||
|
MenuItem* GetNextVisible();
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Returns if the menu item is visible.
|
||||||
|
*
|
||||||
|
* @return visibility
|
||||||
|
*/
|
||||||
|
bool IsVisible();
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Sets the visibility of the menu item.
|
||||||
|
*
|
||||||
|
* @param visibility state
|
||||||
|
*/
|
||||||
|
void SetVisibility(bool m_visible);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Toggles visibility of menu item.
|
||||||
|
*/
|
||||||
|
void ToggleVisibility();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // CASCADE_MENU_ITEM_H_
|
Loading…
x
Reference in New Issue
Block a user