| 1 |
/* -*- mode: C++; tab-width: 4; c-basic-offset: 4; -*- */ |
| 2 |
/* AbiSource Application Framework |
| 3 |
* Copyright (C) 2005,2011 Hubert Figuiere |
| 4 |
* |
| 5 |
* This program is free software; you can redistribute it and/or |
| 6 |
* modify it under the terms of the GNU General Public License |
| 7 |
* as published by the Free Software Foundation; either version 2 |
| 8 |
* of the License, or (at your option) any later version. |
| 9 |
* |
| 10 |
* This program is distributed in the hope that it will be useful, |
| 11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 |
* GNU General Public License for more details. |
| 14 |
* |
| 15 |
* You should have received a copy of the GNU General Public License |
| 16 |
* along with this program; if not, write to the Free Software |
| 17 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
| 18 |
* 02110-1301 USA. |
| 19 |
*/ |
| 20 |
|
| 21 |
|
| 22 |
#ifndef __XAP_UNIXWIDGET_H__ |
| 23 |
#define __XAP_UNIXWIDGET_H__ |
| 24 |
|
| 25 |
#include "xap_Widget.h" |
| 26 |
#include <string> |
| 27 |
#include <gtk/gtk.h> |
| 28 |
|
| 29 |
class XAP_UnixWidget |
| 30 |
: public XAP_Widget |
| 31 |
{ |
| 32 |
public: |
| 33 |
XAP_UnixWidget(GtkWidget * w); |
| 34 |
|
| 35 |
/** The destructor just clean up. Must not destroy the real widget. */ |
| 36 |
virtual ~XAP_UnixWidget() |
| 37 |
{ } |
| 38 |
|
| 39 |
/** set the widget enabled/disabled state */ |
| 40 |
virtual void setState(bool enabled); |
| 41 |
/** set the widget enabled/disabled state */ |
| 42 |
virtual bool getState(void); |
| 43 |
|
| 44 |
/** set the widget visible state */ |
| 45 |
virtual void setVisible(bool visible); |
| 46 |
/** get the widget visible state */ |
| 47 |
virtual bool getVisible(void); |
| 48 |
|
| 49 |
/** set the widget int value */ |
| 50 |
virtual void setValueInt(int val); |
| 51 |
/** get the widget int value */ |
| 52 |
virtual int getValueInt(void); |
| 53 |
|
| 54 |
/** set the widget value as string */ |
| 55 |
virtual void setValueString(const UT_UTF8String &val); |
| 56 |
/** get the widget value as string */ |
| 57 |
virtual void getValueString(UT_UTF8String &val); |
| 58 |
|
| 59 |
/** set the widget value as float */ |
| 60 |
virtual void setValueFloat(float val); |
| 61 |
/** get the widget value as float */ |
| 62 |
virtual float getValueFloat(void); |
| 63 |
|
| 64 |
/** set the widget label */ |
| 65 |
virtual void setLabel(const UT_UTF8String &val); |
| 66 |
virtual void setLabel(const std::string &val); |
| 67 |
|
| 68 |
void setData(const std::string & data) |
| 69 |
{ |
| 70 |
m_data = data; |
| 71 |
} |
| 72 |
private: |
| 73 |
void setLabelCStr(const char* val); |
| 74 |
|
| 75 |
GtkWidget *m_widget; |
| 76 |
// used to store the markup for a GtkLabel |
| 77 |
std::string m_data; |
| 78 |
}; |
| 79 |
|
| 80 |
|
| 81 |
|
| 82 |
#endif |