Commit Graph

47 Commits

Author SHA1 Message Date
Carlos Garnacho
41d6837fa2 Make GtkCellArea use GtkStyleContext
gtk_cell_area_[gs]et_style_detail() is no longer needed, as
the passed widget's context would already have all necessary
info.
2011-01-27 19:32:07 +01:00
Pavel Holejsovsky
729c823955 [GI] Mark callbacks' context parameter with (closure) annotation. 2011-01-18 17:20:32 +01:00
Tristan Van Berkom
c8ae68c33d Fixed gtk_cell_layout_set_cell_data_func() to pass the correct layout object
Added _gtk_cell_area_set_cell_data_func_with_proxy() to be called by
gtk_cell_layout_set_cell_data_func() when the layouting object itself
is not the underlying cell area.
2010-12-22 00:28:18 +09:00
Matthias Clasen
a2dda0c2bb Trivial changes
Whitespace fixes, comment formatting, etc
2010-12-17 19:14:35 -05:00
Tristan Van Berkom
b11bb46a76 Fixed parameter names in gtkcellarea.h for gtk-doc parsing. 2010-12-17 15:35:21 +09:00
Tristan Van Berkom
96d636a780 Updated some docs and gtk.symbols file for new apis
Added gtk_cell_area_context_get_preferred_height_for_width and
width_for_height & gtk_cell_area_copy_context() to gtk.symbols
and gtk3-sections.txt (also finished up documenting those apis).
2010-12-13 15:43:58 +09: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
2f4e451075 Added "edit_only" argument to gtk_cell_area_activate()
This argument allows the caller to specify that only an editable
cell should start editing but an activatable cell should not toggle
it's state, this is important for public apis like
gtk_tree_view_set_cursor_on_cell() which are only intended to
programatically bring attention to the editing of a specific
row or cell but not actually change any data.

GtkTreeView & CellAreaScaffold updated for the last minute api change.
2010-12-12 17:15:46 +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
c6572265cb Fixed gtk-doc statement in GtkCellArea header 2010-12-06 16:29:13 +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
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
9e3ebe4955 Marking GtkCellArea structure portions as /*< private >*/ 2010-12-03 17:12:59 +09:00
Tristan Van Berkom
a7ad110fe9 Adding more documentation to GtkCellArea, documented GtkCellAreaClass structure. 2010-12-03 00:29:22 +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
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
e53dc3479f Added GtkCellAreaClass->apply_attributes()
Made gtk_cell_area_apply_attributes use a vfunc & signal so that
subclasses might do specialized things picking up attributes from the
model possibly for embedding widgets, and as specially for GtkTreeMenu
to connect to the signal and synchronize the menu sensitivity states
in a more convenient way than going through the GtkCellLayoutDataFunc.
2010-11-23 23:37:58 +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
4ceb25e011 More documentation in gtkcellarea.c 2010-11-15 11:23:55 +09:00
Tristan Van Berkom
92dc7f31d4 Cleaned up cell editing api in GtkCellArea
Now layouting widgets need only concern themselves with
the "add-editable" and "remove-editable" signals, also added
lots of gtk-doc comments.
2010-11-14 23:33:26 +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
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
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
09e3d9d3aa Added gtk_cell_area_stop_editing to allow explicit stopping of cell editing. 2010-11-08 11:31:03 +09:00
Tristan Van Berkom
cbe1154e51 Added gtk_cell_area_activate_cell() and some cell editing management
Now:
  - The current edit cell and editable widget in use can be fetched
    with properties and accessors
  - gtk_cell_area_activate_cell() handles bookkeeping of the currently
    edited cell, starting the editing of a cell, activating a cell etc
  - Exported signals are available on GtkCellArea: "editing-started",
    "editing-canceled", "editing-done", "remove-editable".
  - Upon receiving GDK_KEY_Escape current editing gets canceled.
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
832c123fd2 Extended gtk_cell_area_apply_attributes() to account for expander/expanded cells
The state of expanded cells must come from the view, since these states
can vary across views accessing the same model (also "finished up" the
applying of attributes code).
2010-11-02 18:01:03 +09:00
Tristan Van Berkom
e94a177774 Added cell focus apis to GtkCellArea. 2010-11-01 16:01:25 +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
163c3c8852 Added margins to the cell area
Added margin properties to the cell area, margins will be removed
from the area given to ->render() when creating the inner cell area.
2010-10-31 18:55:51 +09:00
Tristan Van Berkom
01d2eddf03 Added GTK_CELL_AREA_WARN_INVALID_CHILD_PROPERTY_ID to gtkcellarea.h 2010-10-31 17:45:06 +09:00
Tristan Van Berkom
d781c226da Implemented "cell properties" on the GtkCellArea
Added cell "packing" properties for generic configuration
of child cells inside an area.
2010-10-31 17:13:15 +09:00
Tristan Van Berkom
b12e7a8115 Adding GtkCellAreaIter arg to GtkCellArea->render/->event 2010-10-30 23:48:52 +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
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
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
Tristan Van Berkom
705e7ee100 Added GtkCellArea to the build
Starting to form a good api, implemented most of GtkCellLayout iface
on the base class routing the apis through the new class vfuncs.
2010-10-22 16:41:52 +09:00
Tristan Van Berkom
8bb20925ed Adding vague initial draft of GtkCellArea to the codebase (treeview-refactor branch). 2010-10-21 22:46:10 +09:00