gambas-source-code/gb.gtk/src/CScrollView.cpp

170 lines
4.2 KiB
C++
Raw Normal View History

/***************************************************************************
CScrollView.cpp
(c) 2004-2006 - Daniel Campos Fernández <dcamposf@gmail.com>
GTK+ component
Realizado para la Junta de Extremadura.
Consejería de Educación Ciencia y Tecnología.
Proyecto gnuLinEx
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 1, 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 __CSCROLLVIEW_CPP
#include "gambas.h"
#include "main.h"
#include "widgets.h"
#include "CConst.h"
#include "CScrollView.h"
DECLARE_EVENT(EVENT_Scroll);
void gb_raise_scrollview_Scroll(gScrollView *sender)
{
CWIDGET *_ob=GetObject(sender);
if (!_ob) return;
GB.Raise((void*)_ob,EVENT_Scroll,0);
}
/***************************************************************************
ScrollView
***************************************************************************/
BEGIN_METHOD(CSCROLLVIEW_new, GB_OBJECT parent)
CCONTAINER *Parent=(CCONTAINER*)VPROP(GB_OBJECT);
Parent=(CCONTAINER*)GetContainer ((CWIDGET*)Parent);
THIS->widget=new gScrollView(Parent->widget);
InitControl(THIS->widget,(CWIDGET*)THIS);
SCROLLVIEW->onScroll=gb_raise_scrollview_Scroll;
END_METHOD
BEGIN_PROPERTY(CSCROLLVIEW_scroll_x)
if (READ_PROPERTY) { GB.ReturnInteger(SCROLLVIEW->scrollX()); return; }
SCROLLVIEW->setScrollX(VPROP(GB_INTEGER));
END_PROPERTY
BEGIN_PROPERTY(CSCROLLVIEW_scroll_y)
if (READ_PROPERTY) { GB.ReturnInteger(SCROLLVIEW->scrollY()); return; }
SCROLLVIEW->setScrollY(VPROP(GB_INTEGER));
END_PROPERTY
BEGIN_PROPERTY(CSCROLLVIEW_scroll_w)
GB.ReturnInteger(SCROLLVIEW->scrollWidth());
END_PROPERTY
BEGIN_PROPERTY(CSCROLLVIEW_scroll_h)
GB.ReturnInteger(SCROLLVIEW->scrollHeight());
END_PROPERTY
BEGIN_METHOD(CSCROLLVIEW_scroll, GB_INTEGER x; GB_INTEGER y)
SCROLLVIEW->scroll(VARG(x),VARG(y));
END_METHOD
BEGIN_PROPERTY(CSCROLLVIEW_scrollbar)
if (READ_PROPERTY) { GB.ReturnInteger(SCROLLVIEW->scrollBar()); return; }
SCROLLVIEW->setScrollBar(VPROP(GB_INTEGER));
END_PROPERTY
BEGIN_PROPERTY(CSCROLLVIEW_border)
if (READ_PROPERTY) { GB.ReturnBoolean(SCROLLVIEW->hasBorder()); return; }
SCROLLVIEW->setBorder(VPROP(GB_BOOLEAN));
END_PROPERTY
BEGIN_METHOD(CSCROLLVIEW_ensure_visible, GB_INTEGER x; GB_INTEGER y; GB_INTEGER w; GB_INTEGER h)
long w=VARG(w);
long h=VARG(h);
long x=VARG(x);
long y=VARG(y);
SCROLLVIEW->ensureVisible(x,y,w,h);
END_METHOD
/***************************************************************************
Descriptions
***************************************************************************/
DECLARE_METHOD(CWIDGET_border);
GB_DESC CScrollViewDesc[] =
{
GB_DECLARE("ScrollView", sizeof(CSCROLLVIEW)), GB_INHERITS("Container"),
******** Merged /branches/64bits r918:1003 into /trunk [CONFIGURATION] * NEW: 64 bits port. [EXAMPLES] * BUG: Fixed the AnalogWatch example. [WIKI CGI SCRIPT] * NEW: Some little cosmetic changes. [INTERPRETER] * NEW: The extern function implementation has been redesigned and is now based on libffi, so that it works on 64 bits system. Because of a flaw in the compiler design, projects that use the Pointer datatype must be recompiled to be used on a 64 bits system. This flaw will be fixed in Gambas 3. * OPT: Put some tables into read-only memory. About 1000 bytes are saved for each running interpreter, except the first one. * BUG: Does not crash anymore if a component cannot be loaded. * NEW: Spanish translation updated. * NEW: A new interpreter API for returning a pointer. [COMPILER] * BUG: Correctly compiles LONG constants inside code. [GB.DEBUG] * BUG: Compiles and links the gb.debug components with the thread libraries. [GB.DB.SQLITE3] * BUG: Getting the primary index of a table without primary index is safe now. [GB.GTK] * BUG: Modified the GLib priority of watched descriptors, as the main loop could enter in a loop in which user interface events were not managed. * BUG: Message boxes use application title without crashing now. [GB.OPENGL] * BUG: Disable dead code. [GB.QT.EXT] * BUG: TextEdit.TextWidth and TextEdit.TextHeight were not declared as read-only properties. [GB.XML.XSLT] * BUG: XSLT class is now declared as being not creatable. git-svn-id: svn://localhost/gambas/trunk@1006 867c0c6c-44f3-4631-809d-bfa615b0a4ec
2008-01-17 21:39:26 +00:00
GB_METHOD("_new", 0, CSCROLLVIEW_new, "(Parent)Container;"),
GB_PROPERTY("ScrollBar", "i", CSCROLLVIEW_scrollbar),
GB_PROPERTY("Border", "b", CSCROLLVIEW_border),
GB_PROPERTY("ScrollX", "i", CSCROLLVIEW_scroll_x),
GB_PROPERTY("ScrollY", "i", CSCROLLVIEW_scroll_y),
GB_PROPERTY_READ("ScrollW", "i", CSCROLLVIEW_scroll_w),
GB_PROPERTY_READ("ScrollWidth", "i", CSCROLLVIEW_scroll_w),
GB_PROPERTY_READ("ScrollH", "i", CSCROLLVIEW_scroll_h),
GB_PROPERTY_READ("ScrollHeight", "i", CSCROLLVIEW_scroll_h),
GB_PROPERTY("Spacing", "i", CCONTAINER_spacing),
GB_PROPERTY("Padding", "i", CCONTAINER_padding),
GB_PROPERTY("Arrangement", "i", CCONTAINER_arrangement),
******** Merged /branches/64bits r918:1003 into /trunk [CONFIGURATION] * NEW: 64 bits port. [EXAMPLES] * BUG: Fixed the AnalogWatch example. [WIKI CGI SCRIPT] * NEW: Some little cosmetic changes. [INTERPRETER] * NEW: The extern function implementation has been redesigned and is now based on libffi, so that it works on 64 bits system. Because of a flaw in the compiler design, projects that use the Pointer datatype must be recompiled to be used on a 64 bits system. This flaw will be fixed in Gambas 3. * OPT: Put some tables into read-only memory. About 1000 bytes are saved for each running interpreter, except the first one. * BUG: Does not crash anymore if a component cannot be loaded. * NEW: Spanish translation updated. * NEW: A new interpreter API for returning a pointer. [COMPILER] * BUG: Correctly compiles LONG constants inside code. [GB.DEBUG] * BUG: Compiles and links the gb.debug components with the thread libraries. [GB.DB.SQLITE3] * BUG: Getting the primary index of a table without primary index is safe now. [GB.GTK] * BUG: Modified the GLib priority of watched descriptors, as the main loop could enter in a loop in which user interface events were not managed. * BUG: Message boxes use application title without crashing now. [GB.OPENGL] * BUG: Disable dead code. [GB.QT.EXT] * BUG: TextEdit.TextWidth and TextEdit.TextHeight were not declared as read-only properties. [GB.XML.XSLT] * BUG: XSLT class is now declared as being not creatable. git-svn-id: svn://localhost/gambas/trunk@1006 867c0c6c-44f3-4631-809d-bfa615b0a4ec
2008-01-17 21:39:26 +00:00
GB_METHOD("Scroll", 0, CSCROLLVIEW_scroll, "(X)i(Y)i"),
GB_METHOD("EnsureVisible", 0, CSCROLLVIEW_ensure_visible, "(X)i(Y)i(Width)i(Height)i"),
******** Merged /branches/64bits r918:1003 into /trunk [CONFIGURATION] * NEW: 64 bits port. [EXAMPLES] * BUG: Fixed the AnalogWatch example. [WIKI CGI SCRIPT] * NEW: Some little cosmetic changes. [INTERPRETER] * NEW: The extern function implementation has been redesigned and is now based on libffi, so that it works on 64 bits system. Because of a flaw in the compiler design, projects that use the Pointer datatype must be recompiled to be used on a 64 bits system. This flaw will be fixed in Gambas 3. * OPT: Put some tables into read-only memory. About 1000 bytes are saved for each running interpreter, except the first one. * BUG: Does not crash anymore if a component cannot be loaded. * NEW: Spanish translation updated. * NEW: A new interpreter API for returning a pointer. [COMPILER] * BUG: Correctly compiles LONG constants inside code. [GB.DEBUG] * BUG: Compiles and links the gb.debug components with the thread libraries. [GB.DB.SQLITE3] * BUG: Getting the primary index of a table without primary index is safe now. [GB.GTK] * BUG: Modified the GLib priority of watched descriptors, as the main loop could enter in a loop in which user interface events were not managed. * BUG: Message boxes use application title without crashing now. [GB.OPENGL] * BUG: Disable dead code. [GB.QT.EXT] * BUG: TextEdit.TextWidth and TextEdit.TextHeight were not declared as read-only properties. [GB.XML.XSLT] * BUG: XSLT class is now declared as being not creatable. git-svn-id: svn://localhost/gambas/trunk@1006 867c0c6c-44f3-4631-809d-bfa615b0a4ec
2008-01-17 21:39:26 +00:00
GB_EVENT("Scroll", 0, 0, &EVENT_Scroll),
******** Merged /branches/64bits r918:1003 into /trunk [CONFIGURATION] * NEW: 64 bits port. [EXAMPLES] * BUG: Fixed the AnalogWatch example. [WIKI CGI SCRIPT] * NEW: Some little cosmetic changes. [INTERPRETER] * NEW: The extern function implementation has been redesigned and is now based on libffi, so that it works on 64 bits system. Because of a flaw in the compiler design, projects that use the Pointer datatype must be recompiled to be used on a 64 bits system. This flaw will be fixed in Gambas 3. * OPT: Put some tables into read-only memory. About 1000 bytes are saved for each running interpreter, except the first one. * BUG: Does not crash anymore if a component cannot be loaded. * NEW: Spanish translation updated. * NEW: A new interpreter API for returning a pointer. [COMPILER] * BUG: Correctly compiles LONG constants inside code. [GB.DEBUG] * BUG: Compiles and links the gb.debug components with the thread libraries. [GB.DB.SQLITE3] * BUG: Getting the primary index of a table without primary index is safe now. [GB.GTK] * BUG: Modified the GLib priority of watched descriptors, as the main loop could enter in a loop in which user interface events were not managed. * BUG: Message boxes use application title without crashing now. [GB.OPENGL] * BUG: Disable dead code. [GB.QT.EXT] * BUG: TextEdit.TextWidth and TextEdit.TextHeight were not declared as read-only properties. [GB.XML.XSLT] * BUG: XSLT class is now declared as being not creatable. git-svn-id: svn://localhost/gambas/trunk@1006 867c0c6c-44f3-4631-809d-bfa615b0a4ec
2008-01-17 21:39:26 +00:00
SCROLLVIEW_DESCRIPTION,
GB_END_DECLARE
};