|
|
@@ -13,12 +13,18 @@ namespace tb {
|
|
|
TBWindow::TBWindow()
|
|
|
: m_settings(WINDOW_SETTINGS_DEFAULT)
|
|
|
{
|
|
|
+// ATOMIC BEGIN
|
|
|
+ m_axis = AXIS_Y;
|
|
|
+// ATOMIC END
|
|
|
SetSkinBg(TBIDC("TBWindow"), WIDGET_INVOKE_INFO_NO_CALLBACKS);
|
|
|
AddChild(&m_mover);
|
|
|
AddChild(&m_resizer);
|
|
|
m_mover.SetSkinBg(TBIDC("TBWindow.mover"));
|
|
|
m_mover.AddChild(&m_textfield);
|
|
|
m_textfield.SetIgnoreInput(true);
|
|
|
+// ATOMIC BEGIN
|
|
|
+ m_textfield.SetSqueezable(true);
|
|
|
+// ATOMIC END
|
|
|
m_mover.AddChild(&m_close_button);
|
|
|
m_close_button.SetSkinBg(TBIDC("TBWindow.close"));
|
|
|
m_close_button.SetIsFocusable(false);
|
|
|
@@ -197,8 +203,20 @@ TBRect TBWindow::GetPaddingRect()
|
|
|
{
|
|
|
TBRect padding_rect = TBWidget::GetPaddingRect();
|
|
|
int title_height = GetTitleHeight();
|
|
|
- padding_rect.y += title_height;
|
|
|
- padding_rect.h -= title_height;
|
|
|
+// ATOMIC BEGIN
|
|
|
+ if ( m_axis == AXIS_Y ) // default axis
|
|
|
+ {
|
|
|
+// ATOMIC END
|
|
|
+ padding_rect.y += title_height;
|
|
|
+ padding_rect.h -= title_height;
|
|
|
+// ATOMIC BEGIN
|
|
|
+ }
|
|
|
+ else if ( m_axis == AXIS_X ) // rotated sideways
|
|
|
+ {
|
|
|
+ padding_rect.x += title_height;
|
|
|
+ padding_rect.w -= title_height;
|
|
|
+ }
|
|
|
+// ATOMIC END
|
|
|
return padding_rect;
|
|
|
}
|
|
|
|
|
|
@@ -216,8 +234,20 @@ PreferredSize TBWindow::OnCalculatePreferredSize(const SizeConstraints &constrai
|
|
|
}
|
|
|
// Add window title bar height
|
|
|
int title_height = GetTitleHeight();
|
|
|
- ps.min_h += title_height;
|
|
|
- ps.pref_h += title_height;
|
|
|
+// ATOMIC BEGIN
|
|
|
+ if ( m_axis == AXIS_Y ) // default axis
|
|
|
+ {
|
|
|
+// ATOMIC END
|
|
|
+ ps.min_h += title_height;
|
|
|
+ ps.pref_h += title_height;
|
|
|
+// ATOMIC BEGIN
|
|
|
+ }
|
|
|
+ else if ( m_axis == AXIS_X ) // rotated sideways
|
|
|
+ {
|
|
|
+ ps.min_w += title_height;
|
|
|
+ ps.pref_w += title_height;
|
|
|
+ }
|
|
|
+// ATOMIC END
|
|
|
return ps;
|
|
|
}
|
|
|
|
|
|
@@ -260,15 +290,42 @@ void TBWindow::OnResized(int old_w, int old_h)
|
|
|
// Manually move our own decoration children
|
|
|
// FIX: Put a layout in the TBMover so we can add things there nicely.
|
|
|
int title_height = GetTitleHeight();
|
|
|
- m_mover.SetRect(TBRect(0, 0, GetRect().w, title_height));
|
|
|
- PreferredSize ps = m_resizer.GetPreferredSize();
|
|
|
- m_resizer.SetRect(TBRect(GetRect().w - ps.pref_w, GetRect().h - ps.pref_h, ps.pref_w, ps.pref_h));
|
|
|
- TBRect mover_rect = m_mover.GetPaddingRect();
|
|
|
- int button_size = mover_rect.h;
|
|
|
- m_close_button.SetRect(TBRect(mover_rect.x + mover_rect.w - button_size, mover_rect.y, button_size, button_size));
|
|
|
- if (m_settings & WINDOW_SETTINGS_CLOSE_BUTTON)
|
|
|
- mover_rect.w -= button_size;
|
|
|
- m_textfield.SetRect(mover_rect);
|
|
|
+// ATOMIC BEGIN
|
|
|
+ if ( m_axis == AXIS_Y ) // default axis
|
|
|
+ {
|
|
|
+// ATOMIC END
|
|
|
+ m_mover.SetRect(TBRect(0, 0, GetRect().w, title_height));
|
|
|
+ PreferredSize ps = m_resizer.GetPreferredSize();
|
|
|
+ m_resizer.SetRect(TBRect(GetRect().w - ps.pref_w, GetRect().h - ps.pref_h, ps.pref_w, ps.pref_h));
|
|
|
+ TBRect mover_rect = m_mover.GetPaddingRect();
|
|
|
+ int button_size = mover_rect.h;
|
|
|
+ m_close_button.SetRect(TBRect(mover_rect.x + mover_rect.w - button_size, mover_rect.y, button_size, button_size));
|
|
|
+ if (m_settings & WINDOW_SETTINGS_CLOSE_BUTTON)
|
|
|
+ mover_rect.w -= button_size;
|
|
|
+ m_textfield.SetRect(mover_rect);
|
|
|
+// ATOMIC BEGIN
|
|
|
+ }
|
|
|
+ else if ( m_axis == AXIS_X ) // rotated sideways
|
|
|
+ {
|
|
|
+ m_mover.SetRect(TBRect(0, 0, title_height, GetRect().h ));
|
|
|
+ PreferredSize ps = m_resizer.GetPreferredSize();
|
|
|
+ m_resizer.SetRect(TBRect(GetRect().w - ps.pref_w, GetRect().h - ps.pref_h, ps.pref_w, ps.pref_h));
|
|
|
+ TBRect mover_rect = m_mover.GetPaddingRect();
|
|
|
+ int button_size = mover_rect.w;
|
|
|
+ m_close_button.SetRect(TBRect(mover_rect.x + 1, mover_rect.y + 1, button_size, button_size));
|
|
|
+ if (m_settings & WINDOW_SETTINGS_CLOSE_BUTTON)
|
|
|
+ mover_rect.w -= button_size;
|
|
|
+ m_textfield.SetRect(TBRect(mover_rect.x + 5, mover_rect.y + mover_rect.h - button_size, button_size - 1, button_size));
|
|
|
+ }
|
|
|
+// ATOMIC END
|
|
|
+}
|
|
|
+
|
|
|
+// ATOMIC BEGIN
|
|
|
+void TBWindow::SetAxis(AXIS axis)
|
|
|
+{
|
|
|
+ m_axis = axis;
|
|
|
+ Invalidate();
|
|
|
}
|
|
|
+// ATOMIC END
|
|
|
|
|
|
}; // namespace tb
|