diff --git a/sakura_core/apiwrap/CommonControl.h b/sakura_core/apiwrap/CommonControl.h index 6439f2cd64..fab589a0f6 100644 --- a/sakura_core/apiwrap/CommonControl.h +++ b/sakura_core/apiwrap/CommonControl.h @@ -86,8 +86,6 @@ namespace ApiWrap inline int Toolbar_SetButtonInfo(HWND hwndCtl, int index, TBBUTTONINFO* info) { return (int)(DWORD)::SendMessage(hwndCtl, TB_SETBUTTONINFO, (WPARAM)index, (LPARAM)info); } inline BOOL Toolbar_SetButtonSize(HWND hwndCtl, int width, int height) { return (BOOL)(DWORD)::SendMessage(hwndCtl, TB_SETBUTTONSIZE, 0L, MAKELONG(width, height)); } inline DWORD Toolbar_SetExtendedStyle(HWND hwndCtl, DWORD styles) { return (DWORD)::SendMessage(hwndCtl, TB_SETEXTENDEDSTYLE, 0L, (LPARAM)styles); } - inline int Toolbar_GetState(HWND hwndCtl, int index) { return (int)::SendMessage(hwndCtl, TB_GETSTATE, (WPARAM)index, 0L); } - inline BOOL Toolbar_SetState(HWND hwndCtl, int index, WORD state) { return (BOOL)::SendMessage(hwndCtl, TB_SETSTATE, (WPARAM)index, state); } // -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- // // Tooltip コントロール // diff --git a/sakura_core/window/CMainToolBar.cpp b/sakura_core/window/CMainToolBar.cpp index 43a8b7d3a1..b1344db36e 100644 --- a/sakura_core/window/CMainToolBar.cpp +++ b/sakura_core/window/CMainToolBar.cpp @@ -535,25 +535,20 @@ void CMainToolBar::UpdateToolbar( void ) TBBUTTON tbb = m_pOwner->GetMenuDrawer().getButton( GetDllShareData().m_Common.m_sToolBar.m_nToolBarButtonIdxArr[i] ); - int state = Toolbar_GetState( m_hwndToolBar, tbb.idCommand ); - if( state != -1 ) - { - WORD stateToSet = 0; - // 機能が利用可能か調べる - if( IsFuncEnable( m_pOwner->GetDocument(), &GetDllShareData(), (EFunctionCode)tbb.idCommand ) ) - { - stateToSet |= TBSTATE_ENABLED; - } - // 機能がチェック状態か調べる - if( IsFuncChecked( m_pOwner->GetDocument(), &GetDllShareData(), (EFunctionCode)tbb.idCommand ) ) - { - stateToSet |= TBSTATE_CHECKED; - } - if( state != stateToSet ) - { - Toolbar_SetState( m_hwndToolBar, tbb.idCommand, stateToSet ); - } - } + + // 機能が利用可能か調べる + Toolbar_EnableButton( + m_hwndToolBar, + tbb.idCommand, + IsFuncEnable( m_pOwner->GetDocument(), &GetDllShareData(), (EFunctionCode)tbb.idCommand ) + ); + + // 機能がチェック状態か調べる + Toolbar_CheckButton( + m_hwndToolBar, + tbb.idCommand, + IsFuncChecked( m_pOwner->GetDocument(), &GetDllShareData(), (EFunctionCode)tbb.idCommand ) + ); } } }