mirror of
https://github.com/kunkundi/crossdesk.git
synced 2025-10-27 04:35:34 +08:00
[feat] expand control bar by default
This commit is contained in:
@@ -9,7 +9,7 @@ int Render::ControlBar() {
|
|||||||
|
|
||||||
ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, 3.0f);
|
ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, 3.0f);
|
||||||
|
|
||||||
if (control_bar_button_pressed_) {
|
if (control_bar_expand_) {
|
||||||
ImGui::SetCursorPosX(is_control_bar_in_left_ ? (control_window_width_ + 5)
|
ImGui::SetCursorPosX(is_control_bar_in_left_ ? (control_window_width_ + 5)
|
||||||
: 87);
|
: 87);
|
||||||
// Mouse control
|
// Mouse control
|
||||||
@@ -50,12 +50,12 @@ int Render::ControlBar() {
|
|||||||
is_control_bar_in_left_ ? (control_window_width_ * 2 - 18) : 3);
|
is_control_bar_in_left_ ? (control_window_width_ * 2 - 18) : 3);
|
||||||
|
|
||||||
std::string control_bar =
|
std::string control_bar =
|
||||||
control_bar_button_pressed_
|
control_bar_expand_
|
||||||
? (is_control_bar_in_left_ ? ICON_FA_ANGLE_LEFT : ICON_FA_ANGLE_RIGHT)
|
? (is_control_bar_in_left_ ? ICON_FA_ANGLE_LEFT : ICON_FA_ANGLE_RIGHT)
|
||||||
: (is_control_bar_in_left_ ? ICON_FA_ANGLE_RIGHT
|
: (is_control_bar_in_left_ ? ICON_FA_ANGLE_RIGHT
|
||||||
: ICON_FA_ANGLE_LEFT);
|
: ICON_FA_ANGLE_LEFT);
|
||||||
if (ImGui::Button(control_bar.c_str(), ImVec2(15, 25))) {
|
if (ImGui::Button(control_bar.c_str(), ImVec2(15, 25))) {
|
||||||
control_bar_button_pressed_ = !control_bar_button_pressed_;
|
control_bar_expand_ = !control_bar_expand_;
|
||||||
control_bar_button_pressed_time_ = ImGui::GetTime();
|
control_bar_button_pressed_time_ = ImGui::GetTime();
|
||||||
control_window_width_is_changing_ = true;
|
control_window_width_is_changing_ = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
int Render::ControlWindow() {
|
int Render::ControlWindow() {
|
||||||
auto time_duration = ImGui::GetTime() - control_bar_button_pressed_time_;
|
auto time_duration = ImGui::GetTime() - control_bar_button_pressed_time_;
|
||||||
if (control_window_width_is_changing_) {
|
if (control_window_width_is_changing_) {
|
||||||
if (control_bar_button_pressed_) {
|
if (control_bar_expand_) {
|
||||||
control_window_width_ =
|
control_window_width_ =
|
||||||
control_window_min_width_ +
|
control_window_min_width_ +
|
||||||
(control_window_max_width_ - control_window_min_width_) * 4 *
|
(control_window_max_width_ - control_window_min_width_) * 4 *
|
||||||
@@ -39,7 +39,7 @@ int Render::ControlWindow() {
|
|||||||
? title_bar_height_
|
? title_bar_height_
|
||||||
: (main_window_height_ - control_window_height_));
|
: (main_window_height_ - control_window_height_));
|
||||||
|
|
||||||
if (control_bar_button_pressed_) {
|
if (control_bar_expand_) {
|
||||||
if (control_window_width_ >= control_window_max_width_) {
|
if (control_window_width_ >= control_window_max_width_) {
|
||||||
control_window_width_ = control_window_max_width_;
|
control_window_width_ = control_window_max_width_;
|
||||||
control_window_width_is_changing_ = false;
|
control_window_width_is_changing_ = false;
|
||||||
@@ -66,7 +66,7 @@ int Render::ControlWindow() {
|
|||||||
? title_bar_height_
|
? title_bar_height_
|
||||||
: (main_window_height_ - control_window_height_));
|
: (main_window_height_ - control_window_height_));
|
||||||
|
|
||||||
if (control_bar_button_pressed_) {
|
if (control_bar_expand_) {
|
||||||
if (control_window_width_ >= control_window_max_width_) {
|
if (control_window_width_ >= control_window_max_width_) {
|
||||||
control_window_width_ = control_window_max_width_;
|
control_window_width_ = control_window_max_width_;
|
||||||
control_window_width_is_changing_ = false;
|
control_window_width_is_changing_ = false;
|
||||||
|
|||||||
@@ -145,7 +145,7 @@ class Render {
|
|||||||
int main_window_height_before_maximized_ = 570;
|
int main_window_height_before_maximized_ = 570;
|
||||||
int control_window_min_width_ = 20;
|
int control_window_min_width_ = 20;
|
||||||
int control_window_max_width_ = 150;
|
int control_window_max_width_ = 150;
|
||||||
int control_window_width_ = 20;
|
int control_window_width_ = 150;
|
||||||
int control_window_height_ = 40;
|
int control_window_height_ = 40;
|
||||||
int local_window_width_ = 350;
|
int local_window_width_ = 350;
|
||||||
int status_bar_height_ = 20;
|
int status_bar_height_ = 20;
|
||||||
@@ -184,7 +184,7 @@ class Render {
|
|||||||
bool connect_button_pressed_ = false;
|
bool connect_button_pressed_ = false;
|
||||||
bool password_validating_ = false;
|
bool password_validating_ = false;
|
||||||
uint32_t password_validating_time_ = 0;
|
uint32_t password_validating_time_ = 0;
|
||||||
bool control_bar_button_pressed_ = false;
|
bool control_bar_expand_ = true;
|
||||||
bool fullscreen_button_pressed_ = false;
|
bool fullscreen_button_pressed_ = false;
|
||||||
bool mouse_control_button_pressed_ = false;
|
bool mouse_control_button_pressed_ = false;
|
||||||
bool show_settings_window_ = false;
|
bool show_settings_window_ = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user