Home | History | Annotate | Download | only in wml
      1 /*
      2  * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
      3  *
      4  * This library is free software; you can redistribute it and/or
      5  * modify it under the terms of the GNU Library General Public
      6  * License as published by the Free Software Foundation; either
      7  * version 2 of the License, or (at your option) any later version.
      8  *
      9  * This library is distributed in the hope that it will be useful,
     10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
     11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     12  * Library General Public License for more details.
     13  *
     14  * You should have received a copy of the GNU Library General Public License
     15  * along with this library; see the file COPYING.LIB.  If not, write to
     16  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
     17  * Boston, MA 02110-1301, USA.
     18  *
     19  */
     20 
     21 #ifndef WMLCardElement_h
     22 #define WMLCardElement_h
     23 
     24 #if ENABLE(WML)
     25 #include "WMLEventHandlingElement.h"
     26 
     27 #include <wtf/Vector.h>
     28 
     29 namespace WebCore {
     30 
     31 class WMLTemplateElement;
     32 class WMLTimerElement;
     33 
     34 class WMLCardElement : public WMLElement, public WMLEventHandlingElement {
     35 public:
     36     static PassRefPtr<WMLCardElement> create(const QualifiedName& tagName, Document*);
     37 
     38     WMLCardElement(const QualifiedName&, Document*);
     39     virtual ~WMLCardElement();
     40 
     41     bool isNewContext() const { return m_isNewContext; }
     42     bool isOrdered() const { return m_isOrdered; }
     43     WMLTimerElement* eventTimer() const { return m_eventTimer; }
     44     WMLTemplateElement* templateElement() const { return m_template; }
     45 
     46     void setTemplateElement(WMLTemplateElement*);
     47     void setIntrinsicEventTimer(WMLTimerElement*);
     48 
     49     void handleIntrinsicEventIfNeeded();
     50     void handleDeckLevelTaskOverridesIfNeeded();
     51 
     52     virtual void parseMappedAttribute(Attribute*);
     53     virtual void insertedIntoDocument();
     54     virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
     55 
     56     // Switch active card in document to the one specified in the URL reference (foo.wml#mycard)
     57     // If the 'targetUrl' doesn't contain a reference, use the first <card> element in the document.
     58     static WMLCardElement* determineActiveCard(Document*);
     59     static WMLCardElement* findNamedCardInDocument(Document*, const String& cardName);
     60 
     61 private:
     62     bool isVisible() const { return m_isVisible; }
     63 
     64     void showCard();
     65     void hideCard();
     66 
     67     bool m_isNewContext;
     68     bool m_isOrdered;
     69     bool m_isVisible;
     70 
     71     WMLTimerElement* m_eventTimer;
     72     WMLTemplateElement* m_template;
     73 };
     74 
     75 }
     76 
     77 #endif
     78 #endif
     79