diff options
author | Wilrik de Loose <wilrik@wilrik.nl> | 2008-05-27 14:20:29 (GMT) |
---|---|---|
committer | Wilrik de Loose <wilrik@wilrik.nl> | 2008-05-27 14:20:29 (GMT) |
commit | 47dcce1ed989159bbe0fc2a98ebeda4f5dc99772 (patch) | |
tree | e4574377e8fcbe866955015fdcb133f3e50d2bf8 /matchblox/menu/button.c | |
parent | c089caac3e3c87e2489982ec21c6f2dfec1bd8ed (diff) | |
download | 2iv55-47dcce1ed989159bbe0fc2a98ebeda4f5dc99772.zip 2iv55-47dcce1ed989159bbe0fc2a98ebeda4f5dc99772.tar.gz 2iv55-47dcce1ed989159bbe0fc2a98ebeda4f5dc99772.tar.bz2 |
menu + button afhandeling
Diffstat (limited to 'matchblox/menu/button.c')
-rw-r--r-- | matchblox/menu/button.c | 27 |
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 |