summaryrefslogtreecommitdiffstats
path: root/matchblox/menu/button.c
diff options
context:
space:
mode:
Diffstat (limited to 'matchblox/menu/button.c')
-rw-r--r--matchblox/menu/button.c27
1 files changed, 26 insertions, 1 deletions
diff --git a/matchblox/menu/button.c b/matchblox/menu/button.c
index 36d1b90..c38bbfe 100644
--- a/matchblox/menu/button.c
+++ b/matchblox/menu/button.c
@@ -19,7 +19,7 @@
#include "font.h"
-struct ButtonStruct ButtonCreate(int f_iXPos, int f_iYPos, int f_iWidth, int f_iHeight, char *f_pcTitle, int f_iType, int f_iGroup, int f_iId)
+struct ButtonStruct ButtonCreate(int f_iXPos, int f_iYPos, int f_iWidth, int f_iHeight, char *f_pcTitle, int f_iType, int f_iGroup, int f_iId, void (*f_fpFunc)(void))
{
struct ButtonStruct l_sButton;
@@ -31,6 +31,7 @@ struct ButtonStruct ButtonCreate(int f_iXPos, int f_iYPos, int f_iWidth, int f_i
l_sButton.m_iWidth = f_iWidth;
l_sButton.m_iGroup = f_iGroup;
l_sButton.m_iId = f_iId;
+ l_sButton.m_fpFunc = f_fpFunc;
// copy title
memset(&l_sButton.m_pcTitle, 0, sizeof(l_sButton.m_pcTitle));
@@ -212,6 +213,18 @@ void ButtonRadioRender(struct ButtonStruct *f_sButton)
} // ButtonRadioRender
+void ButtonLabelRender(struct ButtonStruct *f_sButton)
+{
+ struct ColorStruct l_sColor = {0, 0, 0}; //{0.2, 0.4, 0.8};
+
+ glPrint(f_sButton->m_iXPos,
+ f_sButton->m_iYPos,
+ f_sButton->m_pcTitle,
+ l_sColor);
+
+} // ButtonLabelRender
+
+
void ButtonRender(struct ButtonStruct *f_sButton)
{
int l_iType = f_sButton->m_iType;
@@ -226,6 +239,10 @@ void ButtonRender(struct ButtonStruct *f_sButton)
ButtonRadioRender(f_sButton);
break;
+ case BUTTON_LABEL:
+ ButtonLabelRender(f_sButton);
+ break;
+
default:
break;
}
@@ -326,3 +343,11 @@ void ButtonDisable(struct ButtonStruct *f_sButton)
f_sButton->m_bPressed = FALSE;
} // ButtonDisable
+
+void ButtonExecute(struct ButtonStruct *f_sButton)
+{
+ if (f_sButton->m_fpFunc)
+ {
+ f_sButton->m_fpFunc();
+ }
+} // ButtonExecute \ No newline at end of file