mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
c++ headers cleanup
This commit is contained in:
parent
dd2ebce57e
commit
0d8afd9f0c
3 changed files with 67 additions and 79 deletions
|
@ -6,19 +6,19 @@
|
|||
#include "App.xaml.g.h"
|
||||
|
||||
namespace winrt::ServoApp::implementation {
|
||||
using namespace winrt::Windows::Foundation;
|
||||
using namespace winrt::Windows::UI::Xaml;
|
||||
using namespace winrt::Windows::ApplicationModel;
|
||||
using namespace winrt::Windows::ApplicationModel::Activation;
|
||||
|
||||
struct App : AppT<App> {
|
||||
App();
|
||||
|
||||
void createRootFrame(winrt::Windows::UI::Xaml::Controls::Frame &, bool,
|
||||
winrt::Windows::Foundation::IInspectable const &);
|
||||
void OnLaunched(
|
||||
Windows::ApplicationModel::Activation::LaunchActivatedEventArgs const &);
|
||||
void App::OnActivated(
|
||||
Windows::ApplicationModel::Activation::IActivatedEventArgs const &);
|
||||
void OnSuspending(IInspectable const &,
|
||||
Windows::ApplicationModel::SuspendingEventArgs const &);
|
||||
void OnNavigationFailed(
|
||||
IInspectable const &,
|
||||
Windows::UI::Xaml::Navigation::NavigationFailedEventArgs const &);
|
||||
void createRootFrame(Controls::Frame &, bool, IInspectable const &);
|
||||
void OnLaunched(LaunchActivatedEventArgs const &);
|
||||
void App::OnActivated(IActivatedEventArgs const &);
|
||||
void OnSuspending(IInspectable const &, SuspendingEventArgs const &);
|
||||
void OnNavigationFailed(IInspectable const &,
|
||||
Navigation::NavigationFailedEventArgs const &);
|
||||
};
|
||||
} // namespace winrt::ServoApp::implementation
|
||||
|
|
|
@ -9,7 +9,9 @@
|
|||
|
||||
namespace winrt::ServoApp::implementation {
|
||||
|
||||
using namespace winrt::Windows;
|
||||
using namespace winrt::Windows::Foundation;
|
||||
using namespace winrt::Windows::UI::Xaml;
|
||||
|
||||
static const hstring SERVO_SCHEME = L"fxr";
|
||||
static const hstring SERVO_SCHEME_SLASH_SLASH = L"fxr://";
|
||||
|
@ -18,38 +20,30 @@ struct BrowserPage : BrowserPageT<BrowserPage> {
|
|||
public:
|
||||
BrowserPage();
|
||||
|
||||
void OnForwardButtonClicked(Windows::Foundation::IInspectable const &,
|
||||
Windows::UI::Xaml::RoutedEventArgs const &);
|
||||
void OnBackButtonClicked(Windows::Foundation::IInspectable const &,
|
||||
Windows::UI::Xaml::RoutedEventArgs const &);
|
||||
void OnReloadButtonClicked(Windows::Foundation::IInspectable const &,
|
||||
Windows::UI::Xaml::RoutedEventArgs const &);
|
||||
void OnStopButtonClicked(Windows::Foundation::IInspectable const &,
|
||||
Windows::UI::Xaml::RoutedEventArgs const &);
|
||||
void OnHomeButtonClicked(Windows::Foundation::IInspectable const &,
|
||||
Windows::UI::Xaml::RoutedEventArgs const &);
|
||||
void OnDevtoolsButtonClicked(Windows::Foundation::IInspectable const &,
|
||||
Windows::UI::Xaml::RoutedEventArgs const &);
|
||||
void OnURLEdited(Windows::Foundation::IInspectable const &,
|
||||
Windows::UI::Xaml::Input::KeyRoutedEventArgs const &);
|
||||
void OnURLFocused(Windows::Foundation::IInspectable const &);
|
||||
void OnURLKeyboardAccelerator(
|
||||
Windows::Foundation::IInspectable const &,
|
||||
Windows::UI::Xaml::Input::KeyboardAcceleratorInvokedEventArgs const &);
|
||||
void OnForwardButtonClicked(IInspectable const &, RoutedEventArgs const &);
|
||||
void OnBackButtonClicked(IInspectable const &, RoutedEventArgs const &);
|
||||
void OnReloadButtonClicked(IInspectable const &, RoutedEventArgs const &);
|
||||
void OnStopButtonClicked(IInspectable const &, RoutedEventArgs const &);
|
||||
void OnHomeButtonClicked(IInspectable const &, RoutedEventArgs const &);
|
||||
void OnDevtoolsButtonClicked(IInspectable const &, RoutedEventArgs const &);
|
||||
void OnURLEdited(IInspectable const &, Input::KeyRoutedEventArgs const &);
|
||||
void OnURLFocused(IInspectable const &);
|
||||
void
|
||||
OnURLKeyboardAccelerator(IInspectable const &,
|
||||
Input::KeyboardAcceleratorInvokedEventArgs const &);
|
||||
void Shutdown();
|
||||
void LoadServoURI(Windows::Foundation::Uri uri);
|
||||
void LoadServoURI(Uri uri);
|
||||
void SetTransientMode(bool);
|
||||
void SetArgs(hstring);
|
||||
void OnMediaControlsPlayClicked(Windows::Foundation::IInspectable const &,
|
||||
Windows::UI::Xaml::RoutedEventArgs const &);
|
||||
void OnMediaControlsPauseClicked(Windows::Foundation::IInspectable const &,
|
||||
Windows::UI::Xaml::RoutedEventArgs const &);
|
||||
void OnPrefererenceSearchboxEdited(
|
||||
Windows::Foundation::IInspectable const &,
|
||||
Windows::UI::Xaml::Input::KeyRoutedEventArgs const &);
|
||||
void OnMediaControlsPlayClicked(IInspectable const &,
|
||||
RoutedEventArgs const &);
|
||||
void OnMediaControlsPauseClicked(IInspectable const &,
|
||||
RoutedEventArgs const &);
|
||||
void OnPrefererenceSearchboxEdited(IInspectable const &,
|
||||
Input::KeyRoutedEventArgs const &);
|
||||
|
||||
private:
|
||||
void UpdatePref(ServoApp::Pref, Windows::UI::Xaml::Controls::Control);
|
||||
void UpdatePref(ServoApp::Pref, Controls::Control);
|
||||
void BindServoEvents();
|
||||
void BuildPrefList();
|
||||
DevtoolsStatus mDevtoolsStatus = DevtoolsStatus::Stopped;
|
||||
|
|
|
@ -17,6 +17,8 @@ extern "C" {
|
|||
}
|
||||
} // namespace capi
|
||||
|
||||
using namespace capi;
|
||||
|
||||
hstring char2hstring(const char *);
|
||||
std::unique_ptr<char *> hstring2char(hstring);
|
||||
|
||||
|
@ -39,57 +41,49 @@ public:
|
|||
static PrefTuple SetFloatPref(hstring key, double val);
|
||||
static PrefTuple ResetPref(hstring key);
|
||||
|
||||
typedef capi::CMouseButton MouseButton;
|
||||
typedef capi::CPromptResult PromptResult;
|
||||
typedef capi::CContextMenuResult ContextMenuResult;
|
||||
typedef capi::CMediaSessionActionType MediaSessionActionType;
|
||||
typedef capi::CMediaSessionPlaybackState MediaSessionPlaybackState;
|
||||
typedef capi::CDevtoolsServerState DevtoolsServerState;
|
||||
typedef capi::CPrefType CPrefType;
|
||||
typedef CMouseButton MouseButton;
|
||||
typedef CPromptResult PromptResult;
|
||||
typedef CContextMenuResult ContextMenuResult;
|
||||
typedef CMediaSessionActionType MediaSessionActionType;
|
||||
typedef CMediaSessionPlaybackState MediaSessionPlaybackState;
|
||||
typedef CDevtoolsServerState DevtoolsServerState;
|
||||
typedef CPrefType CPrefType;
|
||||
|
||||
void PerformUpdates() { capi::perform_updates(); }
|
||||
void DeInit() { capi::deinit(); }
|
||||
void RequestShutdown() { capi::request_shutdown(); }
|
||||
void SetBatchMode(bool mode) { capi::set_batch_mode(mode); }
|
||||
void GoForward() { capi::go_forward(); }
|
||||
void GoBack() { capi::go_back(); }
|
||||
void Click(float x, float y) { capi::click(x, y); }
|
||||
void MouseDown(float x, float y, capi::CMouseButton b) {
|
||||
capi::mouse_down(x, y, b);
|
||||
}
|
||||
void MouseUp(float x, float y, capi::CMouseButton b) {
|
||||
capi::mouse_up(x, y, b);
|
||||
}
|
||||
void TouchDown(float x, float y, int32_t id) { capi::touch_down(x, y, id); }
|
||||
void TouchUp(float x, float y, int32_t id) { capi::touch_up(x, y, id); }
|
||||
void TouchMove(float x, float y, int32_t id) { capi::touch_move(x, y, id); }
|
||||
void TouchCancel(float x, float y, int32_t id) {
|
||||
capi::touch_cancel(x, y, id);
|
||||
}
|
||||
void MouseMove(float x, float y) { capi::mouse_move(x, y); }
|
||||
void PerformUpdates() { perform_updates(); }
|
||||
void DeInit() { deinit(); }
|
||||
void RequestShutdown() { request_shutdown(); }
|
||||
void SetBatchMode(bool mode) { set_batch_mode(mode); }
|
||||
void GoForward() { go_forward(); }
|
||||
void GoBack() { go_back(); }
|
||||
void Click(float x, float y) { click(x, y); }
|
||||
void MouseDown(float x, float y, CMouseButton b) { mouse_down(x, y, b); }
|
||||
void MouseUp(float x, float y, CMouseButton b) { mouse_up(x, y, b); }
|
||||
void TouchDown(float x, float y, int32_t id) { touch_down(x, y, id); }
|
||||
void TouchUp(float x, float y, int32_t id) { touch_up(x, y, id); }
|
||||
void TouchMove(float x, float y, int32_t id) { touch_move(x, y, id); }
|
||||
void TouchCancel(float x, float y, int32_t id) { touch_cancel(x, y, id); }
|
||||
void MouseMove(float x, float y) { mouse_move(x, y); }
|
||||
|
||||
void Reload() { capi::reload(); }
|
||||
void Stop() { capi::stop(); }
|
||||
bool LoadUri(hstring uri) { return capi::load_uri(*hstring2char(uri)); }
|
||||
void ChangeVisibility(bool visible) { capi::change_visibility(visible); }
|
||||
bool IsUriValid(hstring uri) {
|
||||
return capi::is_uri_valid(*hstring2char(uri));
|
||||
}
|
||||
void Reload() { reload(); }
|
||||
void Stop() { stop(); }
|
||||
bool LoadUri(hstring uri) { return load_uri(*hstring2char(uri)); }
|
||||
void ChangeVisibility(bool visible) { change_visibility(visible); }
|
||||
bool IsUriValid(hstring uri) { return is_uri_valid(*hstring2char(uri)); }
|
||||
void Scroll(float dx, float dy, float x, float y) {
|
||||
capi::scroll((int32_t)dx, (int32_t)dy, (int32_t)x, (int32_t)y);
|
||||
scroll((int32_t)dx, (int32_t)dy, (int32_t)x, (int32_t)y);
|
||||
}
|
||||
void SetSize(GLsizei width, GLsizei height) {
|
||||
if (width != mWindowWidth || height != mWindowHeight) {
|
||||
mWindowWidth = width;
|
||||
mWindowHeight = height;
|
||||
capi::resize(mWindowWidth, mWindowHeight);
|
||||
resize(mWindowWidth, mWindowHeight);
|
||||
}
|
||||
}
|
||||
void SendMediaSessionAction(capi::CMediaSessionActionType action) {
|
||||
capi::media_session_action(action);
|
||||
void SendMediaSessionAction(CMediaSessionActionType action) {
|
||||
media_session_action(action);
|
||||
}
|
||||
void ContextMenuClosed(capi::CContextMenuResult res, unsigned int idx) {
|
||||
capi::on_context_menu_closed(res, idx);
|
||||
void ContextMenuClosed(CContextMenuResult res, unsigned int idx) {
|
||||
on_context_menu_closed(res, idx);
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -97,7 +91,7 @@ private:
|
|||
GLsizei mWindowWidth;
|
||||
GLsizei mWindowHeight;
|
||||
static void SaveUserPref(PrefTuple);
|
||||
static PrefTuple WrapPref(capi::CPref cpref);
|
||||
static PrefTuple WrapPref(CPref cpref);
|
||||
};
|
||||
|
||||
class ServoDelegate {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue