11906ba89a
* NEW: Renaming a control now automatically renames the identifier in the source code. [INTERPRETER] * NEW: Split() now takes a 5th optional argument that tells if escape characters should be kept in the returned strings. * NEW: CVariant() is a new function that converts its argument into a Variant. [COMPILER] * NEW: CVariant() is a new function that converts its argument into a Variant. [GB.FORM] * NEW: SidePanel, DirChooser, FileChooser and FileView Settings property now use the new Settings storage facilities and return a Variant[]. [GB.GTK] * NEW: The Settings and Layout properties of HSplit and VSplit now return an Integer[] instead of a String. * BUG: The name property of newly created menus is correctly initialized now. [GB.QT4] * NEW: The Settings and Layout properties of HSplit and VSplit now return an Integer[] instead of a String. [GB.SETTINGS] * NEW: The settings file format has changed. Now collections and arrays can be stored and retrieved. git-svn-id: svn://localhost/gambas/trunk@2329 867c0c6c-44f3-4631-809d-bfa615b0a4ec
126 lines
2.8 KiB
C++
126 lines
2.8 KiB
C++
/***************************************************************************
|
|
|
|
CSplitter.cpp
|
|
|
|
(c) 2004-2006 - Daniel Campos Fernández <dcamposf@gmail.com>
|
|
|
|
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.
|
|
|
|
***************************************************************************/
|
|
|
|
#define __CSPLITTER_CPP
|
|
|
|
#include "CSplitter.h"
|
|
|
|
|
|
DECLARE_EVENT(EVENT_Resize);
|
|
|
|
static void send_event(CSPLITTER *_object)
|
|
{
|
|
if (!WIDGET)
|
|
return;
|
|
GB.Raise(THIS, EVENT_Resize, 0);
|
|
THIS->event = FALSE;
|
|
}
|
|
|
|
static void gb_raise_splitter_Resize(gControl *sender)
|
|
{
|
|
CWIDGET *_object = GetObject(sender);
|
|
|
|
if (THIS->event)
|
|
return;
|
|
|
|
THIS->event = true;
|
|
GB.Post((void (*)())send_event, (intptr_t)THIS);
|
|
}
|
|
|
|
BEGIN_METHOD(CHSPLIT_new, GB_OBJECT parent)
|
|
|
|
InitControl(new gSplitter(CONTAINER(VARG(parent)), false),(CWIDGET*)THIS);
|
|
WIDGET->onResize = gb_raise_splitter_Resize;
|
|
|
|
END_METHOD
|
|
|
|
|
|
BEGIN_METHOD(CVSPLIT_new, GB_OBJECT parent)
|
|
|
|
InitControl(new gSplitter(CONTAINER(VARG(parent)), true),(CWIDGET*)THIS);
|
|
WIDGET->onResize = gb_raise_splitter_Resize;
|
|
|
|
END_METHOD
|
|
|
|
|
|
BEGIN_PROPERTY(CSPLITTER_layout)
|
|
|
|
GB_ARRAY array;
|
|
|
|
if (READ_PROPERTY)
|
|
{
|
|
GB.Array.New(&array, GB_T_INTEGER, WIDGET->layoutCount());
|
|
WIDGET->getLayout((int *)GB.Array.Get(array, 0));
|
|
GB.ReturnObject(array);
|
|
}
|
|
else
|
|
{
|
|
GB_ARRAY array = (GB_ARRAY)VPROP(GB_OBJECT);
|
|
|
|
if (GB.CheckObject(array))
|
|
return;
|
|
|
|
WIDGET->setLayout((int *)GB.Array.Get(array, 0), GB.Array.Count(array));
|
|
}
|
|
|
|
|
|
END_PROPERTY
|
|
|
|
|
|
GB_DESC CHSplitDesc[] =
|
|
{
|
|
GB_DECLARE("HSplit", sizeof(CSPLITTER)), GB_INHERITS("Container"),
|
|
|
|
GB_METHOD("_new", NULL, CHSPLIT_new, "(Parent)Container;"),
|
|
|
|
GB_PROPERTY("Layout", "Integer[]", CSPLITTER_layout),
|
|
GB_PROPERTY("Settings", "Integer[]", CSPLITTER_layout),
|
|
|
|
GB_EVENT("Resize", 0, 0, &EVENT_Resize),
|
|
|
|
HSPLIT_DESCRIPTION,
|
|
|
|
GB_END_DECLARE
|
|
};
|
|
|
|
|
|
GB_DESC CVSplitDesc[] =
|
|
{
|
|
GB_DECLARE("VSplit", sizeof(CSPLITTER)), GB_INHERITS("Container"),
|
|
|
|
GB_METHOD("_new", 0, CVSPLIT_new, "(Parent)Container;"),
|
|
|
|
GB_PROPERTY("Layout", "Integer[]", CSPLITTER_layout),
|
|
GB_PROPERTY("Settings", "Integer[]", CSPLITTER_layout),
|
|
|
|
GB_EVENT("Resize", 0, 0, &EVENT_Resize),
|
|
|
|
VSPLIT_DESCRIPTION,
|
|
|
|
GB_END_DECLARE
|
|
};
|
|
|
|
|
|
|
|
|
|
|