src/statusbar.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 "statusbar.h"
00014 #include "exception.h"
00015 namespace MWidgets
00016 {
00017 
00018         /*******************************************************************************/
00019         StatusBar::StatusBar():Widget()
00020         {
00021         }
00022         /*******************************************************************************/
00023         void StatusBar::Create(Widget *parent)
00024         {
00025                 Widget::Create(0,0,0,0,"",STATUSCLASSNAME,WS_CHILD|CCS_BOTTOM |SBARS_SIZEGRIP|WS_CLIPSIBLINGS,parent->GetHwnd());
00026                 SendMessage(m_hWnd,SB_SIMPLE,FALSE,0);
00027         }
00028         /*******************************************************************************/
00029         StatusBar::~StatusBar()
00030         {
00031         };
00032         /*******************************************************************************/
00033         void StatusBar::AddPart(int width)
00034         {
00035                 int nParts=(int)SendMessage(m_hWnd,SB_GETPARTS,0,0);
00036                 int *widths=new int[nParts+1];
00037                 nParts=(int)SendMessage(m_hWnd,SB_GETPARTS,nParts,reinterpret_cast<LPARAM>(widths));
00038                 if(nParts-2>=0)
00039                         width+=widths[nParts-2];
00040                 widths[nParts-1]=width;
00041                 widths[nParts]=-1;
00042                 SendMessage(m_hWnd,SB_SETPARTS,nParts+1,reinterpret_cast<LPARAM>(widths));
00043                 delete[] widths;
00044         };
00045         /*******************************************************************************/
00046         void StatusBar::SetPartText(int index,std::string str)
00047         {
00048                 SendMessage(m_hWnd,SB_SETTEXT ,index,reinterpret_cast<LPARAM>(str.c_str()));
00049         };
00050         /*******************************************************************************/
00051         WIDGET_TYPE StatusBar::GetType()
00052         {
00053                 return STATUSBAR;
00054         };
00055         /*******************************************************************************/
00056 }

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