2022-02-27 10:07:34 -08:00
|
|
|
# Copyright (C) 2007-2022 various contributors (see AUTHORS)
|
2013-02-17 11:35:20 -08:00
|
|
|
#
|
|
|
|
# This file is part of Python-EFL.
|
|
|
|
#
|
|
|
|
# Python-EFL is free software; you can redistribute it and/or
|
|
|
|
# modify it under the terms of the GNU Lesser General Public
|
|
|
|
# License as published by the Free Software Foundation; either
|
2013-12-07 08:54:58 -08:00
|
|
|
# version 3 of the License, or (at your option) any later version.
|
2013-02-17 11:35:20 -08:00
|
|
|
#
|
|
|
|
# Python-EFL 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
|
|
|
|
# Lesser General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU Lesser General Public License
|
|
|
|
# along with this Python-EFL. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
2015-05-07 11:33:14 -07:00
|
|
|
include "table_cdef.pxi"
|
2013-02-17 11:35:20 -08:00
|
|
|
|
|
|
|
cdef class Table(Object):
|
|
|
|
"""
|
|
|
|
|
2013-04-04 08:00:45 -07:00
|
|
|
This is the class that actually implement the widget.
|
2013-02-17 11:35:20 -08:00
|
|
|
|
|
|
|
"""
|
|
|
|
|
2013-10-25 07:38:01 -07:00
|
|
|
def __init__(self, evasObject parent, *args, **kwargs):
|
2021-11-17 21:25:19 -08:00
|
|
|
"""
|
2015-01-03 11:17:24 -08:00
|
|
|
|
|
|
|
:param parent: The parent object
|
|
|
|
:type parent: :py:class:`efl.evas.Object`
|
|
|
|
:param \**kwargs: All the remaining keyword arguments are interpreted
|
|
|
|
as properties of the instance
|
|
|
|
|
|
|
|
"""
|
2013-02-17 11:35:20 -08:00
|
|
|
self._set_obj(elm_table_add(parent.obj))
|
2013-10-25 07:38:01 -07:00
|
|
|
self._set_properties_from_keyword_args(kwargs)
|
2013-02-17 11:35:20 -08:00
|
|
|
|
|
|
|
property homogeneous:
|
|
|
|
"""The homogeneous layout in the table
|
|
|
|
|
|
|
|
:type: bool
|
|
|
|
|
|
|
|
"""
|
|
|
|
def __get__(self):
|
|
|
|
return elm_table_homogeneous_get(self.obj)
|
|
|
|
|
|
|
|
def __set__(self, homogeneous):
|
|
|
|
elm_table_homogeneous_set(self.obj, homogeneous)
|
|
|
|
|
|
|
|
def homogeneous_set(self, homogeneous):
|
|
|
|
elm_table_homogeneous_set(self.obj, homogeneous)
|
|
|
|
def homogeneous_get(self):
|
|
|
|
return elm_table_homogeneous_get(self.obj)
|
|
|
|
|
|
|
|
property padding:
|
|
|
|
"""Padding between cells.
|
|
|
|
|
2015-01-17 08:47:58 -08:00
|
|
|
Default value is (0, 0).
|
2013-02-17 11:35:20 -08:00
|
|
|
|
|
|
|
:type: (int, int)
|
|
|
|
|
|
|
|
"""
|
|
|
|
def __get__(self):
|
|
|
|
cdef Evas_Coord horizontal, vertical
|
|
|
|
elm_table_padding_get(self.obj, &horizontal, &vertical)
|
|
|
|
return (horizontal, vertical)
|
|
|
|
|
|
|
|
def __set__(self, value):
|
|
|
|
horizontal, vertical = value
|
|
|
|
elm_table_padding_set(self.obj, horizontal, vertical)
|
|
|
|
|
|
|
|
def padding_set(self, horizontal, vertical):
|
|
|
|
elm_table_padding_set(self.obj, horizontal, vertical)
|
|
|
|
def padding_get(self):
|
|
|
|
cdef Evas_Coord horizontal, vertical
|
|
|
|
elm_table_padding_get(self.obj, &horizontal, &vertical)
|
|
|
|
return (horizontal, vertical)
|
|
|
|
|
2015-01-17 08:47:58 -08:00
|
|
|
property align:
|
|
|
|
"""The alignment of the table
|
|
|
|
|
|
|
|
Default value is (0.5, 0.5)
|
|
|
|
|
2015-03-05 04:19:48 -08:00
|
|
|
:type: (float **horizontal**, float **vertical**)
|
2015-01-17 08:47:58 -08:00
|
|
|
|
|
|
|
.. versionadded:: 1.13
|
|
|
|
|
|
|
|
"""
|
|
|
|
def __get__(self):
|
|
|
|
cdef double horizontal, vertical
|
|
|
|
elm_table_align_get(self.obj, &horizontal, &vertical)
|
|
|
|
return (horizontal, vertical)
|
|
|
|
|
|
|
|
def __set__(self, value):
|
|
|
|
horizontal, vertical = value
|
|
|
|
elm_table_align_set(self.obj, horizontal, vertical)
|
|
|
|
|
|
|
|
def align_set(self, horizontal, vertical):
|
|
|
|
elm_table_align_set(self.obj, horizontal, vertical)
|
|
|
|
def align_get(self):
|
|
|
|
cdef double horizontal, vertical
|
|
|
|
elm_table_align_get(self.obj, &horizontal, &vertical)
|
|
|
|
return (horizontal, vertical)
|
|
|
|
|
2013-02-17 11:35:20 -08:00
|
|
|
def pack(self, evasObject subobj, x, y, w, h):
|
2014-04-06 09:38:54 -07:00
|
|
|
"""Add a subobject on the table with the coordinates passed
|
2013-02-17 11:35:20 -08:00
|
|
|
|
|
|
|
.. note:: All positioning inside the table is relative to rows and
|
|
|
|
columns, so a value of 0 for x and y, means the top left cell of
|
|
|
|
the table, and a value of 1 for w and h means ``subobj`` only
|
|
|
|
takes that 1 cell.
|
|
|
|
|
|
|
|
:param subobj: The subobject to be added to the table
|
2013-12-04 22:29:55 -08:00
|
|
|
:type subobj: :py:class:`~efl.evas.Object`
|
2013-02-17 11:35:20 -08:00
|
|
|
:param x: Row number
|
|
|
|
:type x: int
|
|
|
|
:param y: Column number
|
|
|
|
:type y: int
|
|
|
|
:param w: colspan
|
|
|
|
:type w: int
|
|
|
|
:param h: rowspan
|
|
|
|
:type h: int
|
|
|
|
|
|
|
|
"""
|
|
|
|
elm_table_pack(self.obj, subobj.obj, x, y, w, h)
|
|
|
|
|
|
|
|
def unpack(self, evasObject subobj):
|
2014-04-06 09:38:54 -07:00
|
|
|
"""Remove child from table.
|
2013-02-17 11:35:20 -08:00
|
|
|
|
|
|
|
:param subobj: The subobject
|
2013-12-04 22:29:55 -08:00
|
|
|
:type subobj: :py:class:`~efl.evas.Object`
|
2013-02-17 11:35:20 -08:00
|
|
|
|
|
|
|
"""
|
|
|
|
elm_table_unpack(self.obj, subobj.obj)
|
|
|
|
|
|
|
|
def clear(self, clear):
|
2014-04-06 09:38:54 -07:00
|
|
|
"""Faster way to remove all child objects from a table object.
|
2013-02-17 11:35:20 -08:00
|
|
|
|
|
|
|
:param clear: If True, will delete children, else just remove from table.
|
|
|
|
:type clear: bool
|
|
|
|
|
|
|
|
"""
|
|
|
|
elm_table_clear(self.obj, clear)
|
|
|
|
|
2013-10-03 23:29:45 -07:00
|
|
|
def child_get(self, int col, int row):
|
2014-04-06 09:38:54 -07:00
|
|
|
"""Get child object of table at given coordinates.
|
2013-10-03 23:29:45 -07:00
|
|
|
|
|
|
|
:param int col: Column number of child object
|
|
|
|
:param int row: Row number of child object
|
|
|
|
|
|
|
|
:return: Child of object if find if not return None.
|
|
|
|
|
2013-12-06 17:34:19 -08:00
|
|
|
.. versionadded:: 1.8
|
|
|
|
|
2013-10-03 23:29:45 -07:00
|
|
|
"""
|
|
|
|
return object_from_instance(elm_table_child_get(self.obj, col, row))
|
|
|
|
|
2013-02-17 11:35:20 -08:00
|
|
|
def table_pack_set(evasObject subobj, x, y, w, h):
|
2014-04-06 09:38:54 -07:00
|
|
|
"""Set the packing location of an existing child of the table
|
2013-02-17 11:35:20 -08:00
|
|
|
|
|
|
|
Modifies the position of an object already in the table.
|
|
|
|
|
|
|
|
.. note:: All positioning inside the table is relative to rows and
|
|
|
|
columns, so a value of 0 for x and y, means the top left cell of
|
|
|
|
the table, and a value of 1 for w and h means ``subobj`` only
|
|
|
|
takes that 1 cell.
|
|
|
|
|
|
|
|
:param subobj: The subobject to be modified in the table
|
2013-12-04 22:29:55 -08:00
|
|
|
:type subobj: :py:class:`~efl.evas.Object`
|
2013-02-17 11:35:20 -08:00
|
|
|
:param x: Row number
|
|
|
|
:type x: int
|
|
|
|
:param y: Column number
|
|
|
|
:type y: int
|
|
|
|
:param w: rowspan
|
|
|
|
:type w: int
|
|
|
|
:param h: colspan
|
|
|
|
:type h: int
|
|
|
|
|
|
|
|
"""
|
|
|
|
elm_table_pack_set(subobj.obj, x, y, w, h)
|
|
|
|
|
|
|
|
def table_pack_get(evasObject subobj):
|
2014-04-06 09:38:54 -07:00
|
|
|
"""Get the packing location of an existing child of the table
|
2013-02-17 11:35:20 -08:00
|
|
|
|
|
|
|
.. seealso:: :py:func:`table_pack_set`
|
|
|
|
|
|
|
|
:param subobj: The subobject to be modified in the table
|
2013-12-04 22:29:55 -08:00
|
|
|
:type subobj: :py:class:`~efl.evas.Object`
|
2013-02-17 11:35:20 -08:00
|
|
|
:return: Row number, Column number, rowspan, colspan
|
|
|
|
:rtype: tuple of ints
|
|
|
|
|
|
|
|
"""
|
|
|
|
cdef int x, y, w, h
|
|
|
|
elm_table_pack_get(subobj.obj, &x, &y, &w, &h)
|
|
|
|
return (x, y, w, h)
|
|
|
|
|
2016-12-28 05:11:48 -08:00
|
|
|
_object_mapping_register("Elm.Table", Table)
|