Commit Graph

65 Commits

Author SHA1 Message Date
Matthias Clasen
16877b4d7b Reduce includes of gtktypeutils.h to a minimum 2011-01-04 12:05:05 -05:00
Tristan Van Berkom
49273f2277 Added "fixed-size" cell property to GtkCellAreaBox
Now a cell can either have a "fixed" size or it can have
an "aligned" starting point or both. "fixed" size cells take
no space when they are invisible.
2010-12-22 00:28:18 +09:00
Matthias Clasen
d4e9cd09ab Fix up symbol lists 2010-12-19 23:45:21 -05:00
Matthias Clasen
a2dda0c2bb Trivial changes
Whitespace fixes, comment formatting, etc
2010-12-17 19:14:35 -05:00
Matthias Clasen
8bc4e13c22 No links in title, please 2010-12-17 18:41:24 -05:00
Kristian Rietveld
c01ad6f615 Fix background area calculation in RTL mode 2010-12-16 12:26:18 +01:00
Tristan Van Berkom
0431dd67f8 Added apis to GtkCellArea for GtkIconView purposes.
Added a few apis,

  - GtkCellAreaContext get_preferred_height_for_width &
    width for height apis and vfuncs, this lets the icon view
    request the collective (and aligned) height for width for
    a said row.

  - gtk_cell_area_copy_context() this creates a duplicate of
    an already created and requested context, this way the icon
    view uses a global context to request the widths of all rows
    and then makes a copy with all the stored alignments and
    uses a separate copy to calculate the height and alignments
    of each row separately.
2010-12-13 00:29:21 +09:00
Tristan Van Berkom
1c8093b65e Fixed some glitches in GtkCellAreaBox keynav from my last commit. 2010-12-12 20:40:34 +09:00
Tristan Van Berkom
89b3700b78 Make GtkCellAreaBox remember what was the last focus cell so that when
cycling focus from row to row for a horizontal area we can remember
where focus was the last time around.
2010-12-12 20:40:26 +09:00
Tristan Van Berkom
34f4b5c190 Added 'background_area' calculation to GtkCellAreaClass->foreach_alloc vfunc
This allows us to reduce code allocation code paths in subclasses, as
a result GtkCellArea implements the ->render() vfunc and the subclass
only decides the cell area and background area distributions in a single
code path.
2010-12-08 21:18:05 +09:00
Tristan Van Berkom
9366a345b4 Fix GtkCellAreaBox allocate_cells_manually to handle undersized areas. 2010-12-06 16:29:40 +09:00
Tristan Van Berkom
2588165bfb Added gtk_cell_area_foreach_alloc() to further simplify GtkCellArea subclasses
gtk_cell_area_foreach_alloc() itterates over an allocated list of cells
and calls a callback with the cell's allocation until the callback returns
TRUE.
  - Removed vfunc get_cell_allocation() and implemented
    gtk_cell_area_get_cell_allocation() using foreach_alloc()
  - Added gtk_cell_area_get_cell_at_position() using foreach_alloc()
  - Removed GtkCellAreaBox ->event() implementation and implemented
    mouse "click" cell activation in GtkCellArea class directly using
    gtk_cell_area_get_cell_at_position().
2010-12-06 14:11:28 +09:00
Tristan Van Berkom
4b065f5389 Changed gtk_cell_area_forall to gtk_cell_area_foreach since thats more widely used semantics.
Also gave a boolean return value to the callback to allow breaking out of the loop.
2010-12-06 12:41:38 +09:00
Tristan Van Berkom
f24c21f1f0 Added proper handling of right to left layouting of cells to GtkCellAreaBox. 2010-12-05 15:24:19 +09:00
Tristan Van Berkom
1d3961b342 Fixing gtk_cell_area_box_focus().
the ->focus() method was getting mixed up when more than
one cell was in the same group (not aligned), added the
proper check to break out of the loop on time.
2010-12-04 21:49:44 +09:00
Tristan Van Berkom
b0f849eafd Changed GTK_CELL_AREA_WARN_INVALID_CHILD_PROPERTY_ID for GTK_CELL_AREA_WARN_INVALID_CELL_PROPERTY_ID 2010-12-04 20:52:03 +09:00
Tristan Van Berkom
0fa7477091 Adding documentation for GtkCellAreaBox. 2010-12-03 17:13:31 +09:00
Tristan Van Berkom
30561228ed Added some rules to GtkCellAreaBox for rendering the last cell.
- When we reach a cell that is out of the render area, break out
   of the loop (for columns user resized too small)
 - CLAMP the size of the last renderer to fit into the area
   (so that renderers get a chance to ellipsize when rendered
   with a space less than allocation, same reason as above).
 - Hand out remaining space in the render area to the last cell,
   this is for shallow rows in the expand column which may recieve
   more than the allocated width.
2010-12-01 22:56:06 +09:00
Tristan Van Berkom
26ac551b74 Added special clause to GtkCellAreaBox focus navigation.
If the area has no activatable cells and has focus when
focus should be cycled, immediately focus out of the area
(because focus in that case is given to the entire area).
2010-12-01 15:18:40 +09:00
Tristan Van Berkom
5729d2552b Fix GtkCellAreaBox to not paint a focus rectangle while a cell is currently being edited. 2010-11-29 16:49:34 +09:00
Tristan Van Berkom
626f27f7ed Changed cell area/renderer "can_focus" semantics to "is_activatable" across the board.
This is because focus in treeviews can be given to cells that cannot do anything
with activation (for better keynav), so we dissociate the concept of cell
activation and focusing.
2010-11-29 16:29:09 +09:00
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