Skip to content

Commit

Permalink
メソッドを一つにまとめ、引数値で切り替えるように変更
Browse files Browse the repository at this point in the history
  • Loading branch information
Kohki Akikaze committed Sep 22, 2021
1 parent fd450ba commit 13ee731
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 17 deletions.
4 changes: 2 additions & 2 deletions sakura_core/uiparts/CVisualProgress.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ void CVisualProgress::_Begin()
//プログレスバー
HWND hwndProgress = CEditWnd::getInstance()->m_cStatusBar.GetProgressHwnd();
if( hwndProgress ){
CEditWnd::getInstance()->m_cStatusBar.ShowProgressBar();
CEditWnd::getInstance()->m_cStatusBar.ShowProgressBar(true);
//範囲設定・リセット
Progress_SetRange( hwndProgress, 0, 101 );
Progress_SetPos( hwndProgress, 0);
Expand All @@ -121,7 +121,7 @@ void CVisualProgress::_End()
HWND hwndProgress = CEditWnd::getInstance()->m_cStatusBar.GetProgressHwnd();
if( hwndProgress ){
Progress_SetPos( hwndProgress, 0);
CEditWnd::getInstance()->m_cStatusBar.HideProgressBar();
CEditWnd::getInstance()->m_cStatusBar.ShowProgressBar(false);
}

//砂時計
Expand Down
21 changes: 8 additions & 13 deletions sakura_core/window/CMainStatusBar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -195,23 +195,18 @@ bool CMainStatusBar::SetStatusText(int nIndex, int nOption, const WCHAR* pszText
return bDraw;
}

void CMainStatusBar::ShowProgressBar() const {
//! プログレスバーの表示/非表示を切り替える
void CMainStatusBar::ShowProgressBar(bool bShow) const {
if (m_hwndStatusBar && m_hwndProgressBar) {
RECT rcProgressArea = {};
// プログレスバーを表示するステータスバー上の領域を取得
ApiWrap::StatusBar_GetRect(m_hwndStatusBar, 0, &rcProgressArea);
::ShowWindow(m_hwndProgressBar, SW_SHOW);
::InvalidateRect(m_hwndStatusBar, &rcProgressArea, TRUE);
::UpdateWindow(m_hwndStatusBar);
}
}

void CMainStatusBar::HideProgressBar() const {
if (m_hwndStatusBar && m_hwndProgressBar) {
RECT rcProgressArea = {};
// プログレスバーが表示されているステータスバー上の領域を取得
ApiWrap::StatusBar_GetRect(m_hwndStatusBar, 0, &rcProgressArea);
::ShowWindow(m_hwndProgressBar, SW_HIDE);
if (bShow) {
::ShowWindow(m_hwndProgressBar, SW_SHOW);
} else {
::ShowWindow(m_hwndProgressBar, SW_HIDE);
}
// プログレスバー表示領域を再描画
::InvalidateRect(m_hwndStatusBar, &rcProgressArea, TRUE);
::UpdateWindow(m_hwndStatusBar);
}
Expand Down
3 changes: 1 addition & 2 deletions sakura_core/window/CMainStatusBar.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,7 @@ class CMainStatusBar : public CDocListenerEx{

//設定
bool SetStatusText(int nIndex, int nOption, const WCHAR* pszText, size_t textLen = SIZE_MAX);
void ShowProgressBar() const;
void HideProgressBar() const;
void ShowProgressBar(bool bShow) const;
private:
CEditWnd* m_pOwner;
HWND m_hwndStatusBar;
Expand Down

0 comments on commit 13ee731

Please sign in to comment.