Watch
1
0
Fork
You've already forked Seyyed_arc
0
forked from hesabix/arc
Seyyed_arc/hesabixUI/hesabix_ui/windows/runner/flutter_window.h
2026-10-31 10:20:18 +03:30

55 lines
1.6 KiB
C++
Executable file

#ifndef RUNNER_FLUTTER_WINDOW_H_
#define RUNNER_FLUTTER_WINDOW_H_
#include <flutter/dart_project.h>
#include <flutter/flutter_view_controller.h>
#include <flutter/method_channel.h>
#include <flutter/standard_method_codec.h>
#include <memory>
#include <string>
#include "win32_window.h"
// A window that does nothing but host a Flutter view.
class FlutterWindow : public Win32Window {
public:
// Creates a new FlutterWindow hosting a Flutter view running |project|.
explicit FlutterWindow(const flutter::DartProject& project);
virtual ~FlutterWindow();
protected:
// Win32Window:
bool OnCreate() override;
void OnDestroy() override;
LRESULT MessageHandler(HWND window, UINT const message, WPARAM const wparam,
LPARAM const lparam) noexcept override;
private:
void SetupCloseChannel();
void HideToTray();
void ShowFromTray();
void EnsureTrayIcon();
void RemoveTrayIcon();
void ShowIncomingBalloon(const std::wstring& title,
const std::wstring& body);
void ShowTrayMenu();
void NotifyDart(const char* method);
void ApplyTrayLabels(const flutter::EncodableMap* args);
// The project to run.
flutter::DartProject project_;
// The Flutter instance hosted by this window.
std::unique_ptr<flutter::FlutterViewController> flutter_controller_;
std::unique_ptr<flutter::MethodChannel<flutter::EncodableValue>>
close_channel_;
bool tray_added_ = false;
std::wstring tray_tooltip_ = L"Hesabix Softphone";
std::wstring tray_show_label_ = L"Show";
std::wstring tray_exit_label_ = L"Exit";
};
#endif // RUNNER_FLUTTER_WINDOW_H_