mirror of
https://github.com/kunkundi/crossdesk.git
synced 2025-10-27 04:35:34 +08:00
66 lines
2.2 KiB
C++
66 lines
2.2 KiB
C++
#include "IconsFontAwesome6.h"
|
|
#include "layout_style.h"
|
|
#include "localization.h"
|
|
#include "rd_log.h"
|
|
#include "render.h"
|
|
|
|
int Render::ControlBar() {
|
|
ImVec2 bar_pos = ImGui::GetWindowPos();
|
|
|
|
ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, 3.0f);
|
|
|
|
if (control_bar_button_pressed_) {
|
|
ImGui::SetCursorPosX(is_control_bar_in_left_ ? (control_window_width_ + 5)
|
|
: 87);
|
|
// Mouse control
|
|
std::string mouse = ICON_FA_COMPUTER_MOUSE;
|
|
if (ImGui::Button(mouse.c_str(), ImVec2(25, 25))) {
|
|
if (mouse_control_button_label_ ==
|
|
localization::control_mouse[localization_language_index_] &&
|
|
connection_established_) {
|
|
mouse_control_button_pressed_ = true;
|
|
control_mouse_ = true;
|
|
mouse_control_button_label_ =
|
|
localization::release_mouse[localization_language_index_];
|
|
} else {
|
|
control_mouse_ = false;
|
|
mouse_control_button_label_ =
|
|
localization::control_mouse[localization_language_index_];
|
|
}
|
|
mouse_control_button_pressed_ = !mouse_control_button_pressed_;
|
|
}
|
|
|
|
ImGui::SameLine();
|
|
// Fullscreen
|
|
std::string fullscreen =
|
|
fullscreen_button_pressed_ ? ICON_FA_COMPRESS : ICON_FA_EXPAND;
|
|
if (ImGui::Button(fullscreen.c_str(), ImVec2(25, 25))) {
|
|
fullscreen_button_pressed_ = !fullscreen_button_pressed_;
|
|
if (fullscreen_button_pressed_) {
|
|
SDL_SetWindowFullscreen(main_window_, SDL_WINDOW_FULLSCREEN_DESKTOP);
|
|
} else {
|
|
SDL_SetWindowFullscreen(main_window_, SDL_FALSE);
|
|
}
|
|
}
|
|
|
|
ImGui::SameLine();
|
|
}
|
|
|
|
ImGui::SetCursorPosX(
|
|
is_control_bar_in_left_ ? (control_window_width_ * 2 - 18) : 3);
|
|
|
|
std::string control_bar =
|
|
control_bar_button_pressed_
|
|
? (is_control_bar_in_left_ ? ICON_FA_ANGLE_LEFT : ICON_FA_ANGLE_RIGHT)
|
|
: (is_control_bar_in_left_ ? ICON_FA_ANGLE_RIGHT
|
|
: ICON_FA_ANGLE_LEFT);
|
|
if (ImGui::Button(control_bar.c_str(), ImVec2(15, 25))) {
|
|
control_bar_button_pressed_ = !control_bar_button_pressed_;
|
|
control_bar_button_pressed_time_ = ImGui::GetTime();
|
|
control_window_width_is_changing_ = true;
|
|
}
|
|
|
|
ImGui::PopStyleVar();
|
|
|
|
return 0;
|
|
} |