Skip to content

Commit

Permalink
Add align to right option for WinLabel constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
Xenakios committed Jan 17, 2016
1 parent 55a784f commit c41eb90
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion header/mrpwincontrols.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ class WinButton : public WinControl
class WinLabel : public WinControl
{
public:
WinLabel(MRPWindow* parent, std::string text);
WinLabel(MRPWindow* parent, std::string text, bool alignright=false);
void setText(std::string text);
std::string getText();

Expand Down
7 changes: 5 additions & 2 deletions source/mrpwincontrols.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -225,10 +225,13 @@ bool WinButton::handleMessage(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
return false;
}

WinLabel::WinLabel(MRPWindow* parent, std::string text) : WinControl(parent)
WinLabel::WinLabel(MRPWindow* parent, std::string text, bool alignright) : WinControl(parent)
{
DWORD styleflags = WS_CHILD | WS_TABSTOP;
if (alignright)
styleflags = WS_CHILD | WS_TABSTOP | SS_RIGHT;
#ifdef WIN32
m_hwnd = CreateWindow("STATIC", "label", WS_CHILD | WS_TABSTOP, 0, 0, 10, 10, parent->getWindowHandle(),
m_hwnd = CreateWindow("STATIC", "label", styleflags, 0, 0, 10, 10, parent->getWindowHandle(),
(HMENU)g_control_counter, g_hInst, 0);
#else
m_hwnd = SWELL_MakeLabel(-1, text.c_str(), g_control_counter, 0, 0, 20, 20, 0);
Expand Down
2 changes: 1 addition & 1 deletion source/xendynamicprocessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ DynamicsProcessorWindow::DynamicsProcessorWindow(HWND parent) : MRPWindow(parent
}
};
add_control(m_windowsizecombo1);
m_windowsizelabel1 = std::make_shared<WinLabel>(this, "Window size");
m_windowsizelabel1 = std::make_shared<WinLabel>(this, "Window size",true);
add_control(m_windowsizelabel1);

m_slider1 = std::make_shared<ReaSlider>(this);
Expand Down

0 comments on commit c41eb90

Please sign in to comment.