mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
79 lines
1.9 KiB
C++
79 lines
1.9 KiB
C++
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
/* vim: set ts=2 et sw=2 tw=80: */
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
|
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
#ifndef mozilla_widget_WinMouseScrollHandler_h__
|
|
#define mozilla_widget_WinMouseScrollHandler_h__
|
|
|
|
#include "nscore.h"
|
|
#include "nsDebug.h"
|
|
#include "mozilla/Assertions.h"
|
|
#include <windows.h>
|
|
|
|
class nsWindow;
|
|
|
|
namespace mozilla {
|
|
namespace widget {
|
|
|
|
class MouseScrollHandler {
|
|
public:
|
|
static MouseScrollHandler* GetInstance();
|
|
|
|
static void Initialize();
|
|
static void Shutdown();
|
|
|
|
static bool ProcessMessage(nsWindow* aWindow,
|
|
UINT msg,
|
|
WPARAM wParam,
|
|
LPARAM lParam,
|
|
LRESULT *aRetValue,
|
|
bool &aEatMessage);
|
|
|
|
private:
|
|
MouseScrollHandler();
|
|
~MouseScrollHandler();
|
|
|
|
static MouseScrollHandler* sInstance;
|
|
|
|
public:
|
|
class SystemSettings {
|
|
public:
|
|
SystemSettings() : mInitialized(false) {}
|
|
|
|
void Init();
|
|
void MarkDirty();
|
|
|
|
PRInt32 GetScrollAmount(bool aForVertical) const
|
|
{
|
|
MOZ_ASSERT(mInitialized, "SystemSettings must be initialized");
|
|
return aForVertical ? mScrollLines : mScrollChars;
|
|
}
|
|
|
|
bool IsPageScroll(bool aForVertical) const
|
|
{
|
|
MOZ_ASSERT(mInitialized, "SystemSettings must be initialized");
|
|
return aForVertical ? (mScrollLines == WHEEL_PAGESCROLL) :
|
|
(mScrollChars == WHEEL_PAGESCROLL);
|
|
}
|
|
|
|
private:
|
|
bool mInitialized;
|
|
PRInt32 mScrollLines;
|
|
PRInt32 mScrollChars;
|
|
};
|
|
|
|
SystemSettings& GetSystemSettings()
|
|
{
|
|
return mSystemSettings;
|
|
}
|
|
|
|
private:
|
|
SystemSettings mSystemSettings;
|
|
};
|
|
|
|
} // namespace widget
|
|
} // namespace mozilla
|
|
|
|
#endif // mozilla_widget_WinMouseScrollHandler_h__
|