2008-04-24 12:49:12 +00:00
|
|
|
/***************************************************************************
|
|
|
|
|
2011-12-31 02:39:20 +00:00
|
|
|
CTextBox.cpp
|
2008-04-24 12:49:12 +00:00
|
|
|
|
2011-12-31 02:39:20 +00:00
|
|
|
(c) 2000-2012 Benoît Minisini <gambas@users.sourceforge.net>
|
2008-04-24 12:49:12 +00:00
|
|
|
|
2011-12-31 02:39:20 +00:00
|
|
|
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.
|
2008-04-24 12:49:12 +00:00
|
|
|
|
2011-12-31 02:39:20 +00:00
|
|
|
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.
|
2008-04-24 12:49:12 +00:00
|
|
|
|
2011-12-31 02:39:20 +00:00
|
|
|
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., 51 Franklin Street, Fifth Floor, Boston,
|
|
|
|
MA 02110-1301, USA.
|
2008-04-24 12:49:12 +00:00
|
|
|
|
|
|
|
***************************************************************************/
|
|
|
|
|
|
|
|
#define __CTEXTBOX_CPP
|
|
|
|
|
|
|
|
#include <qapplication.h>
|
|
|
|
#include <qcombobox.h>
|
|
|
|
#include <qcursor.h>
|
|
|
|
#include <qsizepolicy.h>
|
2008-04-29 13:40:55 +00:00
|
|
|
#include <QLineEdit>
|
|
|
|
#include <QListView>
|
2008-04-24 12:49:12 +00:00
|
|
|
|
|
|
|
#include "gambas.h"
|
|
|
|
|
|
|
|
#include "CConst.h"
|
|
|
|
#include "CTextBox.h"
|
|
|
|
|
|
|
|
DECLARE_EVENT(EVENT_Change);
|
|
|
|
DECLARE_EVENT(EVENT_Activate);
|
|
|
|
DECLARE_EVENT(EVENT_Click);
|
|
|
|
|
|
|
|
#define MAX_LEN 32767
|
|
|
|
|
|
|
|
|
|
|
|
/***************************************************************************
|
|
|
|
|
2009-01-03 22:24:02 +00:00
|
|
|
TextBox
|
2008-04-24 12:49:12 +00:00
|
|
|
|
|
|
|
***************************************************************************/
|
|
|
|
|
|
|
|
static bool get(void *_object, QLineEdit **wid, bool error = true)
|
|
|
|
{
|
2009-01-03 22:24:02 +00:00
|
|
|
QComboBox *combo;
|
|
|
|
|
|
|
|
if (qobject_cast<QLineEdit *>(TEXTBOX))
|
|
|
|
{
|
|
|
|
*wid = TEXTBOX;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
combo = COMBOBOX;
|
|
|
|
if (!combo->isEditable())
|
|
|
|
{
|
|
|
|
if (error)
|
|
|
|
GB.Error("ComboBox is read-only");
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
*wid = combo->lineEdit();
|
|
|
|
return false;
|
2008-04-24 12:49:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#define GET_TEXT_BOX() \
|
2009-01-03 22:24:02 +00:00
|
|
|
QLineEdit *textbox; \
|
|
|
|
if (get(_object, &textbox)) \
|
|
|
|
return;
|
2008-04-24 12:49:12 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
BEGIN_METHOD(CTEXTBOX_new, GB_OBJECT parent)
|
|
|
|
|
2009-01-03 22:24:02 +00:00
|
|
|
QLineEdit *wid = new QLineEdit(QCONTAINER(VARG(parent)));
|
2008-04-24 12:49:12 +00:00
|
|
|
|
2009-01-03 22:24:02 +00:00
|
|
|
QObject::connect(wid, SIGNAL(textChanged(const QString &)), &CTextBox::manager, SLOT(onChange()));
|
|
|
|
QObject::connect(wid, SIGNAL(returnPressed()), &CTextBox::manager, SLOT(onActivate()));
|
2008-04-24 12:49:12 +00:00
|
|
|
|
2009-01-03 22:24:02 +00:00
|
|
|
wid->setAlignment(Qt::AlignLeft);
|
2008-04-24 12:49:12 +00:00
|
|
|
|
2009-01-03 22:24:02 +00:00
|
|
|
CWIDGET_new(wid, (void *)_object);
|
|
|
|
|
2008-04-24 12:49:12 +00:00
|
|
|
END_METHOD
|
|
|
|
|
|
|
|
|
|
|
|
BEGIN_METHOD_VOID(CTEXTBOX_clear)
|
|
|
|
|
2009-01-03 22:24:02 +00:00
|
|
|
TEXTBOX->clear();
|
2008-04-24 12:49:12 +00:00
|
|
|
|
|
|
|
END_METHOD
|
|
|
|
|
|
|
|
BEGIN_METHOD(CTEXTBOX_insert, GB_STRING text)
|
|
|
|
|
2009-01-03 22:24:02 +00:00
|
|
|
GET_TEXT_BOX();
|
2008-04-24 12:49:12 +00:00
|
|
|
|
2009-01-03 22:24:02 +00:00
|
|
|
//textbox->insert(QString(GB.ToZeroString(ARG(text))));
|
|
|
|
textbox->insert(QSTRING_ARG(text));
|
2008-04-24 12:49:12 +00:00
|
|
|
|
|
|
|
END_METHOD
|
|
|
|
|
|
|
|
|
|
|
|
BEGIN_PROPERTY(CTEXTBOX_text)
|
|
|
|
|
2009-01-03 22:24:02 +00:00
|
|
|
if (READ_PROPERTY)
|
|
|
|
GB.ReturnNewZeroString(TO_UTF8(TEXTBOX->text()));
|
|
|
|
else
|
|
|
|
TEXTBOX->setText(QSTRING_PROP());
|
2008-04-24 12:49:12 +00:00
|
|
|
|
|
|
|
END_PROPERTY
|
|
|
|
|
|
|
|
|
|
|
|
BEGIN_PROPERTY(CTEXTBOX_length)
|
|
|
|
|
2009-01-03 22:24:02 +00:00
|
|
|
GB.ReturnInteger(TEXTBOX->text().length());
|
2008-04-24 12:49:12 +00:00
|
|
|
|
|
|
|
END_PROPERTY
|
|
|
|
|
|
|
|
|
|
|
|
BEGIN_PROPERTY(CTEXTBOX_alignment)
|
|
|
|
|
2009-01-03 22:24:02 +00:00
|
|
|
if (READ_PROPERTY)
|
|
|
|
GB.ReturnInteger(CCONST_alignment(TEXTBOX->alignment() + Qt::AlignVCenter, ALIGN_NORMAL, false));
|
|
|
|
else
|
|
|
|
TEXTBOX->setAlignment((Qt::Alignment)CCONST_alignment(VPROP(GB_INTEGER), ALIGN_NORMAL, true) & Qt::AlignHorizontal_Mask);
|
2008-04-24 12:49:12 +00:00
|
|
|
|
|
|
|
END_PROPERTY
|
|
|
|
|
|
|
|
|
|
|
|
BEGIN_PROPERTY(CTEXTBOX_pos)
|
|
|
|
|
2009-01-03 22:24:02 +00:00
|
|
|
GET_TEXT_BOX();
|
2008-04-24 12:49:12 +00:00
|
|
|
|
2009-01-03 22:24:02 +00:00
|
|
|
if (READ_PROPERTY)
|
|
|
|
GB.ReturnInteger(textbox->cursorPosition());
|
|
|
|
else
|
|
|
|
textbox->setCursorPosition(VPROP(GB_INTEGER));
|
2008-04-24 12:49:12 +00:00
|
|
|
|
|
|
|
END_PROPERTY
|
|
|
|
|
|
|
|
|
|
|
|
BEGIN_PROPERTY(CTEXTBOX_read_only)
|
|
|
|
|
2009-01-03 22:24:02 +00:00
|
|
|
if (READ_PROPERTY)
|
|
|
|
GB.ReturnBoolean(TEXTBOX->isReadOnly());
|
|
|
|
else
|
|
|
|
TEXTBOX->setReadOnly(VPROP(GB_BOOLEAN));
|
2008-04-24 12:49:12 +00:00
|
|
|
|
|
|
|
END_PROPERTY
|
|
|
|
|
|
|
|
|
|
|
|
BEGIN_PROPERTY(CTEXTBOX_border)
|
|
|
|
|
2009-01-03 22:24:02 +00:00
|
|
|
GET_TEXT_BOX();
|
2008-04-24 12:49:12 +00:00
|
|
|
|
2009-01-03 22:24:02 +00:00
|
|
|
if (READ_PROPERTY)
|
|
|
|
GB.ReturnBoolean(textbox->hasFrame());
|
|
|
|
else
|
|
|
|
textbox->setFrame(VPROP(GB_BOOLEAN));
|
2008-04-24 12:49:12 +00:00
|
|
|
|
|
|
|
END_PROPERTY
|
|
|
|
|
|
|
|
|
|
|
|
BEGIN_PROPERTY(CTEXTBOX_password)
|
|
|
|
|
2009-01-03 22:24:02 +00:00
|
|
|
GET_TEXT_BOX();
|
2008-04-24 12:49:12 +00:00
|
|
|
|
2009-01-03 22:24:02 +00:00
|
|
|
if (READ_PROPERTY)
|
|
|
|
GB.ReturnBoolean(textbox->echoMode() != QLineEdit::Normal);
|
|
|
|
else
|
|
|
|
textbox->setEchoMode(VPROP(GB_BOOLEAN) ? QLineEdit::Password : QLineEdit::Normal);
|
2008-04-24 12:49:12 +00:00
|
|
|
|
|
|
|
END_PROPERTY
|
|
|
|
|
|
|
|
|
|
|
|
BEGIN_PROPERTY(CTEXTBOX_max_length)
|
|
|
|
|
2009-01-03 22:24:02 +00:00
|
|
|
int max;
|
2008-04-24 12:49:12 +00:00
|
|
|
|
2009-01-03 22:24:02 +00:00
|
|
|
GET_TEXT_BOX();
|
2008-04-24 12:49:12 +00:00
|
|
|
|
2009-01-03 22:24:02 +00:00
|
|
|
if (READ_PROPERTY)
|
|
|
|
{
|
|
|
|
max = textbox->maxLength();
|
|
|
|
GB.ReturnInteger(max >= MAX_LEN ? 0 : max);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
max = VPROP(GB_INTEGER);
|
|
|
|
if (max < 1 || max > MAX_LEN)
|
|
|
|
max = MAX_LEN;
|
2008-04-24 12:49:12 +00:00
|
|
|
|
2009-01-03 22:24:02 +00:00
|
|
|
textbox->setMaxLength(max);
|
|
|
|
}
|
2008-04-24 12:49:12 +00:00
|
|
|
|
|
|
|
END_PROPERTY
|
|
|
|
|
|
|
|
|
|
|
|
/***************************************************************************
|
|
|
|
|
2009-01-03 22:24:02 +00:00
|
|
|
.TextBox.Selection
|
2008-04-24 12:49:12 +00:00
|
|
|
|
|
|
|
***************************************************************************/
|
|
|
|
|
|
|
|
BEGIN_PROPERTY(CTEXTBOX_sel_text)
|
|
|
|
|
2009-01-03 22:24:02 +00:00
|
|
|
GET_TEXT_BOX();
|
2008-04-24 12:49:12 +00:00
|
|
|
|
2009-01-03 22:24:02 +00:00
|
|
|
if (READ_PROPERTY)
|
|
|
|
GB.ReturnNewZeroString(TO_UTF8(textbox->selectedText()));
|
|
|
|
else
|
|
|
|
textbox->insert(QSTRING_PROP());
|
2008-04-24 12:49:12 +00:00
|
|
|
|
|
|
|
END_PROPERTY
|
|
|
|
|
|
|
|
|
|
|
|
static void set_selection(QLineEdit *textbox, int start, int length)
|
|
|
|
{
|
2009-01-03 22:24:02 +00:00
|
|
|
int len = (int)textbox->text().length();
|
|
|
|
|
|
|
|
if (start < 0 || start >= len)
|
|
|
|
{
|
|
|
|
start = textbox->cursorPosition();
|
|
|
|
length = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
textbox->setCursorPosition(start);
|
|
|
|
|
|
|
|
if (length <= 0)
|
|
|
|
textbox->deselect();
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if ((start + length) >= len)
|
|
|
|
length = len - start;
|
|
|
|
textbox->setSelection(start, length);
|
|
|
|
}
|
2008-04-24 12:49:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void get_selection(QLineEdit *textbox, int *start, int *length)
|
|
|
|
{
|
2011-01-05 16:52:24 +00:00
|
|
|
*start = textbox->selectionStart();
|
|
|
|
if (*start < 0)
|
|
|
|
*start = textbox->cursorPosition();
|
2009-01-03 22:24:02 +00:00
|
|
|
if (!textbox->hasSelectedText())
|
|
|
|
*length = 0;
|
|
|
|
else
|
|
|
|
*length = textbox->selectedText().length();
|
2008-04-24 12:49:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
BEGIN_PROPERTY(CTEXTBOX_sel_length)
|
|
|
|
|
2009-01-03 22:24:02 +00:00
|
|
|
int start, length;
|
2008-04-24 12:49:12 +00:00
|
|
|
|
2009-01-03 22:24:02 +00:00
|
|
|
GET_TEXT_BOX();
|
2008-04-24 12:49:12 +00:00
|
|
|
|
2009-01-03 22:24:02 +00:00
|
|
|
get_selection(textbox, &start, &length);
|
2008-04-24 12:49:12 +00:00
|
|
|
|
2009-01-03 22:24:02 +00:00
|
|
|
GB.ReturnInteger(length);
|
2008-04-24 12:49:12 +00:00
|
|
|
|
|
|
|
END_PROPERTY
|
|
|
|
|
|
|
|
|
|
|
|
BEGIN_PROPERTY(CTEXTBOX_sel_start)
|
|
|
|
|
2009-01-03 22:24:02 +00:00
|
|
|
int start, length;
|
2008-04-24 12:49:12 +00:00
|
|
|
|
2009-01-03 22:24:02 +00:00
|
|
|
GET_TEXT_BOX();
|
2008-04-24 12:49:12 +00:00
|
|
|
|
2009-01-03 22:24:02 +00:00
|
|
|
get_selection(textbox, &start, &length);
|
|
|
|
GB.ReturnInteger(start);
|
2008-04-24 12:49:12 +00:00
|
|
|
|
|
|
|
END_PROPERTY
|
|
|
|
|
|
|
|
|
|
|
|
BEGIN_METHOD_VOID(CTEXTBOX_sel_clear)
|
|
|
|
|
2009-01-03 22:24:02 +00:00
|
|
|
GET_TEXT_BOX();
|
2008-04-24 12:49:12 +00:00
|
|
|
|
2009-01-03 22:24:02 +00:00
|
|
|
textbox->deselect();
|
2008-04-24 12:49:12 +00:00
|
|
|
|
|
|
|
END_METHOD
|
|
|
|
|
|
|
|
BEGIN_METHOD_VOID(CTEXTBOX_selected)
|
|
|
|
|
2009-01-03 22:24:02 +00:00
|
|
|
GET_TEXT_BOX();
|
2008-04-24 12:49:12 +00:00
|
|
|
|
2009-01-03 22:24:02 +00:00
|
|
|
GB.ReturnBoolean(textbox->hasSelectedText());
|
2008-04-24 12:49:12 +00:00
|
|
|
|
|
|
|
END_METHOD
|
|
|
|
|
|
|
|
|
|
|
|
BEGIN_METHOD(CTEXTBOX_sel_select, GB_INTEGER start; GB_INTEGER length)
|
|
|
|
|
2009-01-03 22:24:02 +00:00
|
|
|
GET_TEXT_BOX();
|
2008-04-24 12:49:12 +00:00
|
|
|
|
|
|
|
if (MISSING(start) && MISSING(length))
|
|
|
|
textbox->selectAll();
|
|
|
|
else if (!MISSING(start) && !MISSING(length))
|
2009-01-03 22:24:02 +00:00
|
|
|
set_selection(textbox, VARG(start), VARG(length));
|
2008-04-24 12:49:12 +00:00
|
|
|
|
|
|
|
END_METHOD
|
|
|
|
|
|
|
|
BEGIN_METHOD_VOID(CTEXTBOX_sel_all)
|
|
|
|
|
2009-01-03 22:24:02 +00:00
|
|
|
GET_TEXT_BOX();
|
2008-04-24 12:49:12 +00:00
|
|
|
|
2009-01-03 22:24:02 +00:00
|
|
|
textbox->selectAll();
|
2008-04-24 12:49:12 +00:00
|
|
|
|
|
|
|
END_METHOD
|
|
|
|
|
|
|
|
|
|
|
|
/***************************************************************************
|
|
|
|
|
2009-01-03 22:24:02 +00:00
|
|
|
ComboBox
|
2008-04-24 12:49:12 +00:00
|
|
|
|
|
|
|
***************************************************************************/
|
|
|
|
|
|
|
|
#undef THIS
|
|
|
|
#define THIS OBJECT(CCOMBOBOX)
|
|
|
|
|
2010-03-10 21:51:36 +00:00
|
|
|
static void raise_click_event(void *_object)
|
|
|
|
{
|
|
|
|
if (THIS->click)
|
|
|
|
return;
|
|
|
|
THIS->click = true;
|
|
|
|
GB.Raise(THIS, EVENT_Click, 0);
|
|
|
|
THIS->click = false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2010-03-07 17:14:54 +00:00
|
|
|
static int combo_get_current_item(void *_object)
|
2008-04-24 12:49:12 +00:00
|
|
|
{
|
2010-03-07 17:14:54 +00:00
|
|
|
COMBOBOX->sort();
|
|
|
|
return COMBOBOX->count() == 0 ? -1 : COMBOBOX->currentItem();
|
2008-04-24 12:49:12 +00:00
|
|
|
}
|
|
|
|
|
2010-03-07 17:14:54 +00:00
|
|
|
static void combo_set_current_item(void *_object, int item)
|
|
|
|
{
|
|
|
|
COMBOBOX->sort();
|
|
|
|
|
|
|
|
if (item != combo_get_current_item(THIS))
|
|
|
|
{
|
|
|
|
if (item < COMBOBOX->count())
|
|
|
|
COMBOBOX->setCurrentItem(item);
|
|
|
|
}
|
|
|
|
|
2010-03-10 21:51:36 +00:00
|
|
|
if (item >= 0 && !COMBOBOX->signalsBlocked())
|
|
|
|
raise_click_event(THIS);
|
2010-03-07 17:14:54 +00:00
|
|
|
}
|
2008-04-24 12:49:12 +00:00
|
|
|
|
2010-07-31 00:19:15 +00:00
|
|
|
static int combo_find_item(void *_object, const QString& s)
|
|
|
|
{
|
|
|
|
COMBOBOX->sort();
|
|
|
|
for (int i = 0; i < (int)COMBOBOX->count(); i++)
|
|
|
|
{
|
|
|
|
if (COMBOBOX->text(i) == s)
|
|
|
|
return i;
|
|
|
|
}
|
|
|
|
|
|
|
|
return (-1);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void combo_set_text(CCOMBOBOX *_object, QString &text)
|
|
|
|
{
|
|
|
|
int pos;
|
|
|
|
|
|
|
|
pos = combo_find_item(THIS, text);
|
|
|
|
if (!COMBOBOX->isEditable() || pos >= 0)
|
|
|
|
combo_set_current_item(_object, pos);
|
|
|
|
if (COMBOBOX->isEditable())
|
|
|
|
COMBOBOX->lineEdit()->setText(text);
|
|
|
|
}
|
|
|
|
|
2008-04-24 12:49:12 +00:00
|
|
|
static void combo_set_editable(void *_object, bool ed)
|
|
|
|
{
|
2009-01-03 22:24:02 +00:00
|
|
|
QLineEdit *textbox;
|
2010-07-31 00:19:15 +00:00
|
|
|
QString text;
|
2010-08-30 14:42:18 +00:00
|
|
|
bool hasFocus = COMBOBOX->hasFocus();
|
2010-07-31 00:19:15 +00:00
|
|
|
|
|
|
|
COMBOBOX->blockSignals(true);
|
|
|
|
text = COMBOBOX->currentText();
|
2009-01-03 22:24:02 +00:00
|
|
|
|
|
|
|
if (ed)
|
|
|
|
{
|
|
|
|
if (!COMBOBOX->isEditable())
|
|
|
|
{
|
|
|
|
//CWidget::removeFilter(COMBOBOX);
|
|
|
|
COMBOBOX->setEditable(true);
|
2010-05-08 20:17:29 +00:00
|
|
|
COMBOBOX->setCompleter(0);
|
2009-01-03 22:24:02 +00:00
|
|
|
//CWidget::installFilter(COMBOBOX);
|
|
|
|
QObject::connect(COMBOBOX->lineEdit(), SIGNAL(returnPressed()), &CTextBox::manager, SLOT(onActivate()));
|
|
|
|
|
|
|
|
if (CWIDGET_test_flag(THIS, WF_DESIGN))
|
|
|
|
{
|
|
|
|
get(_object, &textbox);
|
|
|
|
//textbox->removeEventFilter(COMBOBOX);
|
|
|
|
COMBOBOX->setFocusProxy(0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2010-08-30 14:46:58 +00:00
|
|
|
if (COMBOBOX->isEditable())
|
|
|
|
{
|
|
|
|
get(THIS, &textbox);
|
|
|
|
textbox->setFocusProxy(0);
|
|
|
|
COMBOBOX->setEditable(false);
|
|
|
|
COMBOBOX->update();
|
|
|
|
}
|
2009-01-03 22:24:02 +00:00
|
|
|
}
|
2010-07-31 00:19:15 +00:00
|
|
|
|
|
|
|
combo_set_text(THIS, text);
|
2009-01-03 22:24:02 +00:00
|
|
|
|
2010-08-30 14:42:18 +00:00
|
|
|
if (hasFocus)
|
|
|
|
COMBOBOX->setFocus();
|
|
|
|
|
2009-01-03 22:24:02 +00:00
|
|
|
if (CWIDGET_test_flag(THIS, WF_DESIGN))
|
|
|
|
COMBOBOX->setFocusPolicy(Qt::NoFocus);
|
|
|
|
|
2010-07-31 00:19:15 +00:00
|
|
|
COMBOBOX->blockSignals(false);
|
2010-03-07 17:14:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void combo_get_list(void *_object, GB_ARRAY array)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
COMBOBOX->sort();
|
|
|
|
for (i = 0; i < COMBOBOX->count(); i++)
|
|
|
|
{
|
2010-06-04 23:48:53 +00:00
|
|
|
*((char **)GB.Array.Get(array, i)) = GB.NewZeroString(TO_UTF8(COMBOBOX->text(i)));
|
2010-03-07 17:14:54 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void combo_set_list(void *_object, GB_ARRAY array)
|
|
|
|
{
|
|
|
|
int i;
|
2010-07-31 00:19:15 +00:00
|
|
|
QString text = COMBOBOX->currentText();
|
2010-03-07 17:14:54 +00:00
|
|
|
|
2010-03-10 21:51:36 +00:00
|
|
|
COMBOBOX->blockSignals(true);
|
|
|
|
COMBOBOX->clear();
|
2010-03-07 17:14:54 +00:00
|
|
|
|
|
|
|
if (array)
|
|
|
|
{
|
|
|
|
for (i = 0; i < GB.Array.Count(array); i++)
|
|
|
|
{
|
|
|
|
COMBOBOX->insertItem(TO_QSTRING(*((char **)GB.Array.Get(array, i))));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
COMBOBOX->setDirty();
|
2010-07-31 00:19:15 +00:00
|
|
|
combo_set_text(THIS, text);
|
2010-03-07 17:14:54 +00:00
|
|
|
|
2010-12-28 21:58:42 +00:00
|
|
|
if (!COMBOBOX->isEditable())
|
|
|
|
{
|
|
|
|
if (combo_get_current_item(THIS) < 0)
|
|
|
|
combo_set_current_item(THIS, 0);
|
|
|
|
}
|
|
|
|
|
2010-07-31 00:19:15 +00:00
|
|
|
COMBOBOX->blockSignals(false);
|
2010-03-07 17:14:54 +00:00
|
|
|
}
|
|
|
|
|
2008-04-24 12:49:12 +00:00
|
|
|
|
|
|
|
|
|
|
|
BEGIN_METHOD(CCOMBOBOX_new, GB_OBJECT parent)
|
|
|
|
|
2009-01-03 22:24:02 +00:00
|
|
|
MyComboBox *wid = new MyComboBox(QCONTAINER(VARG(parent)));
|
2008-04-24 12:49:12 +00:00
|
|
|
|
2009-01-03 22:24:02 +00:00
|
|
|
QObject::connect(wid, SIGNAL(editTextChanged(const QString &)), &CTextBox::manager, SLOT(onChange()));
|
|
|
|
QObject::connect(wid, SIGNAL(activated(int)), &CTextBox::manager, SLOT(onClick()));
|
2008-04-24 12:49:12 +00:00
|
|
|
|
2009-01-03 22:24:02 +00:00
|
|
|
CWIDGET_new(wid, (void *)_object);
|
2008-04-24 12:49:12 +00:00
|
|
|
|
2009-01-03 22:24:02 +00:00
|
|
|
combo_set_editable(_object, true);
|
2008-04-24 12:49:12 +00:00
|
|
|
|
|
|
|
END_METHOD
|
|
|
|
|
|
|
|
|
|
|
|
BEGIN_METHOD_VOID(CCOMBOBOX_clear)
|
|
|
|
|
2009-01-03 22:24:02 +00:00
|
|
|
COMBOBOX->clear();
|
|
|
|
COMBOBOX->clearEditText();
|
2008-04-24 12:49:12 +00:00
|
|
|
|
|
|
|
END_METHOD
|
|
|
|
|
|
|
|
|
|
|
|
BEGIN_METHOD_VOID(CCOMBOBOX_popup)
|
|
|
|
|
2009-01-03 22:24:02 +00:00
|
|
|
COMBOBOX->showPopup();
|
2008-04-24 12:49:12 +00:00
|
|
|
|
|
|
|
END_METHOD
|
|
|
|
|
|
|
|
|
|
|
|
BEGIN_PROPERTY(CCOMBOBOX_text)
|
|
|
|
|
2009-01-03 22:24:02 +00:00
|
|
|
if (READ_PROPERTY)
|
|
|
|
GB.ReturnNewZeroString(TO_UTF8(COMBOBOX->currentText()));
|
|
|
|
else
|
|
|
|
{
|
|
|
|
QString text = QSTRING_PROP();
|
2010-07-31 00:19:15 +00:00
|
|
|
combo_set_text(THIS, text);
|
2009-01-03 22:24:02 +00:00
|
|
|
}
|
2008-04-24 12:49:12 +00:00
|
|
|
|
|
|
|
END_PROPERTY
|
|
|
|
|
|
|
|
|
|
|
|
BEGIN_PROPERTY(CCOMBOBOX_length)
|
|
|
|
|
2009-01-03 22:24:02 +00:00
|
|
|
GB.ReturnInteger(COMBOBOX->currentText().length());
|
2008-04-24 12:49:12 +00:00
|
|
|
|
|
|
|
END_PROPERTY
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
BEGIN_PROPERTY(CCOMBOBOX_read_only)
|
|
|
|
|
2009-01-03 22:24:02 +00:00
|
|
|
if (READ_PROPERTY)
|
|
|
|
GB.ReturnBoolean(!COMBOBOX->isEditable());
|
|
|
|
else
|
|
|
|
combo_set_editable(_object, !VPROP(GB_BOOLEAN));
|
2008-04-24 12:49:12 +00:00
|
|
|
|
|
|
|
END_PROPERTY
|
|
|
|
|
|
|
|
|
|
|
|
BEGIN_METHOD(CCOMBOBOX_get, GB_INTEGER index)
|
|
|
|
|
2009-01-03 22:24:02 +00:00
|
|
|
int index = VARG(index);
|
2008-04-24 12:49:12 +00:00
|
|
|
|
2009-01-03 22:24:02 +00:00
|
|
|
if (index < 0 || index >= (int)COMBOBOX->count())
|
|
|
|
{
|
|
|
|
GB.Error("Bad index");
|
|
|
|
return;
|
|
|
|
}
|
2008-04-24 12:49:12 +00:00
|
|
|
|
2009-01-03 22:24:02 +00:00
|
|
|
THIS->index = index;
|
2008-04-24 12:49:12 +00:00
|
|
|
|
2009-01-03 22:24:02 +00:00
|
|
|
RETURN_SELF();
|
2008-04-24 12:49:12 +00:00
|
|
|
|
|
|
|
END_METHOD
|
|
|
|
|
|
|
|
|
|
|
|
BEGIN_PROPERTY(CCOMBOBOX_item_text)
|
|
|
|
|
2009-01-03 22:24:02 +00:00
|
|
|
if (READ_PROPERTY)
|
|
|
|
GB.ReturnNewZeroString(TO_UTF8(COMBOBOX->itemText(THIS->index)));
|
|
|
|
else
|
|
|
|
{
|
|
|
|
COMBOBOX->blockSignals(true);
|
|
|
|
COMBOBOX->setItemText(THIS->index, QSTRING_PROP());
|
2009-08-04 23:58:51 +00:00
|
|
|
COMBOBOX->setDirty();
|
2009-01-03 22:24:02 +00:00
|
|
|
COMBOBOX->blockSignals(false);
|
|
|
|
}
|
2008-04-24 12:49:12 +00:00
|
|
|
|
|
|
|
END_PROPERTY
|
|
|
|
|
|
|
|
|
|
|
|
BEGIN_METHOD(CCOMBOBOX_add, GB_STRING item; GB_INTEGER pos)
|
|
|
|
|
|
|
|
int index;
|
2008-04-29 13:40:55 +00:00
|
|
|
int pos = VARGOPT(pos, -1);
|
2008-04-24 12:49:12 +00:00
|
|
|
|
2010-03-10 21:51:36 +00:00
|
|
|
COMBOBOX->blockSignals(true);
|
2010-03-07 17:14:54 +00:00
|
|
|
index = combo_get_current_item(THIS);
|
|
|
|
|
2010-03-10 21:51:36 +00:00
|
|
|
if (pos < 0 || pos >= COMBOBOX->count())
|
|
|
|
pos = -1;
|
2009-01-03 22:24:02 +00:00
|
|
|
|
|
|
|
if (pos < 0)
|
|
|
|
COMBOBOX->addItem(QSTRING_ARG(item));
|
|
|
|
else
|
|
|
|
COMBOBOX->insertItem(pos, QSTRING_ARG(item));
|
2010-03-07 17:14:54 +00:00
|
|
|
|
2009-08-04 23:58:51 +00:00
|
|
|
COMBOBOX->setDirty();
|
2008-04-24 12:49:12 +00:00
|
|
|
|
2010-03-07 17:14:54 +00:00
|
|
|
if (index >= 0)
|
|
|
|
combo_set_current_item(THIS, index);
|
|
|
|
else
|
|
|
|
combo_set_current_item(THIS, 0);
|
|
|
|
|
2010-03-10 21:51:36 +00:00
|
|
|
COMBOBOX->blockSignals(false);
|
2010-03-07 17:14:54 +00:00
|
|
|
|
2008-04-24 12:49:12 +00:00
|
|
|
END_METHOD
|
|
|
|
|
|
|
|
|
|
|
|
BEGIN_METHOD(CCOMBOBOX_remove, GB_INTEGER pos)
|
|
|
|
|
2009-01-03 22:24:02 +00:00
|
|
|
COMBOBOX->blockSignals(true);
|
|
|
|
COMBOBOX->removeItem(VARG(pos));
|
2009-08-04 23:58:51 +00:00
|
|
|
COMBOBOX->setDirty();
|
2009-01-03 22:24:02 +00:00
|
|
|
COMBOBOX->blockSignals(false);
|
2008-04-24 12:49:12 +00:00
|
|
|
|
|
|
|
END_METHOD
|
|
|
|
|
|
|
|
|
|
|
|
BEGIN_PROPERTY(CCOMBOBOX_sorted)
|
|
|
|
|
2009-01-03 22:24:02 +00:00
|
|
|
if (READ_PROPERTY)
|
2009-08-04 23:58:51 +00:00
|
|
|
GB.ReturnBoolean(COMBOBOX->isSortingEnabled());
|
2009-01-03 22:24:02 +00:00
|
|
|
else
|
2009-08-04 23:58:51 +00:00
|
|
|
COMBOBOX->setSortingEnabled(VPROP(GB_BOOLEAN));
|
2008-04-24 12:49:12 +00:00
|
|
|
|
|
|
|
END_METHOD
|
|
|
|
|
|
|
|
|
|
|
|
BEGIN_PROPERTY(CCOMBOBOX_count)
|
|
|
|
|
2009-01-03 22:24:02 +00:00
|
|
|
GB.ReturnInteger(COMBOBOX->count());
|
2008-04-24 12:49:12 +00:00
|
|
|
|
|
|
|
END_PROPERTY
|
|
|
|
|
|
|
|
|
|
|
|
BEGIN_PROPERTY(CCOMBOBOX_index)
|
|
|
|
|
2010-03-10 21:51:36 +00:00
|
|
|
if (READ_PROPERTY)
|
|
|
|
GB.ReturnInteger(combo_get_current_item(THIS));
|
|
|
|
else
|
|
|
|
combo_set_current_item(THIS, VPROP(GB_INTEGER));
|
2008-04-24 12:49:12 +00:00
|
|
|
|
|
|
|
END_PROPERTY
|
|
|
|
|
|
|
|
|
|
|
|
BEGIN_PROPERTY(CCOMBOBOX_current)
|
|
|
|
|
2010-03-10 21:51:36 +00:00
|
|
|
THIS->index = combo_get_current_item(THIS);
|
2008-04-24 12:49:12 +00:00
|
|
|
|
2009-01-03 22:24:02 +00:00
|
|
|
if (THIS->index < 0)
|
|
|
|
GB.ReturnNull();
|
|
|
|
else
|
|
|
|
RETURN_SELF();
|
2008-04-24 12:49:12 +00:00
|
|
|
|
|
|
|
END_PROPERTY
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
BEGIN_PROPERTY(CCOMBOBOX_mouse)
|
|
|
|
|
2009-01-03 22:24:02 +00:00
|
|
|
if (READ_PROPERTY)
|
|
|
|
GB.ReturnInteger(COMBOBOX->cursor().shape());
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (COMBOBOX->editable())
|
|
|
|
COMBOBOX->lineEdit()->setCursor(PROPERTY(int));
|
2008-04-24 12:49:12 +00:00
|
|
|
|
2009-01-03 22:24:02 +00:00
|
|
|
COMBOBOX->setCursor(PROPERTY(int));
|
|
|
|
}
|
2008-04-24 12:49:12 +00:00
|
|
|
|
|
|
|
END_METHOD
|
|
|
|
*/
|
|
|
|
|
|
|
|
BEGIN_METHOD(CCOMBOBOX_find, GB_STRING item)
|
|
|
|
|
2010-03-10 21:51:36 +00:00
|
|
|
GB.ReturnInteger(combo_find_item(THIS, QSTRING_ARG(item)));
|
2008-04-24 12:49:12 +00:00
|
|
|
|
|
|
|
END_METHOD
|
|
|
|
|
|
|
|
|
|
|
|
BEGIN_PROPERTY(CCOMBOBOX_list)
|
|
|
|
|
2010-03-10 21:51:36 +00:00
|
|
|
GB_ARRAY array;
|
|
|
|
|
|
|
|
if (READ_PROPERTY)
|
|
|
|
{
|
|
|
|
GB.Array.New(&array, GB_T_STRING, COMBOBOX->count());
|
|
|
|
combo_get_list(THIS, array);
|
|
|
|
GB.ReturnObject(array);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
combo_set_list(THIS, (GB_ARRAY)VPROP(GB_OBJECT));
|
2008-04-24 12:49:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
END_PROPERTY
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***************************************************************************
|
|
|
|
|
2009-01-03 22:24:02 +00:00
|
|
|
class MyComboBox
|
2008-04-24 12:49:12 +00:00
|
|
|
|
|
|
|
***************************************************************************/
|
|
|
|
|
|
|
|
MyComboBox::MyComboBox(QWidget *parent) :
|
2009-01-03 22:24:02 +00:00
|
|
|
QComboBox(parent)
|
2008-04-24 12:49:12 +00:00
|
|
|
{
|
2009-08-04 23:58:51 +00:00
|
|
|
_sorted = _dirty = false;
|
2010-05-08 20:17:29 +00:00
|
|
|
setCompleter(0);
|
|
|
|
setInsertPolicy(NoInsert);
|
2009-01-03 22:24:02 +00:00
|
|
|
calcMinimumHeight();
|
2008-04-24 12:49:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-04-29 13:40:55 +00:00
|
|
|
void MyComboBox::changeEvent(QEvent *e)
|
2008-04-24 12:49:12 +00:00
|
|
|
{
|
2008-04-29 13:40:55 +00:00
|
|
|
QComboBox::changeEvent(e);
|
2009-07-15 02:53:18 +00:00
|
|
|
if (e->type() == QEvent::FontChange || e->type() == QEvent::StyleChange)
|
2009-01-03 22:24:02 +00:00
|
|
|
calcMinimumHeight();
|
2008-04-24 12:49:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void MyComboBox::calcMinimumHeight()
|
|
|
|
{
|
2009-01-03 22:24:02 +00:00
|
|
|
QFontMetrics fm = fontMetrics();
|
2008-04-24 12:49:12 +00:00
|
|
|
|
2009-01-03 22:24:02 +00:00
|
|
|
if (isEditable())
|
|
|
|
setMinimumHeight(fm.lineSpacing() + height() - lineEdit()->height());
|
|
|
|
else
|
|
|
|
setMinimumHeight(fm.lineSpacing() + 2);
|
2008-04-24 12:49:12 +00:00
|
|
|
}
|
|
|
|
|
2010-03-07 17:14:54 +00:00
|
|
|
void MyComboBox::sort()
|
2009-08-04 23:58:51 +00:00
|
|
|
{
|
|
|
|
if (_sorted && _dirty)
|
|
|
|
{
|
|
|
|
model()->sort(0);
|
|
|
|
_dirty = false;
|
|
|
|
}
|
2010-03-07 17:14:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void MyComboBox::showPopup()
|
|
|
|
{
|
|
|
|
sort();
|
2009-08-04 23:58:51 +00:00
|
|
|
QComboBox::showPopup();
|
|
|
|
}
|
|
|
|
|
2008-04-24 12:49:12 +00:00
|
|
|
/***************************************************************************
|
|
|
|
|
2009-01-03 22:24:02 +00:00
|
|
|
class CTextBox
|
2008-04-24 12:49:12 +00:00
|
|
|
|
|
|
|
***************************************************************************/
|
|
|
|
|
|
|
|
CTextBox CTextBox::manager;
|
|
|
|
|
2008-04-30 23:08:02 +00:00
|
|
|
void CTextBox::onChange(void)
|
2008-04-24 12:49:12 +00:00
|
|
|
{
|
2009-01-03 22:24:02 +00:00
|
|
|
RAISE_EVENT(EVENT_Change);
|
2008-04-24 12:49:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-04-30 23:08:02 +00:00
|
|
|
void CTextBox::onActivate(void)
|
2008-04-24 12:49:12 +00:00
|
|
|
{
|
2009-01-03 22:24:02 +00:00
|
|
|
RAISE_EVENT(EVENT_Activate);
|
2008-04-24 12:49:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-04-30 23:08:02 +00:00
|
|
|
void CTextBox::onClick()
|
2008-04-24 12:49:12 +00:00
|
|
|
{
|
2010-03-10 21:51:36 +00:00
|
|
|
GET_SENDER();
|
|
|
|
raise_click_event(THIS);
|
2008-04-24 12:49:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***************************************************************************
|
|
|
|
|
2009-01-03 22:24:02 +00:00
|
|
|
Descriptions
|
2008-04-24 12:49:12 +00:00
|
|
|
|
|
|
|
***************************************************************************/
|
|
|
|
|
|
|
|
GB_DESC CTextBoxSelectionDesc[] =
|
|
|
|
{
|
2011-08-21 21:46:20 +00:00
|
|
|
GB_DECLARE(".TextBox.Selection", 0), GB_VIRTUAL_CLASS(),
|
2008-04-24 12:49:12 +00:00
|
|
|
|
2009-01-03 22:24:02 +00:00
|
|
|
GB_PROPERTY("Text", "s", CTEXTBOX_sel_text),
|
|
|
|
GB_PROPERTY_READ("Length", "i", CTEXTBOX_sel_length),
|
|
|
|
GB_PROPERTY_READ("Start", "i", CTEXTBOX_sel_start),
|
|
|
|
GB_PROPERTY_READ("Pos", "i", CTEXTBOX_sel_start),
|
2008-04-24 12:49:12 +00:00
|
|
|
|
2009-01-03 22:24:02 +00:00
|
|
|
GB_METHOD("Hide", NULL, CTEXTBOX_sel_clear, NULL),
|
2008-04-24 12:49:12 +00:00
|
|
|
|
2009-01-03 22:24:02 +00:00
|
|
|
GB_END_DECLARE
|
2008-04-24 12:49:12 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
GB_DESC CTextBoxDesc[] =
|
|
|
|
{
|
2009-01-03 22:24:02 +00:00
|
|
|
GB_DECLARE("TextBox", sizeof(CTEXTBOX)), GB_INHERITS("Control"),
|
2008-04-24 12:49:12 +00:00
|
|
|
|
2009-01-03 22:24:02 +00:00
|
|
|
GB_METHOD("_new", NULL, CTEXTBOX_new, "(Parent)Container;"),
|
2008-04-24 12:49:12 +00:00
|
|
|
|
2009-01-03 22:24:02 +00:00
|
|
|
GB_PROPERTY("Text", "s", CTEXTBOX_text),
|
|
|
|
GB_PROPERTY("Alignment", "i", CTEXTBOX_alignment),
|
|
|
|
GB_PROPERTY_READ("Length", "i", CTEXTBOX_length),
|
|
|
|
GB_PROPERTY("Pos", "i", CTEXTBOX_pos),
|
|
|
|
GB_PROPERTY("ReadOnly", "b", CTEXTBOX_read_only),
|
|
|
|
GB_PROPERTY("Border", "b", CTEXTBOX_border),
|
|
|
|
GB_PROPERTY("Password", "b", CTEXTBOX_password),
|
|
|
|
GB_PROPERTY("MaxLength", "i", CTEXTBOX_max_length),
|
2008-04-24 12:49:12 +00:00
|
|
|
|
2011-08-21 21:46:20 +00:00
|
|
|
GB_PROPERTY_SELF("Selection", ".TextBox.Selection"),
|
2009-01-03 22:24:02 +00:00
|
|
|
GB_METHOD("Select", NULL, CTEXTBOX_sel_select, "[(Start)i(Length)i]"),
|
|
|
|
GB_METHOD("SelectAll", NULL, CTEXTBOX_sel_all, NULL),
|
|
|
|
GB_METHOD("Unselect", NULL, CTEXTBOX_sel_clear, NULL),
|
|
|
|
GB_PROPERTY_READ("Selected", "b", CTEXTBOX_selected),
|
2008-04-24 12:49:12 +00:00
|
|
|
|
2009-01-03 22:24:02 +00:00
|
|
|
GB_METHOD("Clear", NULL, CTEXTBOX_clear, NULL),
|
|
|
|
GB_METHOD("Insert", NULL, CTEXTBOX_insert, "(Text)s"),
|
2008-04-24 12:49:12 +00:00
|
|
|
|
2009-01-03 22:24:02 +00:00
|
|
|
GB_EVENT("Change", NULL, NULL, &EVENT_Change),
|
|
|
|
GB_EVENT("Activate", NULL, NULL, &EVENT_Activate),
|
2008-04-24 12:49:12 +00:00
|
|
|
|
|
|
|
TEXTBOX_DESCRIPTION,
|
|
|
|
|
2009-01-03 22:24:02 +00:00
|
|
|
GB_END_DECLARE
|
2008-04-24 12:49:12 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
GB_DESC CComboBoxItemDesc[] =
|
|
|
|
{
|
2011-08-21 21:46:20 +00:00
|
|
|
GB_DECLARE(".ComboBox.Item", 0), GB_VIRTUAL_CLASS(),
|
2008-04-24 12:49:12 +00:00
|
|
|
|
2009-01-03 22:24:02 +00:00
|
|
|
GB_PROPERTY("Text", "s", CCOMBOBOX_item_text),
|
2008-04-24 12:49:12 +00:00
|
|
|
|
2009-01-03 22:24:02 +00:00
|
|
|
GB_END_DECLARE
|
2008-04-24 12:49:12 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
GB_DESC CComboBoxDesc[] =
|
|
|
|
{
|
2009-01-03 22:24:02 +00:00
|
|
|
GB_DECLARE("ComboBox", sizeof(CCOMBOBOX)), GB_INHERITS("Control"),
|
2008-04-24 12:49:12 +00:00
|
|
|
|
2009-01-03 22:24:02 +00:00
|
|
|
GB_METHOD("_new", NULL, CCOMBOBOX_new, "(Parent)Container;"),
|
2011-08-21 21:46:20 +00:00
|
|
|
GB_METHOD("_get", ".ComboBox.Item", CCOMBOBOX_get, "(Index)i"),
|
2008-04-24 12:49:12 +00:00
|
|
|
|
2009-01-03 22:24:02 +00:00
|
|
|
GB_PROPERTY("Text", "s", CCOMBOBOX_text),
|
|
|
|
GB_PROPERTY_READ("Length", "i", CCOMBOBOX_length),
|
|
|
|
GB_PROPERTY("Pos", "i", CTEXTBOX_pos),
|
|
|
|
GB_PROPERTY("ReadOnly", "b", CCOMBOBOX_read_only),
|
|
|
|
GB_PROPERTY("Password", "b", CTEXTBOX_password),
|
|
|
|
GB_PROPERTY("MaxLength", "i", CTEXTBOX_max_length),
|
2008-04-24 12:49:12 +00:00
|
|
|
|
2011-08-21 21:46:20 +00:00
|
|
|
GB_PROPERTY_SELF("Selection", ".TextBox.Selection"),
|
2009-01-03 22:24:02 +00:00
|
|
|
GB_METHOD("Select", NULL, CTEXTBOX_sel_select, "[(Start)i(Length)i]"),
|
|
|
|
GB_METHOD("SelectAll", NULL, CTEXTBOX_sel_all, NULL),
|
|
|
|
GB_METHOD("Unselect", NULL, CTEXTBOX_sel_clear, NULL),
|
|
|
|
GB_PROPERTY_READ("Selected", "b", CTEXTBOX_selected),
|
2008-04-24 12:49:12 +00:00
|
|
|
|
2009-01-03 22:24:02 +00:00
|
|
|
GB_METHOD("Popup", NULL, CCOMBOBOX_popup, NULL),
|
|
|
|
GB_METHOD("Clear", NULL, CCOMBOBOX_clear, NULL),
|
|
|
|
GB_METHOD("Insert", NULL, CTEXTBOX_insert, "(Text)s"),
|
2008-04-24 12:49:12 +00:00
|
|
|
|
2009-01-03 22:24:02 +00:00
|
|
|
GB_METHOD("Add", NULL, CCOMBOBOX_add, "(Item)s[(Index)i]"),
|
|
|
|
GB_METHOD("Remove", NULL, CCOMBOBOX_remove, "(Index)i"),
|
2008-04-24 12:49:12 +00:00
|
|
|
|
2009-01-03 22:24:02 +00:00
|
|
|
GB_METHOD("Find", "i", CCOMBOBOX_find, "(Item)s"),
|
2008-04-24 12:49:12 +00:00
|
|
|
|
2009-01-03 22:24:02 +00:00
|
|
|
GB_PROPERTY("Sorted", "b", CCOMBOBOX_sorted),
|
2008-04-24 12:49:12 +00:00
|
|
|
|
2009-01-03 22:24:02 +00:00
|
|
|
GB_PROPERTY("List", "String[]", CCOMBOBOX_list),
|
|
|
|
//GB_PROPERTY("Contents", "s", CCOMBOBOX_list),
|
2008-04-24 12:49:12 +00:00
|
|
|
|
2009-01-03 22:24:02 +00:00
|
|
|
GB_PROPERTY_READ("Count", "i", CCOMBOBOX_count),
|
2011-08-21 21:46:20 +00:00
|
|
|
GB_PROPERTY_READ("Current", ".ComboBox.Item", CCOMBOBOX_current),
|
2009-01-03 22:24:02 +00:00
|
|
|
GB_PROPERTY("Index", "i", CCOMBOBOX_index),
|
2008-04-24 12:49:12 +00:00
|
|
|
|
2009-01-03 22:24:02 +00:00
|
|
|
GB_EVENT("Change", NULL, NULL, &EVENT_Change),
|
|
|
|
GB_EVENT("Activate", NULL, NULL, &EVENT_Activate),
|
|
|
|
GB_EVENT("Click", NULL, NULL, &EVENT_Click),
|
2008-04-24 12:49:12 +00:00
|
|
|
|
|
|
|
COMBOBOX_DESCRIPTION,
|
|
|
|
|
2009-01-03 22:24:02 +00:00
|
|
|
GB_END_DECLARE
|
2008-04-24 12:49:12 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|