cpp-terminal 1.0.0
Small C++ library for writing multiplatform terminal applications
Loading...
Searching...
No Matches
input.cpp File Reference
#include "cpp-terminal/private/unicode.hpp"
#include <vector>
#include <windows.h>
#include "cpp-terminal/event.hpp"
#include "cpp-terminal/exception.hpp"
#include "cpp-terminal/input.hpp"
#include "cpp-terminal/private/blocking_queue.hpp"
#include "cpp-terminal/private/file.hpp"
#include "cpp-terminal/private/input.hpp"
#include "cpp-terminal/private/sigwinch.hpp"
#include <mutex>
#include <string>

Go to the source code of this file.

Macros

#define WIN32_LEAN_AND_MEAN
 

Functions

Term::Button::Action getAction (const std::int32_t &old_state, const std::int32_t &state, const std::int32_t &type)
 
Term::Button setButton (const std::int32_t &old_state, const std::int32_t &state)
 
void sendString (Term::Private::BlockingQueue &events, std::wstring &str)
 

Macro Definition Documentation

◆ WIN32_LEAN_AND_MEAN

#define WIN32_LEAN_AND_MEAN

Definition at line 15 of file input.cpp.

Function Documentation

◆ getAction()

Term::Button::Action getAction ( const std::int32_t & old_state,
const std::int32_t & state,
const std::int32_t & type )

Definition at line 41 of file input.cpp.

42{
43 if(((state - old_state) >> (type - 1)) == 1) return Term::Button::Action::Pressed;
44 else if(((old_state - state) >> (type - 1)) == 1)
46 else
48}

◆ sendString()

void sendString ( Term::Private::BlockingQueue & events,
std::wstring & str )

Definition at line 70 of file input.cpp.

71{
72 if(!str.empty())
73 {
74 events.push(Term::Event(Term::Private::to_narrow(str.c_str())));
75 str.clear();
76 }
77}
void push(const Term::Event &value, const std::size_t &occurrence=1)
std::string to_narrow(const std::wstring &wstr)
Definition unicode.cpp:26

◆ setButton()

Term::Button setButton ( const std::int32_t & old_state,
const std::int32_t & state )

Definition at line 49 of file input.cpp.

50{
52 action = getAction(old_state, state, FROM_LEFT_1ST_BUTTON_PRESSED);
54
55 action = getAction(old_state, state, FROM_LEFT_2ND_BUTTON_PRESSED);
57
58 action = getAction(old_state, state, FROM_LEFT_3RD_BUTTON_PRESSED);
60
61 action = getAction(old_state, state, FROM_LEFT_4TH_BUTTON_PRESSED);
63
64 action = getAction(old_state, state, RIGHTMOST_BUTTON_PRESSED);
66
68}
Term::Button::Action getAction(const std::int32_t &old_state, const std::int32_t &state, const std::int32_t &type)
Definition input.cpp:41