view dw/fltkplatform.hh @ 347:e5955ab8dafb

- Moved the dw2 tree into dillo2's tree.
author jcid
date Wed, 24 Sep 2008 18:44:40 +0200
children cdfdb006f193 2a712706829a
line wrap: on
line source

#   error Do not include this file directly, use "fltkcore.hh" instead.

#include <fltk/Font.h>

namespace dw {

 * \brief This namespace contains FLTK implementations of Dw interfaces.
namespace fltk {

class FltkFont: public core::style::Font
   static lout::container::typed::HashTable <dw::core::style::FontAttrs,
                                       FltkFont> *fontsTable;

   FltkFont (core::style::FontAttrs *attrs);
   ~FltkFont ();

   ::fltk::Font *font;
   static FltkFont *create (core::style::FontAttrs *attrs);

class FltkColor: public core::style::Color
   static lout::container::typed::HashTable <dw::core::style::ColorAttrs,
                                       FltkColor> *colorsTable;

   FltkColor (int color, core::style::Color::Type type);
   ~FltkColor ();

   int colors[SHADING_NUM];

   static FltkColor *create(int color, core::style::Color::Type type);

 * \brief This interface adds some more methods for all flkt-based views.
class FltkView: public core::View
   virtual bool usesFltkWidgets () = 0;

   virtual void addFltkWidget (::fltk::Widget *widget,
                               core::Allocation *allocation);
   virtual void removeFltkWidget (::fltk::Widget *widget);
   virtual void allocateFltkWidget (::fltk::Widget *widget,
                                    core::Allocation *allocation);
   virtual void drawFltkWidget (::fltk::Widget *widget, core::Rectangle *area);

class FltkPlatform: public core::Platform
   class FltkResourceFactory: public core::ui::ResourceFactory
      FltkPlatform *platform;

      inline void setPlatform (FltkPlatform *platform) {
         this->platform = platform; }

      core::ui::LabelButtonResource *createLabelButtonResource (const char
      core::ui::ComplexButtonResource *
      createComplexButtonResource (core::Widget *widget, bool relief);
      core::ui::ListResource *
      createListResource (core::ui::ListResource::SelectionMode selectionMode);
      core::ui::OptionMenuResource *createOptionMenuResource ();
      core::ui::EntryResource *createEntryResource (int maxLength,
                                                    bool password);
      core::ui::MultiLineTextResource *createMultiLineTextResource (int cols,
                                                                    int rows);
      core::ui::CheckButtonResource *createCheckButtonResource (bool
      core::ui::RadioButtonResource *
      createRadioButtonResource (core::ui::RadioButtonResource
                                  *groupedWith, bool activated);

   FltkResourceFactory resourceFactory;

   class IdleFunc: public lout::object::Object
      int id;
      void (core::Layout::*func) ();

   core::Layout *layout;

   lout::container::typed::List <IdleFunc> *idleQueue;
   bool idleFuncRunning;
   int idleFuncId;

   static void generalStaticIdle(void *data);
   void generalIdle();

   lout::container::typed::List <FltkView> *views;
   lout::container::typed::List <ui::FltkResource> *resources;

   FltkPlatform ();
   ~FltkPlatform ();

   void setLayout (core::Layout *layout);
   void attachView (core::View *view);

   void detachView  (core::View *view);
   int textWidth (core::style::Font *font, const char *text, int len);
   int nextGlyph (const char *text, int idx);
   int prevGlyph (const char *text, int idx);
   int addIdle (void (core::Layout::*func) ());
   void removeIdle (int idleId);
   core::style::Font *createFont (core::style::FontAttrs *attrs,
                                      bool tryEverything);
   core::style::Color *createSimpleColor (int color);
   core::style::Color *createShadedColor (int color);
   core::Imgbuf *createImgbuf (core::Imgbuf::Type type, int width, int height);

   void copySelection(const char *text);

   core::ui::ResourceFactory *getResourceFactory ();

   void attachResource (ui::FltkResource *resource);
   void detachResource (ui::FltkResource *resource);

} // namespace fltk
} // namespace dw

#endif // __DW_FLTKPLATFORM_HH__