Mercurial > octave
diff libgui/graphics/Table.h @ 26112:36e0e5b428e7
Implement uitable (patch #9084)
* libgui/graphics/Table.[cc/h]: Add QT toolkit Table object.
* libgui/graphics/module.mk: Add new files.
* libgui/graphics/Backend.cc (toolkitObjectProperty, Backend::initialize,
Backend::update): Add uitable.
* libgui/graphics/Canvas.cc (Canvas::select_object): Allow uitable to be
selected like uicontrol or uipanel.
* libgui/graphics/ObjectFactory.cc (ObjectFactory::createObject): Add uitable.
* libgui/graphics/QtHandlesUtils.cc (computeFont<uibuttongroup>): Make
computeFont template for uitable.
* libinterp/corefcn/gl-render.cc (opengl_renderer::draw): Add uitable.
* libinterp/corefcn/graphics.cc (default_table_position,
default_table_backgroundcolor): Add new static default values.
* libinterp/corefcn/graphics.cc (lookup_object_name,
make_graphics_object_from_type, property_list::set, property_list::lookup):
Add uipanel.
* libinterp/corefcn/graphics.cc (uitable::properties::get_boundingbox,
uitable::properties::set_columnformat, uitable::properties::set_columnwidth,
uitable::properties::set_units, uitable::properties::update_units,
uitable::properties::set_fontunits, uitable::properties::update_fontunits,
uitable::properties::get___fontsize_points__,
uitable::properties::get_fontsize_pixels,
uitable::properties::get_backgroundcolor_rgb,
uitable::properties::get_alternatebackgroundcolor_rgb,
uitable::properties::get_extent_matrix, uitable::properties::get_extent,
uitable::properties::set_selectedobject, F__go_uitable__): Add new functions.
* libinterp/corefcn/graphics.in.h: Add uitable.
* scripts/gui/uitable.m: Add new file.
* scripts/gui/module.mk: Add new file to list.
* scripts/help/__unimplemented__.m: Remove uitable from missing_functions.
* doc/interpreter/genpropdoc.m, doc/interpreter/gui.txi,
doc/interpreter/module.mk, doc/interpreter/plot.txi: Add documentation for
uitable.
* NEWS: Add to list of new functions.
author | Andrew Thornton <art27@cantab.net> |
---|---|
date | Tue, 20 Dec 2016 03:25:17 +0000 |
parents | |
children | 4d1c6c60f6b3 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/graphics/Table.h Tue Dec 20 03:25:17 2016 +0000 @@ -0,0 +1,91 @@ +/* + +Copyright (C) 2016 Andrew Thornton + +This file is part of Octave. + +Octave 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 3 of the License, or (at your +option) any later version. + +Octave 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 Octave; see the file COPYING. If not, see +<http://www.gnu.org/licenses/>. + +*/ + +#if ! defined (octave_Table_h) +#define octave_Table_h 1 + +#include "Object.h" + +class QCheckBox; +class QTableWidget; +class QTableWidgetItem; + +namespace QtHandles +{ + + class Container; + + class Table : public Object + { + Q_OBJECT + + public: + Table (const graphics_object& go, QTableWidget* tableWidget); + ~Table (void); + + Container* innerContainer (void) { return m_container; } + + bool eventFilter (QObject* watched, QEvent* event); + + static Table* create (const graphics_object& go); + + protected: + void update (int pId); + //void redraw (void); + void updateColumnname (void); + void updateColumnwidth (void); + void updateData (void); + void updateEnable (void); + void updateExtent (void); + void updatePalette (void); + void updateRearrangeableColumns (void); + void updateRowname (void); + + private slots: + void itemChanged (QTableWidgetItem* item); + void comboBoxCurrentIndexChanged (const QString& value); + void cellClicked (int row, int col); + void itemSelectionChanged (void); + + private: + Container* m_container; + QTableWidget* m_tableWidget; + octave_value m_curData; + bool m_blockUpdates; + bool m_keyPressHandlerDefined; + bool m_keyReleaseHandlerDefined; + QWidget * checkBoxForLogical(octave_value cal, bool enabled); + void updateData (int row, int col, octave_value value, std::string format, bool enabled); + void updateData (int row, int col); + void updateDataColumn (int col); + std::string columnformat (int column); + bool columneditable (int column); + void sendCellEditCallback (int row, int col, octave_value old_value, octave_value new_value, octave_value edit_data, octave_value error); + void checkBoxClicked (int row, int col, QCheckBox* checkBox); + + + + }; + +}; // namespace QtHandles + +#endif