xtd - Reference Guide  0.1.2
Modern c++17/20 framework to create console, GUI and unit test applications on Windows, macOS, Linux, iOS and android.
Loading...
Searching...
No Matches
split_container.h
Go to the documentation of this file.
1
4#pragma once
5#include "orientation.h"
7#include "splitter.h"
8#include "splitter_panel.h"
9
11namespace xtd {
13 namespace forms {
24 public:
27 can_focus_ = false;
28 size_ = default_size();
29 controls().push_back_range({panel2_, splitter_, panel1_});
30 arrange_children();
31 }
32
33 drawing::size default_size() const override {return {150, 100};}
34
37 virtual xtd::forms::orientation orientation() const {return orientation_;}
42 if (orientation_ != orientation) {
43 orientation_ = orientation;
44 arrange_children();
45 }
46 return *this;
47 }
48
51 virtual const splitter_panel& panel1() const {return panel1_;};
54 virtual splitter_panel& panel1() {return panel1_;};
55
58 virtual const splitter_panel& panel2() const {return panel2_;};
61 virtual splitter_panel& panel2() {return panel2_;};
62
65 virtual int splitter_distance() const {return splitter_distance_;}
69 virtual split_container& splitter_distance(int splitter_distance) {
70 if (splitter_distance_ != splitter_distance) {
71 splitter_distance_ = splitter_distance;
72 if (orientation_ == xtd::forms::orientation::horizontal) panel1_.height(splitter_distance);
73 else panel1_.width(splitter_distance);
74 }
75 return *this;
76 }
77
80 virtual xtd::forms::splitter_style splitter_style() const {return splitter_.splitter_style();}
85 if (splitter_.splitter_style() != splitter_style) {
87 }
88 return *this;
89 }
90
94 virtual int splitter_width() const {return splitter_width_;}
99 virtual split_container& splitter_width(int splitter_width) {
100 if (splitter_width_ != splitter_width) {
101 splitter_width_ = splitter_width;
102 arrange_children();
103 }
104 return *this;
105 }
106
107 protected:
108 void on_resize(const event_args& e) override {
110 }
111
112 private:
113 void arrange_children() {
114 if (orientation_ == xtd::forms::orientation::vertical) {
115 panel1_.dock(xtd::forms::dock_style::left);
116 panel1_.width(splitter_distance_);
117 splitter_.dock(xtd::forms::dock_style::left);
118 splitter_.width(splitter_width_);
119 } else {
120 panel1_.dock(xtd::forms::dock_style::top);
121 panel1_.height(splitter_distance_);
122 splitter_.dock(xtd::forms::dock_style::top);
123 splitter_.height(splitter_width_);
124 }
125 panel2_.dock(xtd::forms::dock_style::fill);
126 }
127
129 splitter_panel panel1_;
130 splitter splitter_;
131 splitter_panel panel2_;
132 int splitter_distance_ = 50;
133 //int splitter_increment_ = 1;
134 int splitter_width_ = 4;
135 };
136 }
137}
Stores an ordered pair of integers, which specify a height and width.
Definition size.h:25
Represents the base class for classes that contain event data, and provides a value to use for events...
Definition event_args.h:18
virtual int32_t height() const
Gets the height of the control.
Definition control.h:486
Defines a base class for controls that support auto-scrolling behavior.
Definition scrollable_control.h:18
Represents a control consisting of a movable bar that divides a container's display area into two res...
Definition split_container.h:23
virtual int splitter_width() const
Gets or sets the width of the splitter in pixels.
Definition split_container.h:94
split_container()
Initializes a new instance of the split_container class.
Definition split_container.h:26
virtual splitter_panel & panel1()
Gets the left or top panel of the splitter_panel, depending on orientation.
Definition split_container.h:54
virtual const splitter_panel & panel2() const
Gets the right or bottom panel of the splitter_panel, depending on orientation.
Definition split_container.h:58
virtual split_container & orientation(xtd::forms::orientation orientation)
Sets a value indicating the horizontal or vertical orientation of the split_container panels.
Definition split_container.h:41
virtual split_container & splitter_width(int splitter_width)
Gets or sets the width of the splitter in pixels.
Definition split_container.h:99
virtual splitter_panel & panel2()
Gets the right or bottom panel of the splitter_panel, depending on orientation.
Definition split_container.h:61
virtual split_container & splitter_distance(int splitter_distance)
Sets the location of the splitter, in pixels, from the left or top edge of the split_container.
Definition split_container.h:69
virtual const splitter_panel & panel1() const
Gets the left or top panel of the splitter_panel, depending on orientation.
Definition split_container.h:51
virtual xtd::forms::splitter_style splitter_style() const
Gets the style of the splitter.
Definition split_container.h:80
virtual split_container & splitter_style(xtd::forms::splitter_style splitter_style)
Sets the style of the splitter.
Definition split_container.h:84
virtual int splitter_distance() const
Gets the location of the splitter, in pixels, from the left or top edge of the split_container.
Definition split_container.h:65
drawing::size default_size() const override
Gets the default size of the control.
Definition split_container.h:33
void on_resize(const event_args &e) override
Raises the control::resize event.
Definition split_container.h:108
virtual xtd::forms::orientation orientation() const
Gets a value indicating the horizontal or vertical orientation of the split_container panels.
Definition split_container.h:37
Creates a panel that is associated with a split_container.
Definition splitter_panel.h:23
virtual void on_resize(const event_args &e)
Raises the control::resize event.
#define forms_export_
Define shared library export.
Definition forms_export.h:13
@ e
The E key.
splitter_style
Represent splitter style used by splitter control.
Definition splitter_style.h:17
orientation
Specifies the orientation of controls or elements of controls.
Definition orientation.h:18
@ left
The control's left edge is docked to the left edge of its containing control.
@ fill
All the control's edges are docked to the all edges of its containing control and sized appropriately...
@ top
The control's top edge is docked to the top of its containing control.
@ horizontal
The control or element is oriented horizontally.
@ vertical
The control or element is oriented vertically.
The xtd::forms namespace contains classes for creating Windows-based applications that take full adva...
Definition about_box.h:13
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition system_report.h:17
Contains xtd::forms::orientation enum class.
Contains xtd::forms::scrollable_control control.
Contains xtd::forms::splitter control.
Contains xtd::forms::splitter_panel container.