X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/5f4cd605aa4bb463999693b04ee3cd42eb6ec8c3..06cc1fb991aa0b6ec8966627d3c6d6bd0ade04be:/include/wx/html/htmlcell.h diff --git a/include/wx/html/htmlcell.h b/include/wx/html/htmlcell.h index 5be4aad97c..f5bc99c58b 100644 --- a/include/wx/html/htmlcell.h +++ b/include/wx/html/htmlcell.h @@ -12,7 +12,7 @@ #ifndef _WX_HTMLCELL_H_ #define _WX_HTMLCELL_H_ -#ifdef __GNUG__ +#if defined(__GNUG__) && !defined(__APPLE__) #pragma interface "htmlcell.h" #endif @@ -52,6 +52,9 @@ public: int GetHeight() const {return m_Height;} int GetDescent() const {return m_Descent;} + const wxString& GetId() const { return m_id; } + void SetId(const wxString& id) { m_id = id; } + // returns the link associated with this cell. The position is position within // the cell so it varies from 0 to m_Width, from 0 to m_Height virtual wxHtmlLinkInfo* GetLink(int WXUNUSED(x) = 0, int WXUNUSED(y) = 0) const @@ -60,7 +63,7 @@ public: // members access methods wxHtmlCell *GetNext() const {return m_Next;} - // members writin methods + // members writing methods virtual void SetPos(int x, int y) {m_PosX = x, m_PosY = y;} void SetLink(const wxHtmlLinkInfo& link); void SetNext(wxHtmlCell *cell) {m_Next = cell;} @@ -72,11 +75,11 @@ public: virtual void Layout(int w); // renders the cell - virtual void Draw(wxDC& dc, int x, int y, int view_y1, int view_y2) {} + virtual void Draw(wxDC& WXUNUSED(dc), int WXUNUSED(x), int WXUNUSED(y), int WXUNUSED(view_y1), int WXUNUSED(view_y2)) {} // proceed drawing actions in case the cell is not visible (scrolled out of screen). // This is needed to change fonts, colors and so on - virtual void DrawInvisible(wxDC& dc, int x, int y) {} + virtual void DrawInvisible(wxDC& WXUNUSED(dc), int WXUNUSED(x), int WXUNUSED(y)) {} // This method returns pointer to the FIRST cell for that // the condition @@ -91,11 +94,10 @@ public: virtual const wxHtmlCell* Find(int condition, const void* param) const; // This function is called when mouse button is clicked over the cell. - // left, middle, right are flags indicating whether the button was or wasn't - // pressed. + // // Parent is pointer to wxHtmlWindow that generated the event // HINT: if this handling is not enough for you you should use - // wxHtmlBinderCell + // wxHtmlWidgetCell virtual void OnMouseClick(wxWindow *parent, int x, int y, const wxMouseEvent& event); // This method used to adjust pagebreak position. The parameter is @@ -110,23 +112,42 @@ public: // Sets cell's behaviour on pagebreaks (see AdjustPagebreak). Default // is true - the cell can be split on two pages - void SetCanLiveOnPagebreak(bool can) {m_CanLiveOnPagebreak = can;} + void SetCanLiveOnPagebreak(bool can) { m_CanLiveOnPagebreak = can; } + + // Returns y-coordinates that contraint the cell, i.e. left is highest + // and right lowest coordinate such that the cell lays between then. + // Note: this method does not return meaningful values if you haven't + // called Layout() before! + virtual void GetHorizontalConstraints(int *left, int *right) const; + // Returns true for simple == terminal cells, i.e. not composite ones. + // This if for internal usage only and may disappear in future versions! + virtual bool IsTerminalCell() const { return TRUE; } + + // Find the terminal cell inside this cell at the given position (relative + // to this cell) + // + // Returns NULL if not found + virtual wxHtmlCell *FindCellByPos(wxCoord x, wxCoord y) const; protected: wxHtmlCell *m_Next; // pointer to the next cell wxHtmlContainerCell *m_Parent; - // pointer to parent cell + // pointer to parent cell long m_Width, m_Height, m_Descent; // dimensions of fragment // m_Descent is used to position text&images.. long m_PosX, m_PosY; // position where the fragment is drawn wxHtmlLinkInfo *m_Link; - // destination address if this fragment is hypertext link, "" otherwise + // destination address if this fragment is hypertext link, NULL otherwise bool m_CanLiveOnPagebreak; // true if this cell can be placed on pagebreak, false otherwise + wxString m_id; + // unique identifier of the cell, generated from "id" property of tags + + DECLARE_NO_COPY_CLASS(wxHtmlCell) }; @@ -200,14 +221,23 @@ public: void SetMinHeight(int h, int align = wxHTML_ALIGN_TOP) {m_MinHeight = h; m_MinHeightAlign = align; m_LastLayout = -1;} void SetBackgroundColour(const wxColour& clr) {m_UseBkColour = TRUE; m_BkColour = clr;} + // returns background colour (of wxNullColour if none set), so that widgets can + // adapt to it: + wxColour GetBackgroundColour(); void SetBorder(const wxColour& clr1, const wxColour& clr2) {m_UseBorder = TRUE; m_BorderColour1 = clr1, m_BorderColour2 = clr2;} virtual wxHtmlLinkInfo* GetLink(int x = 0, int y = 0) const; virtual const wxHtmlCell* Find(int condition, const void* param) const; virtual void OnMouseClick(wxWindow *parent, int x, int y, const wxMouseEvent& event); + virtual void GetHorizontalConstraints(int *left, int *right) const; // returns pointer to the first cell in container or NULL wxHtmlCell* GetFirstCell() const {return m_Cells;} + // see comment in wxHtmlCell about this method + virtual bool IsTerminalCell() const { return FALSE; } + + virtual wxHtmlCell *FindCellByPos(wxCoord x, wxCoord y) const; + protected: int m_IndentLeft, m_IndentRight, m_IndentTop, m_IndentBottom; // indentation of subcells. There is always m_Indent pixels @@ -231,6 +261,8 @@ protected: int m_LastLayout; // if != -1 then call to Layout may be no-op // if previous call to Layout has same argument + + DECLARE_NO_COPY_CLASS(wxHtmlContainerCell) }; @@ -302,6 +334,8 @@ protected: wxWindow* m_Wnd; int m_WidthFloat; // width float is used in adjustWidth (it is in percents) + + DECLARE_NO_COPY_CLASS(wxHtmlWidgetCell) };