Commit Graph

44 Commits

Author SHA1 Message Date
Tristan Van Berkom
dbe026ed1e Fixed GtkCellAreaBox->focus() to not give focus to cells that are siblings of an intentional focus cell. 2010-11-29 16:20:01 +09:00
Tristan Van Berkom
5f427ff476 Make focus rectangle painted on all cells if the GtkCellAreaBox is requested to paint focus and none of the cells are activatable. 2010-11-29 16:14:46 +09:00
Kristian Rietveld
05b217ab2a Allow non-editable cells to receive focus
Slight tweak for GtkTreeView, also non-editable cells must be able to receive
focus to get all keyboard navigation right.  This will be further tweaked
to get focus siblings to work like focus cells did in GtkTreeView before
refactoring.
2010-11-28 19:54:24 +01:00
Kristian Rietveld
354b3412dd Available extra space could be less than zero
The allocated size, or (horizontally speaking) for-width size, can be
smaller than the sum of all minimum widths.  For example when the user
is resizing tree view columns manually.
2010-11-28 19:54:18 +01:00
Tristan Van Berkom
5df7dab3cf Changed all the flush apis on GtkCellAreaContext for a single "reset" api. 2010-11-27 16:05:14 +09:00
Tristan Van Berkom
e21c224f28 Fixing GtkCellAreaBox at render time to consider height-for-width when stacked vertically
Also bullet-proofing GtkCellAreaBoxContext at allocate time.
2010-11-26 23:44:22 +09:00
Tristan Van Berkom
487223d480 Finally really support rendering of cells in an unallocated context.
What this means is basically that a vertically oriented GtkCellAreaBox
will render cells properly even if the height is not constant for every
for of data in the said GtkCellAreaContext (i.e. the height was not allocated
by gtk_cell_area_context_allocate).

This is done completely on the fly and so is much more heavy duty
at render time (considerably slower but not visibly noticable in
lightweight views like GtkTreeMenu). Note that cell alignments
are not possible in an unallocated orientation, each row of data
individually receives only enough space to render the independant
row and no space is reserved for alignments if the size is not
a constant size across rows in the same context.
2010-11-26 21:38:10 +09:00
Tristan Van Berkom
fa3c8f182e Revert "Removed tons of api that we dont absolutely need in GtkCellAreaContext:"
This reverts commit 5f7787ab2e.
2010-11-26 21:37:51 +09:00
Tristan Van Berkom
2dd2c7ce05 Added gtk_cell_renderer_get_aligned_area() and class vfunc.
Since a cell renderer might use more space than the natural
size when recieving expand space it's impossible to know how
much space is actually used to render content.

Adding this virtual method to allow text renderers to implement
it, the base default method uses height-for-width apis and aligns
the cell assuming the renderer uses a fixed size.

This commit removes the similar code from gtkcellarea and
subclasses.
2010-11-25 17:41:26 +09:00
Tristan Van Berkom
5f7787ab2e Removed tons of api that we dont absolutely need in GtkCellAreaContext:
- gtk_cell_area_context_get_height_for_width()
  - gtk_cell_area_context_get_width_for_height()
  - gtk_cell_area_context_push_height_for_width()
  - gtk_cell_area_context_push_width_for_height()
  - gtk_cell_area_context_flush_height_for_width()
  - gtk_cell_area_context_flush_width_for_height()
  - Contextual size changed signal

All of these are not really important for the CellArea to operate
and not of any real consequential value to the user (the user can
accumulate the returned values from height-for-width requests
and do as they please with it).
2010-11-25 16:36:46 +09:00
Tristan Van Berkom
9d0c2f6b37 Make GtkCellAreaBox handle rendering without a previous allocation in the orientation of choice.
This is so that treeviews can have some columns oriented vertically and
some horizontally, usually the column will only allocate the areas
width, having vertical columns without fixed row heights just means
it's slower to render.
2010-11-25 16:09:51 +09:00
Tristan Van Berkom
d56babefb4 Removed cell margin apis and now deal with "focus-line-width". 2010-11-23 16:26:46 +09:00
Tristan Van Berkom
1bca6349fb Mass rename GtkCellAreaIter --> GtkCellAreaContext 2010-11-13 16:23:01 +09:00
Tristan Van Berkom
38666b406f Ironed out the kinks in editing apis for GtkCellArea
- Added gtk_cell_area_aligned_cell_area() to get the aligned
   internal area use by a cell (for focus painting and for
   event areas).

 - Provide the event area in "editing-started" signal

 - Fire "remove-editable" when editing is canceled by the user,
   an implementing layouting widget need only catch "editing-started"
   and "remove-editable" now.

 - CellAreaScaffold/testcellarea now edit textrenderers.
2010-11-12 19:25:07 +09:00
Tristan Van Berkom
7e821aa980 Distribute portions of GtkCellArea:render() background_area argument to cells
Also added gtk_cell_area_get/set_style_detail() to set the string to be
used by the area in gtk_paint_* functions.
2010-11-12 14:06:00 +09:00
Tristan Van Berkom
33db66e728 Added event handling to GtkCellAreaBox
Now GtkCellAreaBox handles the click event to activate renderers
and checks if the area is in a sibling of a focus renderer, possibly
activating the proper focus sibling renderer.

Also GtkCellArea gains a "focus-changed" signal to allow it to
change the currently focused row according to the button events.
2010-11-11 18:13:54 +09:00
Tristan Van Berkom
f330b40521 GtkCellArea now paints focus on cells
Added concept of "Focus Siblings" to GtkCellArea so that some
static text/icon may be included in the focus/click area of
an activatable or editable cell, implemented focus drawing
as well, updated testcellarea to reflect the changes.
2010-11-11 16:13:06 +09:00
Tristan Van Berkom
524110f902 Focus driving in GtkCellArea now works.
- Fixed focus driving in GtkCellArea with refined apis
 - Added gtk_cell_area_activate() to be called when the area has focus
   (to activate or start editing the focused cell)
 - Added support for this in cellareascaffold
 - testcellarea now watches the "toggled" signal for a toggle renderer
   and updates the model state accordingly, this currently works with
   keyboard navigation, however focus is still not painted on cells.
2010-11-10 22:25:13 +09:00
Tristan Van Berkom
4643d90c5f Committing new (and simplified) focus handling approach for GtkCellArea.
Also adding missing file cellareascaffold.h
2010-11-10 19:17:06 +09:00
Tristan Van Berkom
c932beef4b Fixing GtkCellAreaBox to rebuild groups when align/expand child properties change. 2010-11-09 13:50:30 +09:00
Tristan Van Berkom
e5e507e1d4 Added GtkCellArea classes to gtk.h and fixed a remainig rendering bug. 2010-11-09 01:25:45 +09:00
Tristan Van Berkom
92b9f432dd Fixed initial bugs in GtkCellArea implementation, starting to render
Tested all of this with some scaffolding code, test case comming soon.
2010-11-08 17:43:27 +09:00
Tristan Van Berkom
0336838366 Implemented focus handling in GtkCellAreaBox
Now when the GtkCellAreaBox receives key events it cycles
the currently focused cell to the next focusable cell in the box
while observing the navigation direction, it then emits "focus-leave"
when hitting the boundries of the area.
2010-11-08 11:31:03 +09:00
Tristan Van Berkom
631bdc438c Made progress on focus handling.
- Added vfunc to get the allocation of a cell inside an area
 - Superclass GtkCellArea handles activation of focused cells
   by handling key events (as well as editing of editable cells)
 - Added signal "editing-started" to GtkCellArea to signal that
   editing has started (generally signaled from inside event handling)
 - Added properties "focus-cell" and "edited-cell"
2010-11-05 22:19:50 +09:00
Tristan Van Berkom
1ad5fa3e7a Committing half-way done focus work. 2010-11-05 22:19:50 +09:00
Tristan Van Berkom
7ddf87f9ef Account for the possibility of invisible cells in GtkCellAreaBox/Iter
Also changed the GtkCellAreaBox to keep groups in an array
instead of a list, for this code it's generally more useful
this way (and more optimized).
2010-11-02 16:51:06 +09:00
Tristan Van Berkom
e3b75cb053 Adding tentative implementation of GtkCellAreaBox->grab_focus(). 2010-11-02 12:04:38 +09:00
Tristan Van Berkom
54004237be Added GtkCellRendererState flags to GtkCellArea->event/render() methods 2010-11-01 12:39:00 +09:00
Tristan Van Berkom
9c4eb3d431 Changed GtkCellArea margin-left/right... for cell-margin-left/right...
The rationale here is that every cell in an area needs to have space
reserved around it, requests have to be fully margin inclusive...
cells need to have the full size fed as the "background area" and
the "cell area" has margins removed... This will be used by GtkTreeViewColumn
to set the focus line width so that cells can paint a background on the
full background, then render themselves into the cell area... and parents
can go ahead and draw focus and other indicators on the background area
but outside of the cell area.
2010-10-31 22:50:53 +09:00
Tristan Van Berkom
25b00759c5 Implemented cell packing properties on GtkCellAreaBox 2010-10-31 17:45:29 +09:00
Tristan Van Berkom
6da74b6e1e Finished up allocation of cells.
Added get_allocated_cells() which returns a practical list
of cells with allocation for render/event time, this abstracts
whether the cells are individually aligned or aligned into groups,
when there are groups of cells before an alignment, those groups
get allocated on the fly for render time.
2010-10-31 15:22:39 +09:00
Tristan Van Berkom
e494f102cf Cleaned up GtkCellAreaIter implementation to use arrays to store grouped cell information. 2010-10-31 13:06:10 +09:00
Tristan Van Berkom
b12e7a8115 Adding GtkCellAreaIter arg to GtkCellArea->render/->event 2010-10-30 23:48:52 +09:00
Tristan Van Berkom
ea6df20bbb Added the majority of the allocate machinery to GtkCellAreaIter[Box]. 2010-10-30 23:06:26 +09:00
Tristan Van Berkom
86fb6ab216 Fixed GtkCellAreaIter to notify invalidation of sizes on flush
Also fixed GtkCellAreaBox to track the iters it creates and flush
them when the overall layout configuration changes (add/remove/reorder/
spacing changed etc).
2010-10-30 21:40:22 +09:00
Tristan Van Berkom
3b1c301a66 Made GtkCellAreaBox:align-cells a packing property per cell
Implemented all request apis on GtkCellAreaBox considering
alignment of groups of cells (some cells can be aligned while
others fill space smartly).
2010-10-30 17:35:22 +09:00
Tristan Van Berkom
695e427522 Added most of the request code for GtkCellAreaBox
Added the following to GtkCellAreaBox:
   - GtkCellAreaBox:spacing property defines spacing between cells
   - GtkCellAreaBox:align-cells property defines whether cells should
     be aligned with cells in adjacent rows.
   - Implementations for get_preferred_width / get_preferred_height
   - Implementations for get_preferred_height_for_width and the other
     when the box is oriented in the easy way (i.e. height_for_width()
     implemented for a vertical box, no virtual allocations done yet).
2010-10-27 01:01:58 +09:00
Tristan Van Berkom
97e3ccc58b Added GtkCellAreaBox subclass to handle alignments of cells across rows inside a GtkCellAreaBox. 2010-10-26 18:22:59 +09:00
Tristan Van Berkom
b5e529f578 Added GtkCellAreaIter class
Added base class to hold alignment and overall size request information
while itterating over the size requests of various rows of a GtkTreeModel,
updated GtkCellArea/GtkCellAreaBox classes accordingly.
2010-10-26 17:14:20 +09:00
Tristan Van Berkom
fe3f948d0a Implemented GtkCellLayoutIface->reorder on GtkCellAreaBox. 2010-10-24 20:08:21 +09:00
Tristan Van Berkom
468a1d3e7c Implemented basic child list handling on GtkCellAreaBox
Added the child list to GtkCellAreaBox, added _pack_start() and
_pack_end() apis to GtkCellAreaBox since they are appropriate there
and implemented GtkCellLayoutIface to override the _pack_start()/end()
methods (since the base GtkCellArea class simply forwards these apis
to the generic ->add() api on the base class).
2010-10-24 20:01:04 +09:00
Tristan Van Berkom
0722fbe7c8 Removed attribute handling from class vfuncs of GtkCellArea.
Now GtkCellArea handles attribute connections in the base class,
subclasses only need to add/remove the renderers, render them,
do geometry and handle events.
2010-10-24 19:20:10 +09:00
Tristan Van Berkom
45e42ca2d2 Implemented remaining portions of GtkCellLayout iface
Now GtkCellArea provides a generic way of applying attributes
from a GtkTreeModel/GtkTreeIter, GtkCellArea bookkeeps a hashtable
of GtkCellLayoutDataFunc's and completely abstracts the applying
of data to cells... GtkCellArea implementations need only to bookkeep
the added renderers and attributes (probably we can abstract the
attribute bookkeeping in the base class as well).

Things starting to take a good and practical shape.
2010-10-24 15:44:48 +09:00
Tristan Van Berkom
741d10ca4f Adding initial code skeleton for GtkCellAreaBox. 2010-10-23 17:01:58 +09:00