"Fossies" - the Fresh Open Source Software Archive

Member "google-gadgets-for-linux-0.11.2/ggadget/gtk/cairo_graphics.h" (15 Mar 2009, 2273 Bytes) of package /linux/misc/old/google-gadgets-for-linux-0.11.2.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 /*
    2   Copyright 2008 Google Inc.
    3 
    4   Licensed under the Apache License, Version 2.0 (the "License");
    5   you may not use this file except in compliance with the License.
    6   You may obtain a copy of the License at
    7 
    8        http://www.apache.org/licenses/LICENSE-2.0
    9 
   10   Unless required by applicable law or agreed to in writing, software
   11   distributed under the License is distributed on an "AS IS" BASIS,
   12   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   13   See the License for the specific language governing permissions and
   14   limitations under the License.
   15 */
   16 
   17 #ifndef GGADGET_GTK_CAIRO_GRAPHICS_H__
   18 #define GGADGET_GTK_CAIRO_GRAPHICS_H__
   19 
   20 #include <ggadget/common.h>
   21 #include <ggadget/graphics_interface.h>
   22 #include <ggadget/slot.h>
   23 
   24 namespace ggadget {
   25 namespace gtk {
   26 
   27 /**
   28  * @defgroup GtkLibrary libggadget-gtk - the Gtk based GUI implementation
   29  * @ingroup SharedLibraries
   30  *
   31  * This shared library contains implementations for all GUI related interfaces
   32  * based on Gtk, as well as necessary utilities for a Gtk based host
   33  * application.
   34  */
   35 
   36 /**
   37  * @ingroup GtkLibrary
   38  * This class implements the GraphicsInterface using the Cairo graphics library.
   39  * It is responsible for creating CanvasInterface objects for ggadget.
   40  */
   41 class CairoGraphics : public GraphicsInterface {
   42  public:
   43   /**
   44    * Constructs a CairoGraphics object
   45    * @param zoom The zoom level for all new canvases.
   46    */
   47   CairoGraphics(double zoom);
   48   virtual ~CairoGraphics();
   49 
   50   Connection *ConnectOnZoom(Slot1<void, double> *slot) const;
   51 
   52  public:
   53   virtual CanvasInterface *NewCanvas(double w, double h) const;
   54 
   55   virtual ImageInterface *NewImage(const std::string &tag,
   56                                    const std::string &data,
   57                                    bool is_mask) const;
   58 
   59   virtual FontInterface *NewFont(const std::string &family,
   60                                  double pt_size,
   61                                  FontInterface::Style style,
   62                                  FontInterface::Weight weight) const;
   63 
   64   virtual void SetZoom(double zoom);
   65   virtual double GetZoom() const;
   66 
   67  private:
   68   class Impl;
   69   Impl *impl_;
   70 
   71   DISALLOW_EVIL_CONSTRUCTORS(CairoGraphics);
   72 };
   73 
   74 } // namespace gtk
   75 } // namespace ggadget
   76 
   77 #endif // GGADGET_GTK_CAIRO_GRAPHICS_H__