2009-08-17 10:41:51 +00:00
|
|
|
/***************************************************************************
|
|
|
|
|
|
|
|
gcombobox.h
|
|
|
|
|
|
|
|
(c) 2000-2009 Benoît Minisini <gambas@users.sourceforge.net>
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2, or (at your option)
|
|
|
|
any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
|
|
|
|
|
***************************************************************************/
|
2007-12-30 16:41:49 +00:00
|
|
|
#ifndef __GCOMBOBOX_H
|
|
|
|
#define __GCOMBOBOX_H
|
|
|
|
|
|
|
|
#include "gtextbox.h"
|
2008-09-09 11:03:47 +00:00
|
|
|
#include "gtree.h"
|
2007-12-30 16:41:49 +00:00
|
|
|
|
|
|
|
class gComboBox : public gTextBox
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
gComboBox(gContainer *parent);
|
2008-09-09 11:03:47 +00:00
|
|
|
~gComboBox();
|
2007-12-30 16:41:49 +00:00
|
|
|
|
|
|
|
int count();
|
|
|
|
int index();
|
|
|
|
char* itemText(int ind);
|
|
|
|
virtual int length();
|
|
|
|
//char** list();
|
|
|
|
virtual bool isReadOnly();
|
2008-09-09 11:03:47 +00:00
|
|
|
bool isSorted();
|
2007-12-30 16:41:49 +00:00
|
|
|
virtual char *text();
|
|
|
|
|
|
|
|
void setIndex(int vl);
|
2008-04-17 10:18:25 +00:00
|
|
|
void setItemText(int ind, const char *txt);
|
2007-12-30 16:41:49 +00:00
|
|
|
//void setList(char **vl);
|
|
|
|
virtual void setReadOnly(bool vl);
|
|
|
|
void setSorted(bool vl);
|
2008-04-17 10:18:25 +00:00
|
|
|
virtual void setText(const char *vl);
|
2007-12-30 16:41:49 +00:00
|
|
|
|
|
|
|
//"Methods"
|
|
|
|
void popup();
|
2008-04-17 10:18:25 +00:00
|
|
|
void add(const char *vl, int pos = -1);
|
2007-12-30 16:41:49 +00:00
|
|
|
virtual void clear();
|
2008-04-17 10:18:25 +00:00
|
|
|
int find(const char *ptr);
|
2007-12-30 16:41:49 +00:00
|
|
|
void remove(int pos);
|
|
|
|
|
|
|
|
virtual void resize(int w, int h);
|
|
|
|
virtual void setRealBackground(gColor vl);
|
|
|
|
virtual void setRealForeground(gColor vl);
|
|
|
|
virtual void setFont(gFont *f);
|
|
|
|
virtual void setFocus();
|
|
|
|
|
|
|
|
//"Signals"
|
|
|
|
void (*onClick)(gComboBox *sender);
|
|
|
|
|
|
|
|
//"Private"
|
|
|
|
bool sort;
|
|
|
|
GtkCellRenderer *cell;
|
|
|
|
virtual int minimumHeight();
|
2008-09-09 11:03:47 +00:00
|
|
|
gTree *tree;
|
|
|
|
bool _model_dirty;
|
|
|
|
int _last_key;
|
2009-05-15 17:57:29 +00:00
|
|
|
GtkWidget *_button;
|
2008-09-09 11:03:47 +00:00
|
|
|
|
|
|
|
void updateModel();
|
|
|
|
void updateSort();
|
|
|
|
char *indexToKey(int index);
|
|
|
|
char* find(GtkTreePath *path) { return tree->pathToKey(path, false); }
|
2008-09-26 02:25:29 +00:00
|
|
|
void checkIndex();
|
2009-05-15 17:57:29 +00:00
|
|
|
void updateFocusHandler();
|
2009-07-21 19:55:22 +00:00
|
|
|
void create(bool readOnly);
|
2007-12-30 16:41:49 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|