• R/O
  • HTTP
  • SSH
  • HTTPS

コミット

タグ
未設定

よく使われているワード(クリックで追加)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Small footprint UI library for hardware accelerated games & applications


コミットメタ情報

リビジョン80a88ee62c2a6dd29e834e8563c7a492f7edfcd4 (tree)
日時2014-05-01 20:23:24
作者Emil Segerås <emilsegers@gmai...>
コミッターEmil Segerås

ログメッセージ

Extracted TBWindow::ResizeToFitContent logic into new method.

変更サマリ

差分

--- a/src/tb/tb_window.cpp
+++ b/src/tb/tb_window.cpp
@@ -34,7 +34,7 @@ TBWindow::~TBWindow()
3434 m_mover.RemoveChild(&m_textfield);
3535 }
3636
37-void TBWindow::ResizeToFitContent(RESIZE_FIT fit)
37+TBRect TBWindow::GetResizeToFitContentRect(RESIZE_FIT fit)
3838 {
3939 PreferredSize ps = GetPreferredSize();
4040 int new_w = ps.pref_w;
@@ -54,7 +54,12 @@ void TBWindow::ResizeToFitContent(RESIZE_FIT fit)
5454 new_w = MIN(new_w, GetParent()->GetRect().w);
5555 new_h = MIN(new_h, GetParent()->GetRect().h);
5656 }
57- SetRect(TBRect(GetRect().x, GetRect().y, new_w, new_h));
57+ return TBRect(GetRect().x, GetRect().y, new_w, new_h);
58+}
59+
60+void TBWindow::ResizeToFitContent(RESIZE_FIT fit)
61+{
62+ SetRect(GetResizeToFitContentRect(fit));
5863 }
5964
6065 void TBWindow::Close()
--- a/src/tb/tb_window.h
+++ b/src/tb/tb_window.h
@@ -74,8 +74,12 @@ public:
7474 RESIZE_FIT_CURRENT_OR_NEEDED ///< Fit the minimal or maximum size only if needed. Will keep
7575 ///< the new size as close as possible to the current size.
7676 };
77- /** Resize the window to fit the its content.
78- It can fit in a few different ways (See RESIZE_FIT). */
77+
78+ /** Get a suitable rect for the window based on the contents and the given fit. */
79+ TBRect GetResizeToFitContentRect(RESIZE_FIT fit = RESIZE_FIT_PREFERRED);
80+
81+ /** Resize the window to fit the its content. This is the same as doing
82+ SetRect(GetResizeToFitContentRect(fit)). */
7983 void ResizeToFitContent(RESIZE_FIT fit = RESIZE_FIT_PREFERRED);
8084
8185 /** Set the window title. */