Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ImageEditor: fixed issue with brush size hotkeys #148
- Loading branch information
Showing
5 changed files
with
64 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#include "CustomTrackBarControl.h" | ||
|
||
namespace ImageEditor { | ||
|
||
LRESULT CCustomTrackBarControl::OnKeyDown(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { | ||
bHandled = FALSE; | ||
|
||
// For user convenience, we make these keys [ ] to behave like arrow keys | ||
// when trackbar control is focused (to change brush size) | ||
if (wParam == VK_OEM_4) { // '[' | ||
bHandled = TRUE; | ||
DefWindowProc(uMsg, VK_LEFT, lParam); | ||
} else if (wParam == VK_OEM_6) { // ']' | ||
bHandled = TRUE; | ||
DefWindowProc(uMsg, VK_RIGHT, lParam); | ||
} | ||
return 0; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#pragma once | ||
|
||
#include "atlheaders.h" | ||
|
||
namespace ImageEditor { | ||
|
||
class CCustomTrackBarControl : | ||
public CWindowImpl<CCustomTrackBarControl, CTrackBarCtrl, CControlWinTraits> | ||
{ | ||
public: | ||
typedef CWindowImpl<CCustomTrackBarControl, CTrackBarCtrl, CControlWinTraits> TBase; | ||
|
||
DECLARE_WND_SUPERCLASS(_T("CCustomTrackBarControl"), CTrackBarCtrl::GetWndClassName()) | ||
|
||
BEGIN_MSG_MAP(CCustomTrackBarControl) | ||
MESSAGE_HANDLER(WM_KEYDOWN, OnKeyDown) | ||
END_MSG_MAP() | ||
|
||
// Handler prototypes: | ||
// LRESULT MessageHandler(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); | ||
// LRESULT CommandHandler(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled); | ||
// LRESULT NotifyHandler(int idCtrl, LPNMHDR pnmh, BOOL& bHandled); | ||
|
||
LRESULT OnKeyDown(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); | ||
}; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters