9 |
10 | namespace dw {
11 | namespace core {
12 |
13 | class FindtextState
14 | {
15 | public:
16 | typedef enum {
17 | /** \brief The next occurrence of the pattern has been found. */
18 | SUCCESS,
19 |
20 | /**
21 | * \brief There is no further occurrence of the pattern, instead, the
22 | * first occurrence has been selected.
23 | */
24 | RESTART,
25 |
26 | /** \brief The patten does not at all occur in the text. */
27 | NOT_FOUND
28 | } Result;
29 |
30 | private:
31 | /**
32 | * \brief The key used for the last search.
33 | *
34 | * If dw::core::Findtext::search is called with the same key, the search
35 | * is continued, otherwise it is restarted.
36 | */
37 | char *key;
38 |
39 | /** \brief Whether the last search was case sensitive. */
40 | bool caseSens;
41 |
42 | /** \brief The table used for KMP search. */
43 | int *nexttab;
44 |
45 | /** \brief The top of the widget tree, in which the search is done.
46 | *
47 | * From this, the iterator will be constructed. Set by
48 | * dw::core::Findtext::widget
49 | */
50 | Widget *widget;
51 |
52 | /** \brief The position from where the next search will start. */
53 | CharIterator *iterator;
54 |
55 | /**
56 | * \brief The position from where the characters are highlighted.
57 | *
58 | * NULL, when no text is highlighted.
59 | */
60 | CharIterator *hlIterator;
61 |
62 | static const char* rev(const char* _str); /* reverse a C string */
63 |
64 | static int *createNexttab (const char *needle,bool caseSens,bool backwards);
65 | bool unhighlight ();
66 | bool search0 (bool backwards, bool firstTrial);
67 |
68 | inline static bool charsEqual (char c1, char c2, bool caseSens)
69 | { return caseSens ? c1 == c2 : tolower (c1) == tolower (c2) ||
70 | (isspace (c1) && isspace (c2)); }
71 |
72 | public:
73 | FindtextState ();
74 | ~FindtextState ();
75 |
76 | void setWidget (Widget *widget);
77 | Result search (const char *key, bool caseSens, bool backwards);
78 | void resetSearch ();
79 | };
80 |
81 | } // namespace core
82 | } // namespace dw
83 |
84 | #endif // __DW_FINDTEXT_STATE_H__
85 |
--------------------------------------------------------------------------------
/test/floats4.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Floats 4
6 |
33 |
34 |
35 | Some text in a float.
36 |
37 | Sed ut perspiciatis, unde omnis iste natus error sit voluptatem
38 | accusantium doloremque laudantium, totam rem aperiam eaque ipsa,
39 | quae ab illo inventore veritatis et quasi architecto beatae
40 | vitae dicta sunt, explicabo. nemo enim ipsam voluptatem, quia
41 | voluptas sit, aspernatur aut odit aut fugit, sed quia
42 | consequuntur magni dolores eos, qui ratione voluptatem sequi
43 | nesciunt, neque porro quisquam est, qui dolorem ipsum, quia
44 | dolor sit, amet, consectetur, adipisci velit, sed quia non
45 | numquam eius modi tempora incidunt, ut labore et dolore magnam
46 | aliquam quaerat voluptatem. ut enim ad minima veniam, quis
47 | nostrum exercitationem ullam corporis suscipit laboriosam, nisi
48 | ut aliquid ex ea commodi consequatur? quis autem vel eum iure
49 | reprehenderit, qui in ea voluptate velit esse, quam nihil
50 | molestiae consequatur, vel illum, qui dolorem eum fugiat, quo
51 | voluptas nulla pariatur?
52 |
53 | | Ἐν ἀρχῇ ἦν ὁ Λόγος, καὶ ὁ Λόγος
54 | ἦν πρὸς τὸν Θεόν, καὶ Θεὸς ἦν ὁ Λόγος. Οὗτος ἦν ἐν ἀρχῇ πρὸς τὸν
55 | Θεόν. πάντα δι' αὐτοῦ ἐγένετο, καὶ χωρὶς αὐτοῦ ἐγένετο οὐδὲ ἕν ὃ
56 | γέγονεν. ἐν αὐτῷ ζωὴ ἦν, καὶ ἡ ζωὴ ἦν τὸ φῶς τῶν ἀνθρώπων. καὶ
57 | τὸ φῶς ἐν τῇ σκοτίᾳ φαίνει, καὶ ἡ σκοτία αὐτὸ οὐ
58 | κατέλαβεν. |
59 |
60 |
61 |
62 |
63 |
64 |
--------------------------------------------------------------------------------
/devdoc/dw-map.doc:
--------------------------------------------------------------------------------
1 | /** \page dw-map Dillo Widget Documentation Map
2 |
3 | This maps includes special documentations as well as longer comments
4 | in the sources. Arrows denote references between the documents.
5 |
6 | \dot
7 | digraph G {
8 | rankdir=LR;
9 | node [shape=record, fontname=Helvetica, fontsize=8];
10 | fontname=Helvetica; fontsize=8;
11 |
12 | dw_overview [label="Dillo Widget Overview", URL="\ref dw-overview"];
13 | dw_usage [label="Dillo Widget Usage", URL="\ref dw-usage"];
14 | dw_layout_views [label="Layout and Views", URL="\ref dw-layout-views"];
15 | dw_layout_widgets [label="Layout and Widgets",
16 | URL="\ref dw-layout-widgets"];
17 | dw_widget_sizes [label="Sizes of Dillo Widgets",
18 | URL="\ref dw-widget-sizes"];
19 | dw_changes [label="Changes to the GTK+-based Release Version",
20 | URL="\ref dw-changes"];
21 | dw_images_and_backgrounds [label="Images and Backgrounds in Dw",
22 | URL="\ref dw-images-and-backgrounds"];
23 | dw_Image [label="dw::Image", URL="\ref dw::Image"];
24 | dw_core_Imgbuf [label="dw::core::Imgbuf", URL="\ref dw::core::Imgbuf"];
25 | dw_core_SelectionState [label="dw::core::SelectionState",
26 | URL="\ref dw::core::SelectionState"];
27 | dw_core_style [label="dw::core::style", URL="\ref dw::core::style"];
28 | dw_Table [label="dw::Table", URL="\ref dw::Table"];
29 | dw_Textblock [label="dw::Textblock", URL="\ref dw::Textblock"];
30 | dw_core_ui [label="dw::core::ui", URL="\ref dw::core::ui"];
31 |
32 | dw_overview -> dw_changes;
33 | dw_overview -> dw_usage;
34 | dw_overview -> dw_core_style;
35 | dw_overview -> dw_core_ui;
36 | dw_overview -> dw_images_and_backgrounds;
37 | dw_overview -> dw_layout_widgets;
38 | dw_overview -> dw_widget_sizes;
39 | dw_overview -> dw_layout_views;
40 |
41 | dw_usage -> dw_Table;
42 | dw_usage -> dw_Textblock;
43 | dw_usage -> dw_core_style;
44 | dw_usage -> dw_core_ui;
45 | dw_usage -> dw_images_and_backgrounds;
46 |
47 | dw_layout_widgets -> dw_widget_sizes;
48 | dw_layout_widgets -> dw_core_SelectionState;
49 |
50 | dw_widget_sizes -> dw_Table;
51 | dw_widget_sizes -> dw_Textblock;
52 |
53 | dw_images_and_backgrounds -> dw_core_Imgbuf;
54 | dw_images_and_backgrounds -> dw_Image;
55 |
56 | dw_core_style -> dw_Textblock;
57 | }
58 | \enddot
59 | */
--------------------------------------------------------------------------------
/test/hyphens-etc.html:
--------------------------------------------------------------------------------
1 | Abcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcde
2 | Abcde-abcde-abcde-abcde-abcde-abcde-abcde-abcde-abcde-abcde-abcde-abcde-abcde-abcde-abcde-abcde-abcde-abcde-abcde-abcde-abcde-abcde-abcde-abcde-abcde-abcde-abcde-abcde-abcde-abcde-abcde-abcde-abcde-abcde-abcde-abcde-abcde-abcde-abcde-abcde-abcde-abcde-abcde-abcde-abcde-abcde
3 | Abcde‐abcde‐abcde‐abcde‐abcde‐abcde‐abcde‐abcde‐abcde‐abcde‐abcde‐abcde‐abcde‐abcde‐abcde‐abcde‐abcde‐abcde‐abcde‐abcde‐abcde‐abcde‐abcde‐abcde‐abcde‐abcde‐abcde‐abcde‐abcde‐abcde‐abcde‐abcde‐abcde‐abcde‐abcde‐abcde‐abcde‐abcde‐abcde‐abcde‐abcde‐abcde‐abcde‐abcde‐abcde‐abcde
4 | Abcde—abcde—abcde—abcde—abcde—abcde—abcde—abcde—abcde—abcde—abcde—abcde—abcde—abcde—abcde—abcde—abcde—abcde—abcde—abcde—abcde—abcde—abcde—abcde—abcde—abcde—abcde—abcde—abcde—abcde—abcde—abcde—abcde—abcde—abcde—abcde—abcde—abcde—abcde—abcde—abcde—abcde—abcde—abcde—abcde—abcde
5 | Nordrhein-Westfalen—Nordrhein-Westfalen—Nordrhein-Westfalen—Nordrhein-Westfalen—Nordrhein-Westfalen—Nordrhein-Westfalen—Nordrhein-Westfalen—Nordrhein-Westfalen—Nordrhein-Westfalen—Nordrhein-Westfalen—Nordrhein-Westfalen—Nordrhein-Westfalen
6 | Nordrheinwestfalen—Nordrheinwestfalen—Nordrheinwestfalen—Nordrheinwestfalen—Nordrheinwestfalen—Nordrheinwestfalen—Nordrheinwestfalen—Nordrheinwestfalen—Nordrheinwestfalen—Nordrheinwestfalen—Nordrheinwestfalen—Nordrheinwestfalen
7 |
--------------------------------------------------------------------------------
/README:
--------------------------------------------------------------------------------
1 | ===================
2 | Dillo+ web browser
3 | ===================
4 |
5 | Dillo+ is a multi-platform graphical web browser, known for its
6 | speed and small footprint, that is developed with a focus on
7 | personal security and privacy.
8 |
9 | The dillo3 series uses version 1.3.x of the FLTK GUI toolkit
10 | (http://fltk.org).
11 |
12 | The core team currently plans to focus on implementing the CSS
13 | feature of floating elements. This will greatly improve
14 | dillo's web page rendering since many sites have adopted floats
15 | instead of tables.
16 |
17 | The core team welcomes developers willing to join our workforce.
18 |
19 |
20 | NOTE: With FLTK-1.3, when running on X with Xft enabled (the
21 | default), font naming is more restricted than it was with FLTK2
22 | as used by dillo2. If your font_* preferences are no longer
23 | working well, please try the fc-list command as it is shown in
24 | dillorc.
25 |
26 |
27 | Here's a list of some old well-known problems of dillo:
28 |
29 | * no FRAMES rendering
30 |
31 |
32 | --------
33 | FLTK-1.3
34 | --------
35 |
36 | If you don't have FLTK-1.3 (try 'fltk-config --version' to check),
37 | you can get it from:
38 |
39 | http://fltk.org/software.php
40 |
41 | and build it like:
42 |
43 | tar zxvf fltk-1.3.3-source.tar.gz [or latest 1.3.x version]
44 | cd fltk-1.3.3
45 | less README.Unix.txt
46 | make
47 | sudo make install
48 | cd ..
49 |
50 | ------
51 | Dillo3
52 | ------
53 |
54 | Configure the options in Makefile.options.
55 | Then:
56 |
57 | make
58 | sudo make install
59 |
60 | In order to use the hyphenation feature, pattern files from CTAN need
61 | to be installed.
62 | This can be done with the script dillo-install-hyphenation.
63 | Call it with ISO-639-1 language codes as arguments, or without arguments
64 | to get more help.
65 |
66 |
67 | ------------
68 | Dpi programs
69 | ------------
70 |
71 | These are installed by "make install". If you don't have root
72 | access, copy "dillo" and "dpid" to some directory in your path
73 | and install the dpis by running "./install-dpi-local" from the
74 | top directory (they will be installed under ~/.dillo).
75 |
76 | -----------
77 | Dls scripts
78 | -----------
79 |
80 | These too are installed by "make install".
81 | You'll probably need python to run some of those.
82 |
83 | ------------
84 | OS supported
85 | ------------
86 |
87 | Linux, *BSD, Solaris are all supported, but be sure to personalize
88 | the options in Makefile.options according to your OS.
89 |
90 |
--------------------------------------------------------------------------------
/test/KHM1.html:
--------------------------------------------------------------------------------
1 |
2 |
In den alten Zeiten, wo das Wünschen noch geholfen hat, lebte ein
3 | König, dessen Töchter waren alle schön, aber die jüngste war so schön,
4 | daß die Sonne selber, die doch so vieles gesehen hat, sich verwunderte
5 | so oft sie ihr ins Gesicht schien. Nahe bei dem Schlosse des Königs
6 | lag ein großer dunkler Wald, und in dem Walde unter einer alten Linde
7 | war ein Brunnen: wenn nun der Tag recht heiß war, so ging das
8 | Königskind hinaus in den Wald und setzte sich an den Rand des kühlen
9 | Brunnens: und wenn sie Langeweile hatte, so nahm sie eine goldene
10 | Kugel, warf sie in die Höhe und fieng sie wieder; und das war ihr
11 | liebstes Spielwerk.
12 |
Nun trug es sich einmal zu, daß die goldene Kugel der Königstochter
13 | nicht in ihr Händchen fiel, das sie in die Höhe gehalten hatte,
14 | sondern vorbei auf die Erde schlug und geradezu ins Wasser hinein
15 | rollte. Die Königstochter folgte ihr mit den Augen nach, aber die
16 | Kugel verschwand, und der Brunnen war tief, so tief daß man keinen
17 | Grund sah. Da fieng sie an zu weinen und weinte immer lauter und
18 | konnte sich gar nicht trösten. Und wie sie so klagte, rief ihr jemand
19 | zu „was hast du vor, Königstochter, du schreist ja daß sich ein Stein
20 | erbarmen möchte.“ Sie sah sich um, woher die Stimme käme, da erblickte
21 | sie einen Frosch, der seinen dicken häßlichen Kopf aus dem Wasser
22 | streckte. „Ach, du bists, alter Wasserpatscher,“ sagte sie, „ich weine
23 | über meine goldene Kugel, die mir in den Brunnen hinab gefallen ist.“
24 | „Sei still und weine nicht,“ antwortete der Frosch, „ich kann wohl
25 | Rath schaffen, aber was gibst du mir, wenn ich dein Spielwerk wieder
26 | heraufhole?“ „Was du haben willst, lieber Frosch,“ sagte sie, „meine
27 | Kleider, meine Perlen und Edelsteine, auch noch die goldene Krone, die
28 | ich trage.“ Der Frosch antwortete „deine Kleider, deine Perlen und
29 | Edelsteine, und deine goldene Krone, die mag ich nicht: aber wenn du
30 | mich lieb haben willst, und ich soll dein Geselle und Spielkamerad
31 | sein, an deinem Tischlein neben dir sitzen, von deinem goldenen
32 | Tellerlein essen, aus deinem Becherlein trinken, in deinem Bettlein
33 | schlafen: wenn du mir das versprichst, so will ich hinunter steigen
34 | und dir die goldene Kugel wieder herauf holen.“ „Ach ja,“ sagte sie,
35 | „ich verspreche dir alles, was du willst, wenn du mir nur die Kugel
36 | wieder bringst.“ Sie dachte aber „was der einfältige Frosch schwätzt,
37 | der sitzt im Wasser bei seines Gleichen und quackt, und kann keines
38 | Menschen Geselle sein.“
39 |
40 |
--------------------------------------------------------------------------------
/dw/imgrenderer.hh:
--------------------------------------------------------------------------------
1 | #ifndef __DW_IMGRENDERER_HH__
2 | #define __DW_IMGRENDERER_HH__
3 |
4 | #ifndef __INCLUDED_FROM_DW_CORE_HH__
5 | # error Do not include this file directly, use "core.hh" instead.
6 | #endif
7 |
8 | namespace dw {
9 | namespace core {
10 |
11 | /**
12 | * \brief ...
13 | *
14 | * \sa \ref dw-images-and-backgrounds
15 | */
16 | class ImgRenderer
17 | {
18 | public:
19 | virtual ~ImgRenderer () { }
20 |
21 | /**
22 | * \brief Called, when an image buffer is attached.
23 | *
24 | * This is typically the case when all meta data (size, depth) has been read.
25 | */
26 | virtual void setBuffer (core::Imgbuf *buffer, bool resize = false) = 0;
27 |
28 | /**
29 | * \brief Called, when data from a row is available and has been copied into
30 | * the image buffer.
31 | *
32 | * The implementation will typically queue the respective area for drawing.
33 | */
34 | virtual void drawRow (int row) = 0;
35 |
36 | /**
37 | * \brief Called, when all image data has been retrieved.
38 | *
39 | * The implementation may use this instead of "drawRow" for drawing, to
40 | * limit the number of draws.
41 | */
42 | virtual void finish () = 0;
43 |
44 | /**
45 | * \brief Called, when there are problems with the retrieval of image data.
46 | *
47 | * The implementation may use this to indicate an error.
48 | */
49 | virtual void fatal () = 0;
50 | };
51 |
52 | /**
53 | * \brief Implementation of ImgRenderer, which distributes all calls
54 | * to a set of other implementations of ImgRenderer.
55 | *
56 | * The order of the call children is not defined, especially not
57 | * identical to the order in which they have been added.
58 | */
59 | class ImgRendererDist: public ImgRenderer
60 | {
61 | lout::container::typed::HashSet >
62 | *children;
63 |
64 | public:
65 | inline ImgRendererDist ()
66 | { children = new lout::container::typed::HashSet
67 | > (true); }
68 | ~ImgRendererDist () { delete children; }
69 |
70 | void setBuffer (core::Imgbuf *buffer, bool resize);
71 | void drawRow (int row);
72 | void finish ();
73 | void fatal ();
74 |
75 | void put (ImgRenderer *child)
76 | { children->put (new lout::object::TypedPointer (child)); }
77 | void remove (ImgRenderer *child)
78 | { lout::object::TypedPointer tp (child);
79 | children->remove (&tp); }
80 | };
81 |
82 | } // namespace core
83 | } // namespace dw
84 |
85 | #endif // __DW_IMGRENDERER_HH__
86 |
87 |
88 |
--------------------------------------------------------------------------------
/src/dpiapi.c:
--------------------------------------------------------------------------------
1 | /*
2 | * File: dpiapi.c
3 | *
4 | * Copyright (C) 2004-2007 Jorge Arellano Cid
5 | *
6 | * This program is free software; you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation; either version 3 of the License, or
9 | * (at your option) any later version.
10 | */
11 |
12 | /* Support for dpi/dpip from Dillo's side */
13 |
14 | #include "msg.h"
15 | #include "bw.h"
16 | #include "capi.h"
17 | #include "dpiapi.h" /* for prototypes */
18 | #include "dialog.hh"
19 | #include "../dpip/dpip.h"
20 |
21 |
22 | //----------------------------------------------------------------------------
23 | // Dialog interface
24 | //
25 |
26 | /* This variable can be eliminated as a parameter with a cleaner API. */
27 | static char *dialog_server = NULL;
28 |
29 |
30 | /*
31 | * Generic callback function for dpip dialogs.
32 | */
33 | static void Dpiapi_dialog_answer_cb(BrowserWindow *bw, int answer)
34 | {
35 | char *cmd, numstr[16];
36 |
37 | /* make dpip tag with the answer */
38 | snprintf(numstr, 16, "%d", answer);
39 | cmd = a_Dpip_build_cmd("cmd=%s to_cmd=%s msg=%s",
40 | "answer", "dialog", numstr);
41 |
42 | /* Send answer */
43 | a_Capi_dpi_send_cmd(NULL, bw, cmd, dialog_server, 0);
44 | dFree(cmd);
45 | }
46 |
47 | /*
48 | * Process a dpip "dialog" command from any dpi.
49 | */
50 | void a_Dpiapi_dialog(BrowserWindow *bw, char *server, char *dpip_tag)
51 | {
52 | char *title, *msg, *alt1, *alt2, *alt3, *alt4, *alt5;
53 | size_t dpip_tag_len;
54 | int ret;
55 |
56 | _MSG("a_Dpiapi_dialog:\n");
57 | _MSG(" dpip_tag: %s\n", dpip_tag);
58 |
59 | /* set the module scoped variable */
60 | dialog_server = server;
61 |
62 | /* other options can be parsed the same way */
63 | dpip_tag_len = strlen(dpip_tag);
64 | title = a_Dpip_get_attr_l(dpip_tag, dpip_tag_len, "title");
65 | msg = a_Dpip_get_attr_l(dpip_tag, dpip_tag_len, "msg");
66 | alt1 = a_Dpip_get_attr_l(dpip_tag, dpip_tag_len, "alt1");
67 | alt2 = a_Dpip_get_attr_l(dpip_tag, dpip_tag_len, "alt2");
68 | alt3 = a_Dpip_get_attr_l(dpip_tag, dpip_tag_len, "alt3");
69 | alt4 = a_Dpip_get_attr_l(dpip_tag, dpip_tag_len, "alt4");
70 | alt5 = a_Dpip_get_attr_l(dpip_tag, dpip_tag_len, "alt5");
71 |
72 | ret = a_Dialog_choice(title, msg, alt1, alt2, alt3, alt4, alt5, NULL);
73 | /* As choice is modal, call the callback function directly. */
74 | Dpiapi_dialog_answer_cb(bw, ret);
75 |
76 | dFree(alt1); dFree(alt2); dFree(alt3); dFree(alt4); dFree(alt5);
77 | dFree(title); dFree(msg);
78 | }
79 |
80 |
--------------------------------------------------------------------------------
/src/bookmark.c:
--------------------------------------------------------------------------------
1 | /*
2 | * File: bookmark.c
3 | *
4 | * Copyright 2002-2007 Jorge Arellano Cid
5 | *
6 | * This program is free software; you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation; either version 3 of the License, or
9 | * (at your option) any later version.
10 | */
11 |
12 | #include
13 |
14 | #include "msg.h"
15 | #include "history.h"
16 | #include "capi.h"
17 | #include "bookmark.h" /* for prototypes */
18 | #include "../dpip/dpip.h"
19 |
20 |
21 |
22 | /*
23 | * Have a short chat with the bookmarks server,
24 | * and finally ask it to add a new bookmark.
25 | * (this is an example of dpi chat)
26 | */
27 | void a_Bookmarks_chat_add(BrowserWindow *Bw, char *Cmd, char *answer)
28 | {
29 | static char *cmd1 = NULL, *cmd2 = NULL, *cmd3 = NULL, *cmd4 = NULL;
30 | static BrowserWindow *bw = NULL;
31 |
32 | if (!cmd1) {
33 | cmd1 = a_Dpip_build_cmd("cmd=%s msg=%s", "chat", "Hi server");
34 | cmd2 = a_Dpip_build_cmd("cmd=%s msg=%s", "chat",
35 | "I want to set a bookmark");
36 | cmd3 = a_Dpip_build_cmd("cmd=%s msg=%s", "chat", "Sure it is!");
37 | }
38 |
39 | _MSG("a_Bookmarks_chat_add\n answer=%s\n", answer ? answer : "(null)");
40 |
41 | if (Bw)
42 | bw = Bw;
43 | if (!cmd4 && Cmd)
44 | cmd4 = dStrdup(Cmd);
45 |
46 | if (!answer) {
47 | a_Capi_dpi_send_cmd(NULL, bw, cmd1, "bookmarks", 1);
48 |
49 | } else {
50 | /* we have an answer */
51 | if (answer) {
52 | if (*answer == 'H') {
53 | /* "Hi browser" */
54 | a_Capi_dpi_send_cmd(NULL, bw, cmd2, "bookmarks", 0);
55 | } else if (*answer == 'I') {
56 | /* "Is it worth?" */
57 | a_Capi_dpi_send_cmd(NULL, bw, cmd3, "bookmarks", 0);
58 | } else if (*answer == 'O') {
59 | /* "OK, send it!" */
60 | a_Capi_dpi_send_cmd(NULL, bw, cmd4, "bookmarks", 0);
61 | dFree(cmd4);
62 | cmd4 = NULL;
63 | }
64 | }
65 | }
66 | }
67 |
68 | /*
69 | * Add the new bookmark through the bookmarks server
70 | */
71 | void a_Bookmarks_add(BrowserWindow *bw, const DilloUrl *url)
72 | {
73 | const char *title;
74 | char *cmd;
75 |
76 | dReturn_if_fail(url != NULL);
77 |
78 | /* if the page has no title, we'll use the url string */
79 | title = a_History_get_title_by_url(url, 1);
80 |
81 | cmd = a_Dpip_build_cmd("cmd=%s url=%s title=%s",
82 | "add_bookmark", URL_STR(url), title);
83 | a_Bookmarks_chat_add(bw, cmd, NULL);
84 | dFree(cmd);
85 | }
86 |
87 |
--------------------------------------------------------------------------------
/Makefile.options.MacOS:
--------------------------------------------------------------------------------
1 | # Provided by Timur Ismagilov (@bouncepaw)
2 | # Tested for MacBook Air M1 2020 running Big Sur
3 |
4 | # Original code:
5 | # https://gist.github.com/bouncepaw/0c3744497d1764abf30f6a515498ddb7
6 |
7 | # == SYSTEM BINARIES ==
8 |
9 | AR ?= ar
10 | ARFLAGS ?= cru
11 | RANLIB ?= ranlib
12 |
13 | CC ?= gcc
14 | CXX ?= g++
15 |
16 | INSTALL ?= /usr/bin/install
17 | INSTALL_SH = ../install-sh
18 |
19 | # == COMPILATION FLAGS ==
20 |
21 | COMPILE = $(CC) $(INCLUDES) $(CFLAGS)
22 | LINK = $(CC) $(CFLAGS) $(LDFLAGS) -o $@
23 |
24 | CFLAGS ?= -g -O2
25 | CFLAGS += -DD_DNS_THREADED -D_REENTRANT -DHAVE_CONFIG -D_THREAD_SAFE -Wall -W -Wno-unused-parameter -Waggregate-return
26 | INCLUDES ?= -I. -I.. -I/usr/local/include -I/opt/homebrew/Cellar/fltk/1.3.8_1/include -I/opt/homebrew/include/
27 | LDFLAGS ?= -L/opt/homebrew/opt/libiconv/lib -L/opt/homebrew/opt/openssl@3.1/lib -L/opt/homebrew/opt/jpeg/lib -L/usr/local/lib -L/opt/homebrew/Cellar/fltk/1.3.8_1/lib -lfltk -lpthread -framework Cocoa -v
28 |
29 | CXXCOMPILE = $(CXX) $(INCLUDES) $(CXXFLAGS)
30 | CXXFLAGS = $(CFLAGS) -fno-rtti -fno-exceptions
31 |
32 | LIBFLTK_CFLAGS = -I/usr/X11R6/include/freetype2 -pipe -I/usr/X11R6/include -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_THREAD_SAFE -D_REENTRANT
33 | LIBFLTK_CXXFLAGS = $(LIBFLTK_CFLAGS) -fvisibility-inlines-hidden
34 | LIBFLTK_LDFLAGS = $(LDFLAGS) -Wl,-rpath,/usr/local/lib -L/usr/X11R6/lib -lfltk -lXcursor -lXfixes -lXext -lXft -lfontconfig -lXinerama -lpthread -lm -lX11 -lXdmcp -lXau
35 |
36 | HTTPS_LDFLAGS = -L/opt/homebrew/opt/openssl@3.1/lib -lcrypto -lssl
37 |
38 | LIBPNG16_CXXFLAGS = -I/usr/local/include/libpng16
39 |
40 | DILLO_LDFLAGS = -ljpeg -L/usr/local/lib -lpng -Wl,-rpath,/usr/local/lib -L/usr/X11R6/lib -lfltk -lXcursor -lXfixes -lXext -lXft -lfontconfig -lXinerama -lpthread -lm -lX11 -lXdmcp -lXau -lz -liconv -lX11
41 |
42 | # == HTTPS CERTS ==
43 |
44 | CA_CERTS_FILE ?= /etc/ssl/cert.pem
45 | CA_CERTS_DIR ?= /etc/ssl/
46 |
47 | # == EXTERNAL TOOLS ==
48 |
49 | DOWNLOADER_TOOL = wget
50 | DOWNLOADER_USER_AGENT_ARG = -U
51 | DOWNLOADER_CONTINUE_ARG = -c
52 | DOWNLOADER_LOAD_COOKIES_ARG = --load_cookies
53 | DOWNLOADER_OUTPUT_FILENAME_ARG = -O
54 |
55 | ZIP_USE_7Z = 0
56 | FTP_USE_WGET = 1
57 |
58 | # == INSTALL PATHS ==
59 |
60 | BINNAME = dillo-plus
61 |
62 | PREFIX ?= /usr/local
63 | LIBDIR = $(PREFIX)/lib/
64 |
65 | DILLO_BINDIR = $(PREFIX)/bin/
66 | DILLO_LIBDIR = $(PREFIX)/lib/$(BINNAME)/
67 | DILLO_ETCDIR = $(PREFIX)/etc/$(BINNAME)/
68 |
69 | DPIDRC_SYS = $(DILLO_ETCDIR)/dpidrc
70 |
71 | DOC_PATH = $(PREFIX)/share/doc/$(BINNAME)
72 | MAN_PATH = $(PREFIX)/share/man/man1
73 |
74 | APP_PATH = $(PREFIX)/share/applications
75 | ICON_PATH = $(PREFIX)/share/icons
76 |
77 |
--------------------------------------------------------------------------------
/dw/fltkviewport.hh:
--------------------------------------------------------------------------------
1 | #ifndef __DW_FLTKVIEWPORT_HH__
2 | #define __DW_FLTKVIEWPORT_HH__
3 |
4 | #include
5 | #include
6 |
7 | #include "core.hh"
8 | #include "fltkcore.hh"
9 | #include "fltkviewbase.hh"
10 |
11 | namespace dw {
12 | namespace fltk {
13 |
14 | class FltkViewport: public FltkWidgetView
15 | {
16 | public:
17 | enum GadgetOrientation { GADGET_VERTICAL, GADGET_HORIZONTAL };
18 |
19 | private:
20 | enum { SCROLLBAR_THICKNESS = 15 };
21 |
22 | int scrollX, scrollY;
23 | int scrollDX, scrollDY;
24 | int hasDragScroll, dragScrolling, dragX, dragY;
25 | int horScrolling, verScrolling;
26 |
27 | Fl_Scrollbar *vscrollbar, *hscrollbar;
28 |
29 | GadgetOrientation gadgetOrientation[4];
30 | lout::container::typed::List >
31 | *gadgets;
32 |
33 | void adjustScrollbarsAndGadgetsAllocation ();
34 | void adjustScrollbarValues ();
35 | void hscrollbarChanged ();
36 | void vscrollbarChanged ();
37 | void positionChanged ();
38 |
39 | static void hscrollbarCallback (Fl_Widget *hscrollbar, void *viewportPtr);
40 | static void vscrollbarCallback (Fl_Widget *vscrollbar, void *viewportPtr);
41 |
42 | void selectionScroll();
43 | static void selectionScroll(void *vport);
44 |
45 | void updateCanvasWidgets (int oldScrollX, int oldScrollY);
46 | static void draw_area (void *data, int x, int y, int w, int h);
47 |
48 | protected:
49 | int translateViewXToCanvasX (int x);
50 | int translateViewYToCanvasY (int y);
51 | int translateCanvasXToViewX (int x);
52 | int translateCanvasYToViewY (int y);
53 |
54 | public:
55 | FltkViewport (int x, int y, int w, int h, const char *label = 0);
56 | ~FltkViewport ();
57 |
58 | void resize(int x, int y, int w, int h);
59 | void draw ();
60 | int handle (int event);
61 |
62 | void setCanvasSize (int width, int ascent, int descent);
63 |
64 | bool usesViewport ();
65 | int getHScrollbarThickness ();
66 | int getVScrollbarThickness ();
67 | void scroll(int dx, int dy);
68 | void scroll(dw::core::ScrollCommand cmd);
69 | void scrollTo (int x, int y);
70 | void setViewportSize (int width, int height,
71 | int hScrollbarThickness, int vScrollbarThickness);
72 | void setScrollStep(int step);
73 |
74 | void setGadgetOrientation (bool hscrollbarVisible, bool vscrollbarVisible,
75 | GadgetOrientation gadgetOrientation);
76 | void setDragScroll (bool enable) { hasDragScroll = enable ? 1 : 0; }
77 | void addGadget (Fl_Widget *gadget);
78 | };
79 |
80 | } // namespace fltk
81 | } // namespace dw
82 |
83 | #endif // __DW_FLTKVIEWPORT_HH__
84 |
85 |
--------------------------------------------------------------------------------
/src/doctree.hh:
--------------------------------------------------------------------------------
1 | #ifndef __DOCTREE_HH__
2 | #define __DOCTREE_HH__
3 |
4 | #include "lout/misc.hh"
5 |
6 | class DoctreeNode {
7 | public:
8 | DoctreeNode *parent;
9 | DoctreeNode *sibling;
10 | DoctreeNode *lastChild;
11 | int num; // unique ascending id
12 | int element;
13 | lout::misc::SimpleVector *klass;
14 | const char *pseudo;
15 | const char *id;
16 |
17 | DoctreeNode () {
18 | parent = NULL;
19 | sibling = NULL;
20 | lastChild = NULL;
21 | klass = NULL;
22 | pseudo = NULL;
23 | id = NULL;
24 | element = 0;
25 | };
26 |
27 | ~DoctreeNode () {
28 | dFree ((void*) id);
29 | while (lastChild) {
30 | DoctreeNode *n = lastChild;
31 | lastChild = lastChild->sibling;
32 | delete n;
33 | }
34 | if (klass) {
35 | for (int i = 0; i < klass->size (); i++)
36 | dFree (klass->get(i));
37 | delete klass;
38 | }
39 | }
40 | };
41 |
42 | /**
43 | * \brief HTML document tree interface.
44 | *
45 | * The Doctree class defines the interface to the parsed HTML document tree
46 | * as it is used for CSS selector matching.
47 | */
48 | class Doctree {
49 | private:
50 | DoctreeNode *topNode;
51 | DoctreeNode *rootNode;
52 | int num;
53 |
54 | public:
55 | Doctree () {
56 | rootNode = new DoctreeNode;
57 | topNode = rootNode;
58 | num = 0;
59 | };
60 |
61 | ~Doctree () {
62 | delete rootNode;
63 | };
64 |
65 | DoctreeNode *push () {
66 | DoctreeNode *dn = new DoctreeNode ();
67 | dn->parent = topNode;
68 | dn->sibling = dn->parent->lastChild;
69 | dn->parent->lastChild = dn;
70 | dn->num = num++;
71 | topNode = dn;
72 | return dn;
73 | };
74 |
75 | void pop () {
76 | assert (topNode != rootNode); // never pop the root node
77 | topNode = topNode->parent;
78 | };
79 |
80 | inline DoctreeNode *top () {
81 | if (topNode != rootNode)
82 | return topNode;
83 | else
84 | return NULL;
85 | };
86 |
87 | inline DoctreeNode *parent (const DoctreeNode *node) {
88 | if (node->parent != rootNode)
89 | return node->parent;
90 | else
91 | return NULL;
92 | };
93 |
94 | inline DoctreeNode *sibling (const DoctreeNode *node) {
95 | return node->sibling;
96 | };
97 | };
98 |
99 | #endif
100 |
--------------------------------------------------------------------------------
/dw/stackingcontextmgr.hh:
--------------------------------------------------------------------------------
1 | #ifndef __DW_STACKINGCONTEXTMGR_HH__
2 | #define __DW_STACKINGCONTEXTMGR_HH__
3 |
4 | #ifndef __INCLUDED_FROM_DW_CORE_HH__
5 | # error Do not include this file directly, use "core.hh" instead.
6 | #endif
7 |
8 | #include "../lout/container.hh"
9 |
10 | #include
11 |
12 | namespace dw {
13 |
14 | namespace core {
15 |
16 | /**
17 | * \brief See \ref dw-stacking-context.
18 | */
19 | class StackingContextMgr
20 | {
21 | private:
22 | Widget *widget;
23 | lout::container::typed::Vector *childSCWidgets;
24 | int *zIndices, numZIndices;
25 |
26 | int findZIndex (int zIndex, bool mustExist);
27 | void draw (View *view, Rectangle *area, int startZIndex, int endZIndex,
28 | DrawingContext *context);
29 | Widget *getWidgetAtPoint (int x, int y,
30 | core::GettingWidgetAtPointContext *context,
31 | int startZIndex, int endZIndex);
32 |
33 | public:
34 | StackingContextMgr (Widget *widget);
35 | ~StackingContextMgr ();
36 |
37 | inline static bool isEstablishingStackingContext (Widget *widget) {
38 | return IMPL_POS &&
39 | widget->getStyle()->position != style::POSITION_STATIC &&
40 | widget->getStyle()->zIndex != style::Z_INDEX_AUTO;
41 | }
42 |
43 | inline static bool handledByStackingContextMgr (Widget *widget) {
44 | // Each widget establishing a stacking context is child of another
45 | // stacking context, so drawn by StackingContextMgr::drawTop or
46 | // StackingContextMgr::drawBottom etc.
47 | return widget->getParent () != NULL
48 | && isEstablishingStackingContext (widget);
49 | }
50 |
51 | void addChildSCWidget (Widget *widget);
52 |
53 | inline int getNumZIndices () { return numZIndices; }
54 | inline int getNumChildSCWidgets () { return childSCWidgets->size (); }
55 |
56 | inline void drawBottom (View *view, Rectangle *area, DrawingContext *context)
57 | { draw (view, area, INT_MIN, -1, context); }
58 | void drawTop (View *view, Rectangle *area, DrawingContext *context)
59 | { draw (view, area, 0, INT_MAX, context); }
60 |
61 | inline Widget *getTopWidgetAtPoint (int x, int y,
62 | core::GettingWidgetAtPointContext
63 | *context)
64 | { return getWidgetAtPoint (x, y, context, 0, INT_MAX); }
65 |
66 | inline Widget *getBottomWidgetAtPoint (int x, int y,
67 | core::GettingWidgetAtPointContext
68 | *context)
69 | { return getWidgetAtPoint (x, y, context, INT_MIN, -1); }
70 | };
71 |
72 | } // namespace core
73 |
74 | } // namespace dw
75 |
76 | #endif // __DW_STACKINGCONTEXTMGR_HH__
77 |
--------------------------------------------------------------------------------
/dw/fltkflatview.cc:
--------------------------------------------------------------------------------
1 | /*
2 | * Dillo Widget
3 | *
4 | * Copyright 2005-2007 Sebastian Geerken
5 | *
6 | * This program is free software; you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation; either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with this program. If not, see .
18 | */
19 |
20 |
21 |
22 | #include "fltkflatview.hh"
23 | #include "../lout/debug.hh"
24 |
25 | #include
26 |
27 | using namespace lout::container::typed;
28 |
29 | namespace dw {
30 | namespace fltk {
31 |
32 | FltkFlatView::FltkFlatView (int x, int y, int w, int h, const char *label):
33 | FltkWidgetView (x, y, w, h, label)
34 | {
35 | DBG_OBJ_CREATE ("dw::fltk::FltkFlatView");
36 | }
37 |
38 | FltkFlatView::~FltkFlatView ()
39 | {
40 | }
41 |
42 | void FltkFlatView::setCanvasSize (int width, int ascent, int descent)
43 | {
44 | /**
45 | * \bug It has to be clarified, who is responsible for setting the
46 | * FLTK widget size. In the only used context (complex buttons),
47 | * it is done elsewhere.
48 | */
49 |
50 | #if 0
51 | FltkWidgetView::setCanvasSize (width, ascent, descent);
52 |
53 | w (width);
54 | h (ascent + descent);
55 | #endif
56 | }
57 |
58 | bool FltkFlatView::usesViewport ()
59 | {
60 | return false;
61 | }
62 |
63 | int FltkFlatView::getHScrollbarThickness ()
64 | {
65 | return 0;
66 | }
67 |
68 | int FltkFlatView::getVScrollbarThickness ()
69 | {
70 | return 0;
71 | }
72 |
73 | void FltkFlatView::scrollTo (int x, int y)
74 | {
75 | }
76 |
77 | void FltkFlatView::setViewportSize (int width, int height,
78 | int hScrollbarThickness,
79 | int vScrollbarThickness)
80 | {
81 | }
82 |
83 | int FltkFlatView::translateViewXToCanvasX (int X)
84 | {
85 | return X - x ();
86 | }
87 |
88 | int FltkFlatView::translateViewYToCanvasY (int Y)
89 | {
90 | return Y - y ();
91 | }
92 |
93 | int FltkFlatView::translateCanvasXToViewX (int X)
94 | {
95 | return X + x ();
96 | }
97 |
98 | int FltkFlatView::translateCanvasYToViewY (int Y)
99 | {
100 | return Y + y ();
101 | }
102 |
103 |
104 | } // namespace fltk
105 | } // namespace dw
106 |
--------------------------------------------------------------------------------
/dw/fltkpreview.hh:
--------------------------------------------------------------------------------
1 | #ifndef __FlTKPREVIEW_HH__
2 | #define __FlTKPREVIEW_HH__
3 |
4 | #include
5 | #include
6 | #include "fltkviewbase.hh"
7 |
8 | namespace dw {
9 | namespace fltk {
10 |
11 | class FltkPreview: public FltkViewBase
12 | {
13 | friend class FltkPreviewWindow;
14 |
15 | private:
16 | int scrollX, scrollY, scrollWidth, scrollHeight;
17 |
18 | protected:
19 | int translateViewXToCanvasX (int x);
20 | int translateViewYToCanvasY (int y);
21 | int translateCanvasXToViewX (int x);
22 | int translateCanvasYToViewY (int y);
23 |
24 | public:
25 | FltkPreview (int x, int y, int w, int h, dw::core::Layout *layout,
26 | const char *label = 0);
27 | ~FltkPreview ();
28 |
29 | int handle (int event);
30 |
31 | void setCanvasSize (int width, int ascent, int descent);
32 |
33 | bool usesViewport ();
34 | int getHScrollbarThickness ();
35 | int getVScrollbarThickness ();
36 | void scrollTo (int x, int y);
37 | void scroll (dw::core::ScrollCommand cmd);
38 | void setViewportSize (int width, int height,
39 | int hScrollbarThickness, int vScrollbarThickness);
40 |
41 | void drawText (core::style::Font *font,
42 | core::style::Color *color,
43 | core::style::Color::Shading shading,
44 | int x, int y, const char *text, int len);
45 | void drawSimpleWrappedText (core::style::Font *font,
46 | core::style::Color *color,
47 | core::style::Color::Shading shading,
48 | int x, int y, int w, int h,
49 | const char *text);
50 | void drawImage (core::Imgbuf *imgbuf, int xRoot, int yRoot,
51 | int x, int y, int width, int height);
52 |
53 | bool usesFltkWidgets ();
54 | void drawFltkWidget (Fl_Widget *widget, core::Rectangle *area);
55 | };
56 |
57 |
58 | class FltkPreviewWindow: public Fl_Menu_Window
59 | {
60 | private:
61 | enum { BORDER_WIDTH = 2 };
62 |
63 | FltkPreview *preview;
64 | int posX, posY;
65 |
66 | public:
67 | FltkPreviewWindow (dw::core::Layout *layout);
68 | ~FltkPreviewWindow ();
69 |
70 | void reallocate ();
71 |
72 | void showWindow ();
73 | void hideWindow ();
74 |
75 | void scrollTo (int mouseX, int mouseY);
76 | };
77 |
78 |
79 | class FltkPreviewButton: public Fl_Button
80 | {
81 | private:
82 | FltkPreviewWindow *window;
83 |
84 | public:
85 | FltkPreviewButton (int x, int y, int w, int h,
86 | dw::core::Layout *layout, const char *label = 0);
87 | ~FltkPreviewButton ();
88 |
89 | int handle (int event);
90 | };
91 |
92 | } // namespace fltk
93 | } // namespace dw
94 |
95 | #endif // __FlTKPREVIEW_HH__
96 |
--------------------------------------------------------------------------------
/lout/debug.hh:
--------------------------------------------------------------------------------
1 | #ifndef __LOUT_DEBUG_H__
2 | #define __LOUT_DEBUG_H__
3 |
4 | /*
5 | * Simple debug messages. Add:
6 | *
7 | * #define DEBUG_LEVEL
8 | * #include "debug.h"
9 | *
10 | * to the file you are working on, or let DEBUG_LEVEL undefined to
11 | * disable all messages. A higher level denotes a greater importance
12 | * of the message.
13 | */
14 |
15 | #include
16 |
17 | #define D_STMT_START do
18 | #define D_STMT_END while (0)
19 |
20 | #define D_STMT_NOP D_STMT_START { } D_STMT_END
21 |
22 | # ifdef DEBUG_LEVEL
23 | # define DEBUG_MSG(level, ...) \
24 | D_STMT_START { \
25 | if (DEBUG_LEVEL && (level) >= DEBUG_LEVEL) \
26 | printf(__VA_ARGS__); \
27 | } D_STMT_END
28 | # else
29 | # define DEBUG_MSG(level, ...)
30 | # endif /* DEBUG_LEVEL */
31 |
32 | #include "debug_rtfl.hh"
33 |
34 | /* Some extensions for RTFL dealing with static stuff. */
35 |
36 | #ifdef DBG_RTFL
37 |
38 | #define DBG_OBJ_MSG_S(aspect, prio, msg) \
39 | RTFL_OBJ_PRINT ("msg", "s:s:d:s", "", aspect, prio, msg)
40 |
41 | #define DBG_OBJ_MSGF_S(aspect, prio, fmt, ...) \
42 | STMT_START { \
43 | char msg[256]; \
44 | snprintf (msg, sizeof (msg), fmt, __VA_ARGS__); \
45 | RTFL_OBJ_PRINT ("msg", "s:s:d:s", "", aspect, prio, msg) \
46 | } STMT_END
47 |
48 | #define DBG_OBJ_ENTER0_S(aspect, prio, funname) \
49 | RTFL_OBJ_PRINT ("enter", "s:s:d:s:", "", aspect, prio, funname);
50 |
51 | #define DBG_OBJ_ENTER_S(aspect, prio, funname, fmt, ...) \
52 | STMT_START { \
53 | char args[256]; \
54 | snprintf (args, sizeof (args), fmt, __VA_ARGS__); \
55 | RTFL_OBJ_PRINT ("enter", "s:s:d:s:s", "", aspect, prio, funname, \
56 | args); \
57 | } STMT_END
58 |
59 | #define DBG_OBJ_LEAVE_S() \
60 | RTFL_OBJ_PRINT ("leave", "s", "");
61 |
62 | #define DBG_OBJ_LEAVE_VAL_S(fmt, ...) \
63 | STMT_START { \
64 | char vals[256]; \
65 | snprintf (vals, sizeof (vals), fmt, __VA_ARGS__); \
66 | RTFL_OBJ_PRINT ("leave", "s:s", "", vals); \
67 | } STMT_END
68 |
69 | #else /* DBG_RTFL */
70 |
71 | #define STMT_NOP do { } while (0)
72 |
73 | #define DBG_IF_RTFL if(0)
74 |
75 | #define DBG_OBJ_MSG_S(aspect, prio, msg) STMT_NOP
76 | #define DBG_OBJ_MSGF_S(aspect, prio, fmt, ...) STMT_NOP
77 | #define DBG_OBJ_ENTER0_S(aspect, prio, funname) STMT_NOP
78 | #define DBG_OBJ_ENTER_S(aspect, prio, funname, fmt, ...) STMT_NOP
79 | #define DBG_OBJ_LEAVE_S() STMT_NOP
80 | #define DBG_OBJ_LEAVE_VAL_S(fmt, ...) STMT_NOP
81 |
82 | #endif /* DBG_RTFL */
83 |
84 | #endif /* __LOUT_DEBUG_H__ */
85 |
86 |
87 |
--------------------------------------------------------------------------------
/dw/table_iterator.cc:
--------------------------------------------------------------------------------
1 | /*
2 | * Dillo Widget
3 | *
4 | * Copyright 2005-2007, 2014 Sebastian Geerken
5 | *
6 | * (This file was originally part of textblock.cc.)
7 | *
8 | * This program is free software; you can redistribute it and/or modify
9 | * it under the terms of the GNU General Public License as published by
10 | * the Free Software Foundation; either version 3 of the License, or
11 | * (at your option) any later version.
12 | *
13 | * This program is distributed in the hope that it will be useful,
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | * GNU General Public License for more details.
17 | *
18 | * You should have received a copy of the GNU General Public License
19 | * along with this program. If not, see .
20 | */
21 |
22 |
23 | #include "table.hh"
24 |
25 | using namespace lout;
26 |
27 | namespace dw {
28 |
29 | Table::TableIterator::TableIterator (Table *table,
30 | core::Content::Type mask, bool atEnd):
31 | OOFAwareWidgetIterator (table, mask, atEnd, table->children->size ())
32 | {
33 | }
34 |
35 | object::Object *Table::TableIterator::clone()
36 | {
37 | TableIterator *tIt =
38 | new TableIterator ((Table*)getWidget(), getMask(), false);
39 | cloneValues (tIt);
40 | return tIt;
41 | }
42 |
43 |
44 | void Table::TableIterator::highlight (int start, int end,
45 | core::HighlightLayer layer)
46 | {
47 | if (inFlow ()) {
48 | /** todo Needs this an implementation? */
49 | } else
50 | highlightOOF (start, end, layer);
51 | }
52 |
53 | void Table::TableIterator::unhighlight (int direction,
54 | core::HighlightLayer layer)
55 | {
56 | if (inFlow ()) {
57 | // ???
58 | } else
59 | unhighlightOOF (direction, layer);
60 | }
61 |
62 | void Table::TableIterator::getAllocation (int start, int end,
63 | core::Allocation *allocation)
64 | {
65 | if (inFlow ()) {
66 | /** \bug Not implemented. */
67 | } else
68 | getAllocationOOF (start, end, allocation);
69 | }
70 |
71 | int Table::TableIterator::numContentsInFlow ()
72 | {
73 | return ((Table*)getWidget())->children->size ();
74 | }
75 |
76 | void Table::TableIterator::getContentInFlow (int index,
77 | core::Content *content)
78 | {
79 | Table *table = (Table*)getWidget();
80 |
81 | if (table->children->get(index) != NULL &&
82 | table->children->get(index)->type == Child::CELL) {
83 | content->type = core::Content::WIDGET_IN_FLOW;
84 | content->widget = table->children->get(index)->cell.widget;
85 | } else
86 | content->type = core::Content::INVALID;
87 | }
88 |
89 | } // namespace dw
90 |
--------------------------------------------------------------------------------