FreeRDP
Loading...
Searching...
No Matches
SdlSelectableWidget Class Reference

#include <sdl_selectable_widget.hpp>

Inheritance diagram for SdlSelectableWidget:
Collaboration diagram for SdlSelectableWidget:

Public Member Functions

 SdlSelectableWidget (std::shared_ptr< SDL_Renderer > &renderer, const SDL_FRect &rect)
 SdlSelectableWidget (SdlSelectableWidget &&other) noexcept
 SdlSelectableWidget (const SdlSelectableWidget &other)=delete
SdlSelectableWidget & operator= (const SdlSelectableWidget &other)=delete
SdlSelectableWidget & operator= (SdlSelectableWidget &&other)=delete
bool highlight (bool enable)
bool mouseover (bool enable)
Public Member Functions inherited from SdlWidget
 SdlWidget (SDL_Renderer *renderer, SDL_Rect rect, bool input)
 SdlWidget (SdlWidget &&other) noexcept
bool fill (SDL_Renderer *renderer, SDL_Color color)
bool fill (SDL_Renderer *renderer, const std::vector< SDL_Color > &colors)
bool update_text (SDL_Renderer *renderer, const std::string &text, SDL_Color fgcolor)
bool update_text (SDL_Renderer *renderer, const std::string &text, SDL_Color fgcolor, SDL_Color bgcolor)
bool wrap () const
bool set_wrap (bool wrap=true, size_t width=0)
const SDL_Rect & rect () const
 SdlWidget (const SdlWidget &other)=delete
SdlWidget & operator= (const SdlWidget &other)=delete
SdlWidget & operator= (SdlWidget &&other)=delete
 SdlWidget (std::shared_ptr< SDL_Renderer > &renderer, const SDL_FRect &rect)
 SdlWidget (const SdlWidget &other)=delete
 SdlWidget (SdlWidget &&other) noexcept
SdlWidget & operator= (const SdlWidget &other)=delete
SdlWidget & operator= (SdlWidget &&other)=delete
bool fill (SDL_Color color) const
bool fill (const std::vector< SDL_Color > &colors) const
bool update_text (const std::string &text)
bool wrap () const
bool set_wrap (bool wrap=true, size_t width=0)
const SDL_FRect & rect () const
bool update ()

Protected Member Functions

bool updateInternal () override
Protected Member Functions inherited from SdlWidget
virtual bool clear () const

Protected Attributes

SDL_Color _highlightcolor = { 0xcd, 0xca, 0x35, 0x60 }
SDL_Color _mouseovercolor = { 0x66, 0xff, 0x66, 0x60 }
Protected Attributes inherited from SdlWidget
std::shared_ptr< SDL_Renderer > _renderer
SDL_Color _backgroundcolor = { 0x56, 0x56, 0x56, 0xff }
SDL_Color _fontcolor = { 0xd1, 0xcf, 0xcd, 0xff }
std::string _text

Additional Inherited Members

Static Public Member Functions inherited from SdlWidget
static bool error_ex (Sint32 res, const char *what, const char *file, size_t line, const char *fkt)
static bool error_ex (bool success, const char *what, const char *file, size_t line, const char *fkt)

Detailed Description

FreeRDP: A Remote Desktop Protocol Implementation SDL Client helper dialogs

Copyright 2025 Armin Novak armin.nosp@m..nov.nosp@m.ak@th.nosp@m.inca.nosp@m.st.co.nosp@m.m Copyright 2025 Thincast Technologies GmbH

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Definition at line 24 of file sdl_selectable_widget.hpp.

Constructor & Destructor Documentation

◆ SdlSelectableWidget()

SdlSelectableWidget::SdlSelectableWidget ( std::shared_ptr< SDL_Renderer > & renderer,
const SDL_FRect & rect )

FreeRDP: A Remote Desktop Protocol Implementation SDL Client helper dialogs

Copyright 2025 Armin Novak armin.nosp@m..nov.nosp@m.ak@th.nosp@m.inca.nosp@m.st.co.nosp@m.m Copyright 2025 Thincast Technologies GmbH

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Definition at line 23 of file sdl_selectable_widget.cpp.

25 : SdlWidget(renderer, rect)
26{
27}

Referenced by SdlButton::SdlButton(), SdlInputWidget::SdlInputWidget(), and SdlSelectWidget::SdlSelectWidget().

Here is the caller graph for this function:

Member Function Documentation

◆ highlight()

bool SdlSelectableWidget::highlight ( bool enable)

Definition at line 41 of file sdl_selectable_widget.cpp.

42{
43 _highlight = enable;
44 return update();
45}

◆ mouseover()

bool SdlSelectableWidget::mouseover ( bool enable)

Definition at line 47 of file sdl_selectable_widget.cpp.

48{
49 _mouseover = enable;
50 return update();
51}

◆ updateInternal()

bool SdlSelectableWidget::updateInternal ( )
nodiscardoverrideprotectedvirtual

Reimplemented from SdlWidget.

Definition at line 53 of file sdl_selectable_widget.cpp.

54{
55 SdlBlendModeGuard guard(_renderer, SDL_BLENDMODE_NONE);
56 std::vector<SDL_Color> colors;
57 colors.push_back(_backgroundcolor);
58 if (_highlight)
59 colors.push_back(_highlightcolor);
60
61 if (_mouseover)
62 colors.push_back(_mouseovercolor);
63
64 if (!fill(colors))
65 return false;
66
67 return SdlWidget::updateInternal();
68}

Field Documentation

◆ _highlightcolor

SDL_Color SdlSelectableWidget::_highlightcolor = { 0xcd, 0xca, 0x35, 0x60 }
protected

Definition at line 44 of file sdl_selectable_widget.hpp.

44{ 0xcd, 0xca, 0x35, 0x60 };

◆ _mouseovercolor

SDL_Color SdlSelectableWidget::_mouseovercolor = { 0x66, 0xff, 0x66, 0x60 }
protected

Definition at line 45 of file sdl_selectable_widget.hpp.

45{ 0x66, 0xff, 0x66, 0x60 };

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