widget/gtk/nsGTKToolkit.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/widget/gtk/nsGTKToolkit.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,54 @@
     1.4 +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
     1.5 +/* vim:expandtab:shiftwidth=4:tabstop=4:
     1.6 + */
     1.7 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.8 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.9 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
    1.10 +
    1.11 +#ifndef GTKTOOLKIT_H      
    1.12 +#define GTKTOOLKIT_H
    1.13 +
    1.14 +#include "nsString.h"
    1.15 +#include <gtk/gtk.h>
    1.16 +
    1.17 +/**
    1.18 + * Wrapper around the thread running the message pump.
    1.19 + * The toolkit abstraction is necessary because the message pump must
    1.20 + * execute within the same thread that created the widget under Win32.
    1.21 + */ 
    1.22 +
    1.23 +class nsGTKToolkit
    1.24 +{
    1.25 +public:
    1.26 +    nsGTKToolkit();
    1.27 +
    1.28 +    static nsGTKToolkit* GetToolkit();
    1.29 +
    1.30 +    static void Shutdown() {
    1.31 +      delete gToolkit;
    1.32 +      gToolkit = nullptr;
    1.33 +    }
    1.34 +
    1.35 +    /**
    1.36 +     * Get/set our value of DESKTOP_STARTUP_ID. When non-empty, this is applied
    1.37 +     * to the next toplevel window to be shown or focused (and then immediately
    1.38 +     * cleared).
    1.39 +     */ 
    1.40 +    void SetDesktopStartupID(const nsACString& aID) { mDesktopStartupID = aID; }
    1.41 +    void GetDesktopStartupID(nsACString* aID) { *aID = mDesktopStartupID; }
    1.42 +
    1.43 +    /**
    1.44 +     * Get/set the timestamp value to be used, if non-zero, to focus the
    1.45 +     * next top-level window to be shown or focused (upon which it is cleared).
    1.46 +     */
    1.47 +    void SetFocusTimestamp(uint32_t aTimestamp) { mFocusTimestamp = aTimestamp; }
    1.48 +    uint32_t GetFocusTimestamp() { return mFocusTimestamp; }
    1.49 +
    1.50 +private:
    1.51 +    static nsGTKToolkit* gToolkit;
    1.52 +
    1.53 +    nsCString      mDesktopStartupID;
    1.54 +    uint32_t       mFocusTimestamp;
    1.55 +};
    1.56 +
    1.57 +#endif  // GTKTOOLKIT_H

mercurial