From dfa4a46bb0e6c6df9d07039fda5ef7f4309915b2 Mon Sep 17 00:00:00 2001 From: Matt Turner Date: Fri, 4 Aug 2006 01:04:15 +0000 Subject: git-svn-id: svn://mattst88.com/svn/skygipp/trunk@2 a71248a0-261a-0410-b604-901f7c0bd773 --- Makefile | 19 ++++++++ skygipp.h | 14 ++++++ widget.cpp | 63 +++++++++++++++++++++++++ widget.h | 31 +++++++++++++ widgetbutton.cpp | 104 +++++++++++++++++++++++++++++++++++++++++ widgetbutton.h | 125 ++++++++++++++++++++++++++++++++++++++++++++++++++ widgetcheckbox.cpp | 32 +++++++++++++ widgetcheckbox.h | 57 +++++++++++++++++++++++ widgetform.cpp | 19 ++++++++ widgetform.h | 42 +++++++++++++++++ widgetprogressbar.cpp | 48 +++++++++++++++++++ widgetprogressbar.h | 83 +++++++++++++++++++++++++++++++++ widgetslider.cpp | 34 ++++++++++++++ widgetslider.h | 63 +++++++++++++++++++++++++ widgettextfield.cpp | 62 +++++++++++++++++++++++++ widgettextfield.h | 94 +++++++++++++++++++++++++++++++++++++ widgettitle.cpp | 25 ++++++++++ widgettitle.h | 53 +++++++++++++++++++++ widgettooltip.cpp | 47 +++++++++++++++++++ widgettooltip.h | 53 +++++++++++++++++++++ 20 files changed, 1068 insertions(+) create mode 100644 Makefile create mode 100644 skygipp.h create mode 100644 widget.cpp create mode 100644 widget.h create mode 100644 widgetbutton.cpp create mode 100644 widgetbutton.h create mode 100644 widgetcheckbox.cpp create mode 100644 widgetcheckbox.h create mode 100644 widgetform.cpp create mode 100644 widgetform.h create mode 100644 widgetprogressbar.cpp create mode 100644 widgetprogressbar.h create mode 100644 widgetslider.cpp create mode 100644 widgetslider.h create mode 100644 widgettextfield.cpp create mode 100644 widgettextfield.h create mode 100644 widgettitle.cpp create mode 100644 widgettitle.h create mode 100644 widgettooltip.cpp create mode 100644 widgettooltip.h diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..9a02f09 --- /dev/null +++ b/Makefile @@ -0,0 +1,19 @@ +CC=g++ +CPPFLAGS=-Os -pipe -fPIC +LDFLAGS=-Wl,-O1 + +OBJECTS=widget.o widgetbutton.o widgetcheckbox.o widgetform.o \ + widgettextfield.o widgetprogressbar.o widgetslider.o \ + widgettitle.o widgettooltip.o + +all: ${OBJECTS} + ${CC} ${LDFLAGS},-s -shared -o libskygi++.so ${OBJECTS} + +clean: + rm -f ${OBJECTS} + rm -f libskygi++.so + +remake: clean all + +%.o: %.cpp + ${CC} ${CPPFLAGS} ${INCLUDES} -c -o $@ $< diff --git a/skygipp.h b/skygipp.h new file mode 100644 index 0000000..cef82bc --- /dev/null +++ b/skygipp.h @@ -0,0 +1,14 @@ +#ifndef SKYGIPP_H +#define SKYGIPP_H + +#include "widget.h" +#include "widgetbutton.h" +#include "widgetcheckbox.h" +#include "widgetform.h" +#include "widgetprogressbar.h" +#include "widgetslider.h" +#include "widgettextfield.h" +#include "widgettitle.h" +#include "widgettooltip.h" + +#endif diff --git a/widget.cpp b/widget.cpp new file mode 100644 index 0000000..f75e2aa --- /dev/null +++ b/widget.cpp @@ -0,0 +1,63 @@ +#include + +#include "widget.h" + +CWidget::CWidget() { + this->hWnd = NULL; +} + +HANDLE CWidget::GetHANDLE() { + return this->hWnd; +} + +HRESULT CWidget::SetSize(int w, int h) { + return GI_ApplicationSetSize(this->hWnd, w, h); +} + +int CWidget::GetWidth() { + return GI_WindowGetWidth(this->hWnd); +} + +int CWidget::GetHeight() { + return GI_WindowGetHeight(this->hWnd); +} + +HRESULT CWidget::SetPos(int x, int y) { + return GI_WindowSetPos(this->hWnd, x, y); +} + +int CWidget::GetX() { + return GI_WindowGetX(this->hWnd); +} + +int CWidget::GetXAbsolute() { + return GI_WindowGetXAbsolute(this->hWnd); +} + +int CWidget::GetY() { + return GI_WindowGetY(this->hWnd); +} + +int CWidget::GetYAbsolute() { + return GI_WindowGetYAbsolute(this->hWnd); +} + +HRESULT CWidget::SetSizeAndPos(int x, int y, int w, int h) { + return GI_WindowSetSizeAndPos(this->hWnd, x, y, w, h); +} + +HRESULT CWidget::DimensionSetNotify(int notify, int x1, int y1, int w, int h) { + return GI_WindowDimensionSetNotify(this->hWnd, notify, x1, y1, w, h); +} + +/*HRESULT CWidget::SetParent(HANDLE hParent, int x, int y) { + return GI_WindowSetParent(this->hWnd, hParent, x, y); +}*/ + +HANDLE CWidget::GetParent() { + return GI_WindowGetParent(this->hWnd); +} + +HANDLE CWidget::GetTopLevel() { + return GI_WindowGetTopLevel(this->hWnd); +} diff --git a/widget.h b/widget.h new file mode 100644 index 0000000..9e8c3b8 --- /dev/null +++ b/widget.h @@ -0,0 +1,31 @@ +#ifndef WIDGET_H +#define WIDGET_H + +#include + +//! A general widget class + +class CWidget { + public: + CWidget(); + HANDLE GetHANDLE(); + HRESULT SetSize(int w, int h); + int GetWidth(); + int GetHeight(); + HRESULT SetPos(int x, int y); + int GetX(); + int GetXAbsolute(); + int GetY(); + int GetYAbsolute(); + HRESULT SetSizeAndPos(int x, int y, int w, int h); + HRESULT DimensionSetNotify(int notify, int x1, int y1, int w, int h); + //HRESULT SetParent(HANDLE hParent, int x, int y); + HANDLE GetParent(); + HANDLE GetTopLevel(); + HRESULT Hide(); + HRESULT Show(); + protected: + HANDLE hWnd; +}; + +#endif 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 + +#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); +} diff --git a/widgetbutton.h b/widgetbutton.h new file mode 100644 index 0000000..259c266 --- /dev/null +++ b/widgetbutton.h @@ -0,0 +1,125 @@ +#ifndef WIDGETBUTTON_H +#define WIDGETBUTTON_H + +#include + +#include "widget.h" + +//! A Button class + +class CButton: public CWidget { + public: + /*! Constructor */ + CButton(); + + /*! + Create Button + + \param parent HANDLE of the parent window on which to draw + \param name Name of the Button + \param x Top left x coordinate + \param y Top left y coordinate + \param w Form width + \param h Form height + \param style Style flags\n + WGF_NO_BORDER: Button has no border\n + WGF_BORDER_ON_MOUSE_OVER: Buttons has border on mouseover + \param ID ID sent to parent when Button is pressed (MSG_COMMAND) + + \return Success: S_OK\n + Failure: E_HANDLE + */ + HRESULT Create(HANDLE parent, char * name, int x, int y, int w, int h, int style, unsigned int ID); + + /*! + Enable Button + */ + HRESULT Enable(); + + /*! + Disable Button + */ + HRESULT Disable(); + + HRESULT OwnerDraw(char bOwnerDraw, void * pCookie); + + /*! + Change Text on Button + + \param text New text to display + */ + HRESULT SetText(char * text); + + /*! + Get Text on Button + + \return Text + */ + char * GetText(); + + /*! + Set background bitmap + + \param dib Bitmap to draw + */ + HRESULT SetBackground(DIB * dib); + + /*! + Get background bitmap + + \return Pointer to background bitmap + */ + DIB * GetBackground(); + + HRESULT SetBackgroundBlit(int bPressed, sBlit * pBlit); + sBlit * GetBackgroundBlit(); + + /*! + Set foreground bitmap + + \param dib Bitmap to draw + */ + HRESULT SetForeground(DIB * dib); + + /*! + Get foreground bitmap + + \return Pointer to foreground bitmap + */ + DIB * GetForeground(); + + + HRESULT SetIcon(s_gi_icon * icon); + s_gi_icon * GetIcon(); + + /*! + Set bitmap to be drawn when Button is clicked + + \param dib Bitmap to draw when Button is clicked + */ + HRESULT SetPressedDIB(DIB * dib); + + /*! + Get bitmap to be drawn when Button is clicked + + \return Pointer to bitmap + */ + DIB * GetPressedDIB(); + + + HRESULT SetStyle(unsigned int flags); + HRESULT SetTextColor(COLOR color); + COLOR GetTextColor(); + HRESULT UseParentBackground(char use); + friend class CTooltip; + protected: + char Text[64]; + s_gi_icon * Icon; + DIB * Foreground; + DIB * Background; + sBlit * BackgroundBlit; + DIB * PressedDIB; + COLOR TextColor; +}; + +#endif diff --git a/widgetcheckbox.cpp b/widgetcheckbox.cpp new file mode 100644 index 0000000..9e1397c --- /dev/null +++ b/widgetcheckbox.cpp @@ -0,0 +1,32 @@ +#include + +#include "widgetcheckbox.h" + +CCheckbox::CCheckbox() { + this->hWnd = NULL; +} + +HRESULT CCheckbox::Create(HANDLE parent, char * name, int x, int y, int w, int h, int style, unsigned int ID) { + this->hWnd = GI_WidgetCheckboxCreate(parent, name, x, y, w, h, style, ID); + if (this->hWnd) { + return S_OK; + } + return E_HANDLE; +} + +HRESULT CCheckbox::Enable() { + return GI_WidgetCheckboxEnable(this->hWnd); +} + +HRESULT CCheckbox::Disable() { + return GI_WidgetCheckboxDisable(this->hWnd); +} + +HRESULT CCheckbox::SetState(int state) { + return GI_WidgetCheckboxSet(this->hWnd, state); +} + +int CCheckbox::GetState() { + return GI_WidgetCheckboxGet(this->hWnd); +} + diff --git a/widgetcheckbox.h b/widgetcheckbox.h new file mode 100644 index 0000000..fa06e30 --- /dev/null +++ b/widgetcheckbox.h @@ -0,0 +1,57 @@ +#ifndef WIDGETCHECKBOX_H +#define WIDGETCHECKBOX_H + +#include + +#include "widget.h" + +//! A Checkbox class + +class CCheckbox: public CWidget { + public: + /*! Constructor */ + CCheckbox(); + + /*! + Create Checkbox + + \param parent HANDLE of the parent window on which to draw + \param name Name of the Checkbox + \param x Top left x coordinate + \param y Top left y coordinate + \param w Checkbox width + \param h Checkbox height + \param style Style flags + \param ID ID sent to parent when Checkbox is (un)checked (MSG_COMMAND) + + \return Success: S_OK\n + Failure: E_HANDLE + */ + HRESULT Create(HANDLE parent, char * name, int x, int y, int w, int h, int style, unsigned int ID) ; + + /*! + Enable Checkbox + */ + HRESULT Enable(); + + /*! + Disable Checkbox + */ + HRESULT Disable(); + + /*! + Set State + + \param state Checked: nonzero\n Unchecked: 0 + */ + HRESULT SetState(int state); + + /*! + Get State + + \return Nonzero if Checked\n 0 if Unchecked + */ + int GetState(); +}; + +#endif diff --git a/widgetform.cpp b/widgetform.cpp new file mode 100644 index 0000000..61d31ae --- /dev/null +++ b/widgetform.cpp @@ -0,0 +1,19 @@ +#include + +#include "widgetform.h" + +CForm::CForm() { + this->hWnd = NULL; +} + +HRESULT CForm::Create(HANDLE parent, char * name, int x, int y, int w, int h, int style, unsigned int flags) { + this->hWnd = GI_WidgetFormCreate(parent, name, x, y, w, h, style, flags); + if (this->hWnd) { + return S_OK; + } + return E_HANDLE; +} + +HRESULT CForm::UseParentBackground(bool use) { + return GI_WidgetFormUseParentBackground(this->hWnd, use); +} diff --git a/widgetform.h b/widgetform.h new file mode 100644 index 0000000..c787852 --- /dev/null +++ b/widgetform.h @@ -0,0 +1,42 @@ +#ifndef WIDGETFORM_H +#define WIDGETFORM_H + +#include + +#include "widget.h" + +//! A Form class. + +class CForm: public CWidget { + public: + /*! Constructor */ + CForm(); + + /*! + Create Form + + \param parent HANDLE of the parent window on which to draw + \param name Name of the Form + \param x Top left x coordinate + \param y Top left y coordinate + \param w Form width + \param h Form height + \param style Style flags + \param flags + + \return Success: S_OK\n + Failure: E_HANDLE + + \see GetParent() + */ + HRESULT Create(HANDLE parent, char * name, int x, int y, int w, int h, int style, unsigned int flags); + + /*! + Sets if the Form will use its parent's background + + \param use Use Parent Background + */ + HRESULT UseParentBackground(bool use); +}; + +#endif diff --git a/widgetprogressbar.cpp b/widgetprogressbar.cpp new file mode 100644 index 0000000..9b2ff32 --- /dev/null +++ b/widgetprogressbar.cpp @@ -0,0 +1,48 @@ +#include + +#include "widgetprogressbar.h" + +CProgressbar::CProgressbar() { + this->value = 0; + this->maximum = 100; + this->color = cGray; +} + +HRESULT CProgressbar::Create(HANDLE parent, char * name, int x, int y, int w, int h, int style) { + this->hWnd = GI_WidgetProgressCreate(parent, name, x, y, w, h, style); + if (this->hWnd) { + return S_OK; + } + return E_HANDLE; +} + +int CProgressbar::Redraw() { + return GI_WidgetProgressForceRedraw(this->hWnd); +} + +int CProgressbar::SetValue(int val) { + this->value = val; + return GI_WidgetProgressSet(this->hWnd, val); +} + +int CProgressbar::GetValue() { + return this->value; +} + +int CProgressbar::SetColor(COLOR Color) { + this->color = Color; + return GI_WidgetProgressSetColor(this->hWnd, Color); +} + +COLOR CProgressbar::GetColor() { + return this->color; +} + +int CProgressbar::SetMax(int max) { + this->maximum = max; + return GI_WidgetProgressSetMax(this->hWnd, max); +} + +int CProgressbar::GetMax() { + return this->maximum; +} diff --git a/widgetprogressbar.h b/widgetprogressbar.h new file mode 100644 index 0000000..b40d4a7 --- /dev/null +++ b/widgetprogressbar.h @@ -0,0 +1,83 @@ +#ifndef WIDGETPROGRESSBAR_H +#define WIDGETPROGRESSBAR_H + +#include + +#include "widget.h" + +//! A Progressbar class + +class CProgressbar: public CWidget { + public: + /*! Constructor */ + CProgressbar(); + + /*! + Create Progressbar + + \param parent HANDLE of the parent window on which to draw + \param name Name of the Progressbar + \param x Top left x coordinate + \param y Top left y coordinate + \param w Form width + \param h Form height + \param style Style flags + + \return Success: S_OK\n + Failure: E_HANDLE + */ + HRESULT Create(HANDLE parent, char * name, int x, int y, int w, int h, int style); + + /*! + Redraw Progressbar + */ + int Redraw(); + + /*! + Set value of Progressbar + + \param val Value to set + */ + int SetValue(int val); + + /*! + Get value of Progressbar + + \return value + */ + int GetValue(); + + /*! + Set color of Progressbar + + \param Color Color to set + */ + int SetColor(COLOR Color); + + /*! + Get color of Progressbar + + \return COLOR of Progressbar + */ + COLOR GetColor(); + + /*! + Set maximum value of Progressbar + + \param max Maximum value + */ + int SetMax(int max); + + /*! + Get maximum value of Progressbar + + \return Maximum value + */ + int GetMax(); + protected: + int value; + int maximum; + COLOR color; +}; + +#endif diff --git a/widgetslider.cpp b/widgetslider.cpp new file mode 100644 index 0000000..3b5198b --- /dev/null +++ b/widgetslider.cpp @@ -0,0 +1,34 @@ +#include + +#include "widgetslider.h" + +CSlider::CSlider() { + this->maximum = 0; + this->hWnd = NULL; +} + +HRESULT CSlider::Create(HANDLE parent, char * name, int x, int y, int w, int h, int style) { + this->hWnd = GI_WidgetSliderCreate(parent, name, x, y, w, h, style); + if (this->hWnd) { + return S_OK; + } + return E_HANDLE; +} + +HRESULT CSlider::SetValue(int position) { + this->pos = position; + return GI_WidgetSliderSet(this->hWnd, position); +} + +int CSlider::GetValue() { + return this->pos; +} + +HRESULT CSlider::SetMax(int max) { + maximum = max; + return GI_WidgetSliderSetMax(this->hWnd, max); +} + +int CSlider::GetMax() { + return this->maximum; +} diff --git a/widgetslider.h b/widgetslider.h new file mode 100644 index 0000000..74f6799 --- /dev/null +++ b/widgetslider.h @@ -0,0 +1,63 @@ +#ifndef WIDGETSLIDER_H +#define WIDGETSLIDER_H + +#include + +#include "widget.h" + +//! A Slider class + +class CSlider: public CWidget { + public: + /*! Constructor */ + CSlider(); + + /*! + Create Slider + + \param parent HANDLE of the parent window on which to draw + \param name Name of the Progressbar + \param x Top left x coordinate + \param y Top left y coordinate + \param w Form width + \param h Form height + \param style Style flags + + \return Success: S_OK\n + Failure: E_HANDLE + */ + HRESULT Create(HANDLE parent, char * name, int x, int y, int w, int h, int style); + + /*! + Set value of Slider + + \param position Position to set + */ + HRESULT SetValue(int position); + + /*! + Get value of Slider + + \return position + */ + int GetValue(); + + /*! + Set Maximum value of Slider + + \param max Maximum value + */ + HRESULT SetMax(int max); + + /*! + Get Maximum value of Slider + + \return Maximum value + */ + int GetMax(); + private: + int maximum; + int pos; +}; + +#endif diff --git a/widgettextfield.cpp b/widgettextfield.cpp new file mode 100644 index 0000000..2b40d5d --- /dev/null +++ b/widgettextfield.cpp @@ -0,0 +1,62 @@ +#include + +#include "widgettextfield.h" + +CTextfield::CTextfield() { + this->hWnd = NULL; +} + +HRESULT CTextfield::Create(HANDLE parent, char * name, int x, int y, int w, int h, int style) { + this->hWnd = GI_WidgetTextfieldCreate(parent, name, x, y, w, h, style); + if (this->hWnd) { + return S_OK; + } + return E_HANDLE; +} + +HRESULT CTextfield::Add(char * line) { + return GI_WidgetTextfieldAdd(this->hWnd, line); +} + +HRESULT CTextfield::AddFile(char * filename) { + return GI_WidgetTextfieldAddFile(this->hWnd, filename); +} + +HRESULT CTextfield::AddLine(char * line) { + return GI_WidgetTextfieldAddLine(this->hWnd, line); +} + +HRESULT CTextfield::DeleteText() { + return GI_WidgetTextfieldDeleteText(this->hWnd); +} + +HRESULT CTextfield::Redraw() { + return GI_WidgetTextfieldRedraw(this->hWnd); +} + +HRESULT CTextfield::PasswordMode(bool passwordmode) { + return GI_WidgetTextfieldPasswordMode(this->hWnd, passwordmode); +} + +HRESULT CTextfield::ReadonlyMode(bool readonly) { + return GI_WidgetTextfieldReadonlyMode(this->hWnd, readonly); +} + +HRESULT CTextfield::SingleLine(bool singleline) { + return GI_WidgetTextfieldSetSingleLine(this->hWnd, singleline); +} + +/* +HRESULT CTextfield::Undo() { + return GI_WidgetTextfieldUndo(this->hWnd); +} + +HRESULT CTextfield::UndoAvailable() { + return GI_WidgetTextfieldUndoAvailable(this->hWnd); +} + +HRESULT CTextfield::UndoReset() { + return GI_WidgetTextfieldUndoReset(this->hWnd); +} + +*/ diff --git a/widgettextfield.h b/widgettextfield.h new file mode 100644 index 0000000..c1208f0 --- /dev/null +++ b/widgettextfield.h @@ -0,0 +1,94 @@ +#ifndef WIDGETTEXTFIELD_H +#define WIDGETTEXTFIELD_H + +#include + +#include "widget.h" + +//! A Textfield class + +class CTextfield: public CWidget { + public: + /*! Constructor */ + CTextfield(); + + /*! + Create Textfield + + \param parent HANDLE of the parent window on which to draw + \param name Name of the Textfield + \param x Top left x coordinate + \param y Top left y coordinate + \param w Form width + \param h Form height + \param style Style flags + + \return Success: S_OK\n + Failure: E_HANDLE + + \see GetParent() + */ + HRESULT Create(HANDLE parent, char * name, int x, int y, int w, int h, int style); + + /*! + Adds text without a trailing newline + + \param line Text to add + + \see AddLine() + */ + HRESULT Add(char * line); + + /*! + Loads a file + + \param filename Name of file to load + */ + HRESULT AddFile(char * filename); + + /*! + Adds text with a trailing newline + + \param line Text to add + + \see Add() + */ + HRESULT AddLine(char * line); + + /*! + Clears all text + */ + HRESULT DeleteText(); + + /*! + Redraw Textfield + */ + HRESULT Redraw(); + + /*! + Turn on or off password mode + + \param passwordmode Password Mode + */ + HRESULT PasswordMode(bool passwordmode); + + /*! + Turn on or off read only mode + + \param readonly Read only mode + */ + HRESULT ReadonlyMode(bool readonly); + + /*! + Turn on or off single kine mode + + \param singleline Single Line mode + */ + HRESULT SingleLine(bool singleline); + + HRESULT Undo(); + HRESULT UndoAvailable(); + HRESULT UndoReset(); +}; + +#endif diff --git a/widgettitle.cpp b/widgettitle.cpp new file mode 100644 index 0000000..9f7a918 --- /dev/null +++ b/widgettitle.cpp @@ -0,0 +1,25 @@ +#include + +#include "widgettitle.h" + +CTitle::CTitle() { + this->hWnd = NULL; + memset(this->Text, '\0', strlen(this->Text)); +} + +HRESULT CTitle::Create(HANDLE parent, char * name, int x, int y, int w, int h, unsigned int ullcon, unsigned int style) { + this->hWnd = GI_WidgetTitleCreate(parent, name, x, y, w, h, ullcon, style); + if (this->hWnd) { + return S_OK; + } + return E_HANDLE; +} + +int CTitle::SetText(char * text) { + strncpy(this->Text, text, strlen(this->Text)); + return GI_WidgetTitleSet(this->hWnd, text); +} + +char * CTitle::GetText() { + return this->Text; +} diff --git a/widgettitle.h b/widgettitle.h new file mode 100644 index 0000000..a2596db --- /dev/null +++ b/widgettitle.h @@ -0,0 +1,53 @@ +#ifndef WIDGETTITLE_H +#define WIDGETTITLE_H + +#include + +#include "widget.h" + +//! A Title class + +class CTitle: public CWidget { + public: + /*! Constructor */ + CTitle(); + + /*! + Create Title + + \param parent HANDLE of the parent window on which to draw + \param name Name of the Form + \param x Top left x coordinate + \param y Top left y coordinate + \param w Form width + \param h Form height + \param ullcon + \param style Style flags\n + WGF_NO_BORDER: Button has no border\n + WGF_BORDER_ON_MOUSE_OVER: Buttons has border on mouseover + + \return Success: S_OK\n + Failure: E_HANDLE + + \see GetParent() + */ + HRESULT Create(HANDLE parent, char * name, int x, int y, int w, int h, unsigned int ullcon, unsigned int style); + + /*! + Set Title + + \param text New title + */ + int SetText(char * text); + + /*! + Get Title + + \return Title + */ + char * GetText(); + protected: + char Text[64]; +}; + +#endif diff --git a/widgettooltip.cpp b/widgettooltip.cpp new file mode 100644 index 0000000..9c27267 --- /dev/null +++ b/widgettooltip.cpp @@ -0,0 +1,47 @@ +#include + +#include "widgettooltip.h" + +CTooltip::CTooltip() { + this->hWnd = NULL; + this->PopupTime = 0; + memset(this->Text, '\0', sizeof(this->Text)); +} + +HRESULT CTooltip::Create(HANDLE parent, HANDLE owner, char * text, unsigned int popuptime) { + this->hWnd = GI_WidgetTooltipCreate(parent, owner, text, popuptime); + strncpy(this->Text, text, strlen(this->Text)); + this->PopupTime = popuptime; + if (this->hWnd) { + return S_OK; + } + return E_HANDLE; +} + +HRESULT CTooltip::Enable() { + return GI_WidgetTooltipEnable(this->hWnd); +} + +HRESULT CTooltip::Disable() { + return GI_WidgetTooltipDisable(this->hWnd); +} + +HRESULT CTooltip::SetText(char * text) { + memset(this->Text, '\0', sizeof(this->Text)); + strncpy(this->Text, text, 63); + return GI_WidgetTooltipSet(this->hWnd, text, this->PopupTime); +} + +char * CTooltip::GetText() { + return this->Text; +} + +HRESULT CTooltip::SetPopupTime(unsigned int popuptime) { + this->PopupTime = popuptime; + return GI_WidgetTooltipSet(this->hWnd, this->Text, popuptime); +} + +unsigned int CTooltip::GetPopupTime() { + return this->PopupTime; +} + diff --git a/widgettooltip.h b/widgettooltip.h new file mode 100644 index 0000000..e21765f --- /dev/null +++ b/widgettooltip.h @@ -0,0 +1,53 @@ +#ifndef WIDGETTOOLTIP_H +#define WIDGETTOOLTIP_H + +#include + +#include "widget.h" + +//! A Tooltip class + +class CTooltip { + public: + /*! Constructor */ + CTooltip(); + + /*! + Create Tooltip + + \param parent HANDLE of the parent window on which to draw + \param owner Parent window of the tooltip when created (default: NULL) + \param text Text to be displayed + \param popuptime Popup time in milliseconds + + \return Success: S_OK\n + Failure: E_HANDLE + */ + HRESULT Create(HANDLE parent, HANDLE owner, char * text, unsigned int popuptime); + + /*! + Enable Tooltip + */ + HRESULT Enable(); + + /*! + Disable Tooltip + */ + HRESULT Disable(); + + HRESULT SetText(char * text); + + char * GetText(); + + HRESULT SetPopupTime(unsigned int popuptime); + + unsigned int GetPopupTime(); + + protected: + HANDLE hWnd; + char Text[64]; + unsigned int PopupTime; +}; + +#endif + -- cgit v1.2.3