xtd 0.2.0
Loading...
Searching...
No Matches
xtd::forms::padding Class Reference
Inheritance diagram for xtd::forms::padding:
xtd::object xtd::iequatable< padding > xtd::interface xtd::equality_operators< type_t, equatable_t >

Definition

Represents a display device or multiple display devices on a single system.

Header
#include <xtd/forms/padding>
Namespace
xtd::forms
Library
xtd.forms
Examples
change_parent.cpp, emoticons.cpp, form_show.cpp, horizontal_layout_panel.cpp, list_box.cpp, system_sound.cpp, and vertical_layout_panel.cpp.

Public Fields

static const padding empty
 Provides a Padding object with no padding.
 

Public Constructors

 padding ()=default
 Initializes a new instance of the padding class.
 
 padding (int32 all)
 Initializes a new instance of the padding class using the supplied padding size for all edges.
 
 padding (int32 left, int32 top, int32 right, int32 bottom)
 Initializes a new instance of the padding class using a separate padding size for each edge.
 

Peorperties

int32 all () const noexcept
 Gets the padding value for all the edges.
 
void all (int32 all)
 Sets the padding value for all the edges.
 
int32 bottom () const noexcept
 Gets the padding value for the bottom edge.
 
void bottom (int32 bottom)
 Sets the padding value for the bottom edge.
 
int32 horizontal () const noexcept
 Gets the combined padding for the right and left edges.
 
int32 left () const noexcept
 Gets the padding value for the left edge.
 
void left (int32 left)
 Sets the padding value for the left edge.
 
int32 right () const noexcept
 Gets the padding value for the right edge.
 
void right (int32 right)
 Sets the padding value for the right edge.
 
int32 top () const noexcept
 Gets the padding value for the top edge.
 
void top (int32 top)
 Sets the padding value for the top edge.
 
int32 vertical () const noexcept
 Gets the combined padding for the bottom and top edges.
 

Public Methods

bool equals (const padding &value) const noexcept override
 
xtd::string to_string () const noexcept override
 Returns a string that represents the current padding.
 
virtual bool equals (const object &obj) const noexcept
 Determines whether the specified object is equal to the current object.
 
template<typename object_a_t , typename object_b_t >
static bool equals (const object_a_t &object_a, const object_b_t &object_b) noexcept
 Determines whether the specified object instances are considered equal.
 

Public Static Methods

static padding add (const padding &p1, const padding &p2)
 Computes the sum of the two specified padding values.
 
static padding subtract (const padding &p1, const padding &p2)
 Subtracts one specified Padding value from another.
 

Additional Inherited Members

- Public Member Functions inherited from xtd::object
 object ()=default
 Create a new instance of the ultimate base class object.
 
virtual size_t get_hash_code () const noexcept
 Serves as a hash function for a particular type.
 
virtual type_object get_type () const noexcept
 Gets the type of the current instance.
 
template<typename object_t >
xtd::uptr< object_t > memberwise_clone () const
 Creates a shallow copy of the current object.
 
- Public Member Functions inherited from xtd::iequatable< padding >
virtual bool equals (const padding &) const noexcept=0
 Indicates whether the current object is equal to another object of the same type.
 
- Static Public Member Functions inherited from xtd::object
template<typename object_a_t , typename object_b_t >
static bool equals (const object_a_t &object_a, const object_b_t &object_b) noexcept
 Determines whether the specified object instances are considered equal.
 
template<typename object_a_t , typename object_b_t >
static bool reference_equals (const object_a_t &object_a, const object_b_t &object_b) noexcept
 Determines whether the specified object instances are the same instance.
 

Constructor & Destructor Documentation

◆ padding() [1/3]

xtd::forms::padding::padding ( )
default

Initializes a new instance of the padding class.

◆ padding() [2/3]

xtd::forms::padding::padding ( int32  all)

Initializes a new instance of the padding class using the supplied padding size for all edges.

Parameters
allThe number of pixels to be used for padding for all edges.
Remarks
This constructor sets the right, left, bottom, top and all properties to the value of the all parameter.

◆ padding() [3/3]

xtd::forms::padding::padding ( int32  left,
int32  top,
int32  right,
int32  bottom 
)

Initializes a new instance of the padding class using a separate padding size for each edge.

Parameters
leftThe padding size, in pixels, for the left edge.
topThe padding size, in pixels, for the top edge.
rightThe padding size, in pixels, for the right edge.
bottomThe padding size, in pixels, for the bottom edge.
Remarks
If all of the parameter values are equal, then the all property will reflect this common value.

Member Function Documentation

◆ all() [1/2]

int32 xtd::forms::padding::all ( ) const
noexcept

Gets the padding value for all the edges.

Returns
The padding, in pixels, for all edges if the same; otherwise, -1.
Remarks
When retrieving this property, if all the edges use the same padding value, then this common value is returned. Otherwise, -1 is returned to indicate that all the padding values are not equal.

◆ all() [2/2]

void xtd::forms::padding::all ( int32  all)

Sets the padding value for all the edges.

Parameters
allThe padding, in pixels, for all edges if the same; otherwise, -1.
Remarks
When retrieving this property, if all the edges use the same padding value, then this common value is returned. Otherwise, -1 is returned to indicate that all the padding values are not equal.

◆ bottom() [1/2]

int32 xtd::forms::padding::bottom ( ) const
noexcept

Gets the padding value for the bottom edge.

Returns
The padding, in pixels, for the bottom edge.
Remarks
Setting this value can also alter the all property.

◆ bottom() [2/2]

void xtd::forms::padding::bottom ( int32  bottom)

Sets the padding value for the bottom edge.

Parameters
bottomThe padding, in pixels, for the bottom edge.
Remarks
Setting this value can also alter the all property.

◆ horizontal()

int32 xtd::forms::padding::horizontal ( ) const
noexcept

Gets the combined padding for the right and left edges.

Returns
Gets the sum, in pixels, of the left and right padding values.

◆ left() [1/2]

int32 xtd::forms::padding::left ( ) const
noexcept

Gets the padding value for the left edge.

Returns
The padding, in pixels, for the left edge.
Remarks
Setting this value can also alter the all property.

◆ left() [2/2]

void xtd::forms::padding::left ( int32  left)

Sets the padding value for the left edge.

Parameters
leftThe padding, in pixels, for the left edge.
Remarks
Setting this value can also alter the all property.

◆ right() [1/2]

int32 xtd::forms::padding::right ( ) const
noexcept

Gets the padding value for the right edge.

Returns
The padding, in pixels, for the right edge.
Remarks
Setting this value can also alter the all property.

◆ right() [2/2]

void xtd::forms::padding::right ( int32  right)

Sets the padding value for the right edge.

Parameters
rightThe padding, in pixels, for the right edge.
Remarks
Setting this value can also alter the all property.

◆ top() [1/2]

int32 xtd::forms::padding::top ( ) const
noexcept

Gets the padding value for the top edge.

Returns
The padding, in pixels, for the top edge.
Remarks
Setting this value can also alter the all property.

◆ top() [2/2]

void xtd::forms::padding::top ( int32  top)

Sets the padding value for the top edge.

Parameters
topThe padding, in pixels, for the top edge.
Remarks
Setting this value can also alter the all property.

◆ vertical()

int32 xtd::forms::padding::vertical ( ) const
noexcept

Gets the combined padding for the bottom and top edges.

Parameters
p1A padding.
p2A padding.
Returns
Gets the sum, in pixels, of the top and bottom padding values.

◆ to_string()

xtd::string xtd::forms::padding::to_string ( ) const
overridevirtualnoexcept

Returns a string that represents the current padding.

Returns
A string that represents the current padding.
Remarks
This method returns a string containing the labeled values of the padding for all four edges.

Reimplemented from xtd::object.

◆ add()

static padding xtd::forms::padding::add ( const padding p1,
const padding p2 
)
static

Computes the sum of the two specified padding values.

Returns
A padding that contains the sum of the two specified padding values.

◆ subtract()

static padding xtd::forms::padding::subtract ( const padding p1,
const padding p2 
)
static

Subtracts one specified Padding value from another.

Parameters
p1A padding.
p2A padding.
Returns
A padding that contains the result of the subtraction of one specified padding value from another.

◆ equals() [1/2]

virtual bool xtd::object::equals ( const object obj) const
virtualnoexcept

Determines whether the specified object is equal to the current object.

Parameters
objThe object to compare with the current object.
Returns
true if the specified object is equal to the current object. otherwise, false.
Examples
The following code example compares the current instance with another object.
#include <xtd/console>
using namespace xtd;
auto main() -> int {
auto object1 = new_ptr<object>();
auto object2 = new_ptr<object>();
auto object3 = object2;
console::write_line(object1->equals(*object3));
console::write_line(*object1 == *object3);
object3 = object1;
console::write_line(object1->equals(*object3));
console::write_line(*object1 == *object3);
}
// This code produces the following output :
//
// false
// false
// true
// true
static void write_line()
Writes the current line terminator to the standard output stream using the specified format informati...
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.h:10

Reimplemented from xtd::object.

◆ equals() [2/2]

template<typename object_a_t , typename object_b_t >
static bool xtd::object::equals ( const object_a_t &  object_a,
const object_b_t &  object_b 
)
inlinestaticnoexcept

Determines whether the specified object instances are considered equal.

Parameters
object_aThe first object to compare.
object_bThe second object to compare.
Returns
true if object_a is the same instance as object_b or if both are null references or if object_a(object_b) returns true. otherwise, false.
Examples
The following code example compares different objects.
#include <xtd/console>
using namespace xtd;
auto main() -> int {
string s1 = "Tom";
string s2 = "Carol";
console::write_line("object::equals(\"{0}\", \"{1}\") => {2}", s1, s2, object::equals(s1, s2));
s1 = "Tom";
s2 = "Tom";
console::write_line("object::equals(\"{0}\", \"{1}\") => {2}", s1, s2, object::equals(s1, s2));
s1 = "";
s2 = "Tom";
console::write_line("object::equals(\"{0}\", \"{1}\") => {2}", s1, s2, object::equals(s1, s2));
s1 = "Carol";
s2 = "";
console::write_line("object::equals(\"{0}\", \"{1}\") => {2}", s1, s2, object::equals(s1, s2));
s1 = "";
s2 = "";
console::write_line("object::equals(\"{0}\", \"{1}\") => {2}", s1, s2, object::equals(s1, s2));
}
// This code produces the following output :
//
// object::equals("Tom", "Carol") => false
// object::equals("Tom", "Tom") => true
// object::equals("", "Tom") => false
// object::equals("Carol", "") => false
// object::equals("", "") => true
virtual bool equals(const object &obj) const noexcept
Determines whether the specified object is equal to the current object.

Member Data Documentation

◆ empty

const padding xtd::forms::padding::empty
static

Provides a Padding object with no padding.


The documentation for this class was generated from the following file: