logo
Main Page | Namespaces | Classes | Compounds | Files | Compound Members | Related

Button.cpp

00001 //
00002 //  SYNTOPIA. See http://Syntopia.sourceforge.net for details and documentation.        
00003 //
00004 //      Author of this file: Mikael Hvidtfeldt Christensen (mikaelc@users.sourceforge.net)
00005 //
00006 
00007 
00008 
00009 #include "Button.h"
00010 
00011 namespace GUIToolkit {
00012 
00013 
00014 Button::Button(std::string s) {
00015         ButtonLabel = s;
00016 }
00017 
00018 Button::~Button() {
00019 }
00020 
00021 
00022 void Button::PutInWinForm(WinForm * WF, int x0, int x1, int y0, int y1) {
00023             ID = (HMENU)GUIControl::GUIInstance->Register(this);
00024                 topWF = WF;
00025 
00026         hButton = CreateWindowEx(NULL, "button", ButtonLabel.c_str(),  WS_CHILD | WS_VISIBLE | BS_DEFPUSHBUTTON,
00027             x0, x1,y0 ,y1, WF->hwnd, ID, GetModuleHandle(NULL),  NULL);
00028 
00029                 if(hButton == NULL) {
00030             MessageBox(WF->hwnd, "Could not create Button.", "Error", MB_OK | MB_ICONERROR);
00031                         // Todo: Should Throw Error
00032                 }
00033 
00034      
00035 }
00036 
00037 }

Syntopia Project. Visit the web page, or the SourceForge page.
Docs made by Doxygen. Email: Mikael Christensen