output: Add support for dashed, thick, and thin rules.
[pspp] / src / output / render.h
index eed29e8512a74c7d9a87160054d58f1dff16dbdf..5089a3bdd4e19996d4888ed6eba30a5f06e8639e 100644 (file)
 #include <stddef.h>
 #include "output/table-provider.h"
 
-struct table;
+struct table_item;
 
 enum render_line_style
   {
-    RENDER_LINE_NONE,           /* No line. */
-    RENDER_LINE_SINGLE,         /* Single line. */
-    RENDER_LINE_DOUBLE,         /* Double line. */
+    RENDER_LINE_NONE,
+    RENDER_LINE_SINGLE,
+    RENDER_LINE_DASHED,
+    RENDER_LINE_THICK,
+    RENDER_LINE_THIN,
+    RENDER_LINE_DOUBLE,
     RENDER_N_LINES
   };
 
+/* Parameters for rendering a table_item to a device.
+
+
+   Coordinate system
+   =================
+
+   The rendering code assumes that larger 'x' is to the right and larger 'y'
+   toward the bottom of the page.
+
+   The rendering code assumes that the table being rendered has its upper left
+   corner at (0,0) in device coordinates.  This is usually not the case from
+   the driver's perspective, so the driver should expect to apply its own
+   offset to coordinates passed to callback functions.
+
+
+   Callback functions
+   ==================
+
+   For each of the callback functions, AUX is passed as the 'aux' member of the
+   render_params structure.
+*/
 struct render_params
   {
     /* Measures CELL's width.  Stores in *MIN_WIDTH the minimum width required
        to avoid splitting a single word across multiple lines (normally, this
        is the width of the longest word in the cell) and in *MAX_WIDTH the
-       minimum width required to avoid line breaks other than at new-lines. */
+       minimum width required to avoid line breaks other than at new-lines.
+       */
     void (*measure_cell_width) (void *aux, const struct table_cell *cell,
                                 int *min_width, int *max_width);
 
@@ -96,32 +121,26 @@ struct render_params
        across two pages.  (Joined cells may always be broken at join
        points.) */
     int min_break[TABLE_N_AXES];
+
+    bool supports_margins;
   };
-\f
-/* A "page" of content that is ready to be rendered.
 
-   A page's size is not limited to the size passed in as part of render_params.
-   Use render_pager (see below) to break a render_page into smaller
-   render_pages that will fit in the available space. */
-struct render_page *render_page_create (const struct render_params *,
-                                        const struct table *);
+/* An iterator for breaking render_pages into smaller chunks. */
+struct render_pager *render_pager_create (const struct render_params *,
+                                          const struct table_item *);
+void render_pager_destroy (struct render_pager *);
 
-struct render_page *render_page_ref (const struct render_page *);
-void render_page_unref (struct render_page *);
+bool render_pager_has_next (const struct render_pager *);
+int render_pager_draw_next (struct render_pager *, int space);
 
-int render_page_get_size (const struct render_page *, enum table_axis);
-void render_page_draw (const struct render_page *);
-void render_page_draw_region (const struct render_page *,
-                              int x, int y, int w, int h);
+void render_pager_draw (const struct render_pager *);
+void render_pager_draw_region (const struct render_pager *,
+                               int x, int y, int w, int h);
 
-int render_page_get_best_breakpoint (const struct render_page *, int height);
-\f
-/* An iterator for breaking render_pages into smaller chunks. */
+int render_pager_get_size (const struct render_pager *, enum table_axis);
+int render_pager_get_best_breakpoint (const struct render_pager *, int height);
 
-struct render_pager *render_pager_create (struct render_page *);
-void render_pager_destroy (struct render_pager *);
+bool render_direction_rtl (void);
 
-bool render_pager_has_next (const struct render_pager *);
-struct render_page *render_pager_next (struct render_pager *, int height);
 
 #endif /* output/render.h */