summaryrefslogtreecommitdiff
path: root/widgetbutton.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'widgetbutton.cpp')
-rw-r--r--widgetbutton.cpp104
1 files changed, 104 insertions, 0 deletions
diff --git a/widgetbutton.cpp b/widgetbutton.cpp
new file mode 100644
index 0000000..04ae462
--- /dev/null
+++ b/widgetbutton.cpp
@@ -0,0 +1,104 @@
+#include <skygi/skygi.h>
+
+#include "widgetbutton.h"
+
+CButton::CButton() {
+ Icon = NULL;
+ Foreground = NULL;
+ Background = NULL;
+ BackgroundBlit = NULL;
+ PressedDIB = NULL;
+ TextColor = 0;
+}
+
+HRESULT CButton::Create(HANDLE parent, char * text, int x, int y, int width, int height, int style, unsigned int ID) {
+ this->hWnd = GI_WidgetButtonCreate(parent, text, x, y, width, height, style, ID);
+ this->SetText(text);
+ if (this->hWnd) {
+ return S_OK;
+ }
+ return E_HANDLE;
+}
+
+HRESULT CButton::Enable() {
+ return GI_WidgetButtonEnable(this->hWnd);
+}
+
+HRESULT CButton::Disable() {
+ return GI_WidgetButtonDisable(this->hWnd);
+}
+
+HRESULT CButton::OwnerDraw(char bOwnerDraw, void * pCookie) {
+ return GI_WidgetButtonOwnerDraw(this->hWnd, bOwnerDraw, pCookie);
+}
+
+HRESULT CButton::SetText(char * text) {
+ strncpy(this->Text, text, strlen(this->Text));
+ return GI_WidgetButtonSet(this->hWnd, text);
+}
+
+char * CButton::GetText() {
+ return this->Text;
+}
+
+HRESULT CButton::SetBackground(DIB * dib) {
+ this->Background = dib;
+ return GI_WidgetButtonSetBackground(this->hWnd, dib);
+}
+
+DIB * CButton::GetBackground() {
+ return this->Background;
+}
+
+HRESULT CButton::SetBackgroundBlit(int bPressed, sBlit * pBlit) {
+ this->BackgroundBlit = pBlit;
+ return GI_WidgetButtonSetBackgroundBlit(this->hWnd, bPressed, pBlit);
+}
+
+sBlit * CButton::GetBackgroundBlit() {
+ return this->BackgroundBlit;
+}
+
+HRESULT CButton::SetForeground(DIB * dib) {
+ this->Foreground = dib;
+ return GI_WidgetButtonSetDIB(this->hWnd, dib);
+}
+
+DIB * CButton::GetForeground() {
+ return this->Foreground;
+}
+
+HRESULT CButton::SetIcon(s_gi_icon * icon) {
+ this->Icon = icon;
+ return GI_WidgetButtonSetIcon(this->hWnd, icon);
+}
+
+s_gi_icon * CButton::GetIcon() {
+ return this->Icon;
+}
+
+HRESULT CButton::SetPressedDIB(DIB * dib) {
+ this->PressedDIB = dib;
+ return GI_WidgetButtonSetPressedDIB(this->hWnd, dib);
+}
+
+DIB * CButton::GetPressedDIB() {
+ return this->PressedDIB;
+}
+
+HRESULT CButton::SetStyle(unsigned int flags) {
+ return GI_WidgetButtonSetStyle(this->hWnd, flags);
+}
+
+HRESULT CButton::SetTextColor(COLOR color) {
+ this->TextColor = color;
+ return GI_WidgetButtonSetTextColor(this->hWnd, color);
+}
+
+COLOR CButton::GetTextColor() {
+ return this->TextColor;
+}
+
+HRESULT CButton::UseParentBackground(char use) {
+ return GI_WidgetButtonUseParentBackground(this->hWnd, use);
+}