"Fossies" - the Fresh Open Source Software Archive

Member "google-gadgets-for-linux-0.11.2/hosts/qt/gadget_browser_host.h" (28 Dec 2009, 2337 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 HOSTS_QT_GADGET_BROWSER_HOST_H__
   18 #define HOSTS_QT_GADGET_BROWSER_HOST_H__
   19 
   20 #include <ggadget/gadget_consts.h>
   21 #include <ggadget/host_interface.h>
   22 #include <ggadget/qt/qt_view_host.h>
   23 #include <ggadget/qt/utilities.h>
   24 
   25 namespace hosts {
   26 namespace qt {
   27 
   28 // A special Host for Gadget browser to show browser in a decorated window.
   29 class GadgetBrowserHost : public ggadget::HostInterface {
   30  public:
   31   GadgetBrowserHost(ggadget::HostInterface *owner, int view_debug_mode)
   32     : owner_(owner), view_debug_mode_(view_debug_mode) {
   33   }
   34   virtual ViewHostInterface *NewViewHost(Gadget *gadget,
   35                                          ViewHostInterface::Type type) {
   36     GGL_UNUSED(gadget);
   37     return new ggadget::qt::QtViewHost(
   38         type, 1.0, ggadget::qt::QtViewHost::FLAG_RECORD_STATES,
   39         view_debug_mode_, NULL);
   40   }
   41   virtual Gadget *LoadGadget(const char *path, const char *options_name,
   42                              int instance_id, bool show_debug_console) {
   43     GGL_UNUSED(path);
   44     GGL_UNUSED(options_name);
   45     GGL_UNUSED(instance_id);
   46     GGL_UNUSED(show_debug_console);
   47     return NULL;
   48   }
   49   virtual void RemoveGadget(Gadget *gadget, bool save_data) {
   50     GGL_UNUSED(save_data);    
   51     ggadget::GetGadgetManager()->RemoveGadgetInstance(gadget->GetInstanceID());
   52   }
   53   virtual bool LoadFont(const char *filename) {
   54     return owner_->LoadFont(filename);
   55   }
   56   virtual void Run() {}
   57   virtual void ShowGadgetDebugConsole(Gadget *) {}
   58   virtual int GetDefaultFontSize() { return ggadget::kDefaultFontSize; }
   59   virtual bool OpenURL(const Gadget *, const char *) { return false; }
   60  private:
   61   ggadget::HostInterface *owner_;
   62   int view_debug_mode_;
   63 };
   64 
   65 } // namespace qt
   66 } // namespace hosts
   67 
   68 #endif // HOSTS_QT_GADGET_BROWSER_HOST_H__