src/chekbox.cpp

Go to the documentation of this file.
00001 /*
00002 * Copyright (c) 2006 by Kirill Kolodyazhniy.
00003 * See the file "license.terms" for information on usage and redistribution
00004 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
00005 */
00006 
00007 #include "stdinc.h"
00008 #include "icon.h"
00009 #include "eventhandler.h"
00010 #include "widgets.h"
00011 #include "menu.h"
00012 #include "widget.h"
00013 #include "checkbox.h"
00014 #include "exception.h"
00015 namespace MWidgets
00016 {
00017 
00018         /*******************************************************************************/
00019         CheckBox::CheckBox():Widget()
00020         {
00021         };
00022         /*******************************************************************************/
00023         void CheckBox::Create(Widget *parent,int x,int y,int w,int h,string caption)
00024         {
00025                 Widget::Create(x,y,w,h,caption,"BUTTON",WS_CHILD|BS_CHECKBOX|WS_TABSTOP|WS_CLIPSIBLINGS  ,parent->GetHwnd());
00026         };
00027         /*******************************************************************************/
00028         void CheckBox::OnCommand( WORD code,WORD  )
00029         {
00030                 if(code==BN_CLICKED)
00031                 {
00032                         if(GetCheked()==FALSE)
00033                                 SetCheked(TRUE);
00034                         else
00035                                 SetCheked(FALSE);
00036                 };
00037         };
00038         /*******************************************************************************/
00039         BOOL CheckBox::GetCheked()
00040         {
00041                 LRESULT rez=SendMessage(m_hWnd,BM_GETCHECK,0,0);
00042                 return (rez==BST_CHECKED);
00043         };
00044         /*******************************************************************************/
00045         void CheckBox::SetCheked(BOOL val)
00046         {
00047                 if(val==TRUE)
00048                         SendMessage(m_hWnd,BM_SETCHECK,BST_CHECKED,0);
00049                 else if(val==FALSE)
00050                         SendMessage(m_hWnd,BM_SETCHECK,BST_UNCHECKED,0);
00051         };
00052         /*******************************************************************************/
00053         WIDGET_TYPE CheckBox::GetType()
00054         {
00055                 return CHECKBOX;
00056         };
00057         /*******************************************************************************/
00058 };

Generated on Thu Oct 26 13:47:45 2006 for MWidgets by  doxygen 1.4.7