xtd 0.2.0
message.h
Go to the documentation of this file.
1 #pragma once
5 #include "../forms_export.h"
6 #include <xtd/object>
7 #include <xtd/ustring>
8 #include <cstdint>
9 #include <iomanip>
10 #include <sstream>
11 #include <string>
12 
13 namespace xtd {
14  namespace forms {
26  class forms_export_ message : public object {
27  public:
29  message() = default;
30  message(const message& message) = default;
31  message& operator =(const message&) = default;
33 
35 
40  intptr hwnd() const noexcept;
44  void hwnd(intptr value);
45 
49  intptr lparam() const noexcept;
53  void lparam(intptr value);
54 
57  uint32 msg() const noexcept;
60  void msg(uint32 value);
61 
64  intptr result() const noexcept;
67  void result(intptr value);
68 
72  intptr wparam() const noexcept;
76  void wparam(intptr value);
78 
80  intptr handle() const noexcept;
81  void handle(intptr value);
83 
85 
94  static message create(intptr hwnd, int32 msg, intptr wparam, intptr lparam);
95 
97  static message create(intptr hwnd, int32 msg, intptr wparam, intptr lparam, intptr result);
98  static message create(intptr hwnd, int32 msg, intptr wparam, intptr lparam, intptr result, intptr handle);
100 
104  template<typename type_t>
105  type_t get_lparam() const noexcept { return reinterpret_cast<type_t>(lparam_); }
106 
109  xtd::ustring to_string() const noexcept override;
111 
112  private:
113  message(intptr hwnd, int32 msg, intptr wparam, intptr lparam);
114  message(intptr hwnd, int32 msg, intptr wparam, intptr lparam, intptr result);
115  message(intptr hwnd, int32 msg, intptr wparam, intptr lparam, intptr result, intptr handle);
116 
117  intptr hwnd_ = 0;
118  uint32 msg_ = 0;
119  intptr wparam_ = 0;
120  intptr lparam_ = 0;
121  intptr result_ = 0;
122  intptr handle_ = 0;
123  inline static int32 id_ = 0;
124  };
125  }
126 }
intmax_t intptr
Represent a pointer or a handle.
Definition: types.h:151
The xtd namespace contains all fundamental classes to access Hardware, Os, System, and more.
Definition: system_report.h:17
Represents text as a sequence of UTF-8 code units.
Definition: ustring.h:46
std::string to_string(const date_time &value, const std::string &fmt, const std::locale &loc)
Convert a specified value into a string with specified format and locale.
Definition: date_time.h:1063
type_t get_lparam() const noexcept
Gets the lparam value and converts the value to an object.
Definition: message.h:105
Implements a Windows message.
Definition: message.h:26
Supports all classes in the xtd class hierarchy and provides low-level services to derived classes...
Definition: object.h:32
int_least32_t int32
Represents a 32-bit signed integer.
Definition: types.h:129
The xtd::forms namespace contains classes for creating Windows-based applications that take full adva...
Definition: about_box.h:13
uint_least32_t uint32
Represents a 32-bit unsigned integer.
Definition: types.h:239