//****************************************************************************** // MIDIシーケンサーソフト『世界樹』 // グラフの種類リストボックスクラス // (C)2002-2013 おーぷんMIDIぷろじぇくと/くず //****************************************************************************** /* This library is free software; you can redistribute it and/or */ /* modify it under the terms of the GNU Lesser General Public */ /* License as published by the Free Software Foundation; either */ /* version 2.1 of the License, or (at your option) any later version. */ /* This library is distributed in the hope that it will be useful, */ /* but WITHOUT ANY WARRANTY; without even the implied warranty of */ /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU */ /* Lesser General Public License for more details. */ /* You should have received a copy of the GNU Lesser General Public */ /* License along with this library; if not, write to the Free Software */ /* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "resource.h" #include "winver.h" #include #include #include #include #include "../../MIDIIO/MIDIIO.h" #include "../../MIDIData/MIDIData.h" #include "../../MIDIClock/MIDIClock.h" #include "../../MIDIStatus/MIDIStatus.h" #include "../../MIDIInstrument/MIDIInstrument.h" #include "HistoryRecord.h" #include "HistoryUnit.h" #include "SekaijuDoc.h" #include "GraphKindListBox.h" // TSIZEOFマクロ //20120211追加 #ifndef TSIZEOF #define TSIZEOF(STR) (sizeof(STR)/sizeof(TCHAR)) #endif #ifndef TCSLEN #ifdef UNICODE #define TCSLEN(STRING) wcslen(STRING) #else #define TCSLEN(STRING) strlen(STRING) #endif #endif #ifndef TCSNCPY #ifdef UNICODE #define TCSNCPY(STRING1,STRING2,N) wcsncpy(STRING1,STRING2,N) #else #define TCSNCPY(STRING1,STRING2,N) strncpy(STRING1,STRING2,N) #endif #endif // メッセージマップ IMPLEMENT_DYNCREATE (CGraphKindListBox, CCheckListBox) BEGIN_MESSAGE_MAP (CGraphKindListBox, CCheckListBox) ON_WM_RBUTTONDOWN () END_MESSAGE_MAP () //------------------------------------------------------------------------------ // 構築と破壊 //------------------------------------------------------------------------------ // コンストラクタ CGraphKindListBox::CGraphKindListBox () { m_pDocument = NULL; m_lMenuID = 0; m_lLastRButtonDownIndex = 0; CCheckListBox::CCheckListBox (); } // コンストラクタ CGraphKindListBox::CGraphKindListBox (CDocument* pDocument, long lMenuID) { m_pDocument = pDocument; m_lMenuID = lMenuID; m_lLastRButtonDownIndex = 0; CCheckListBox::CCheckListBox (); } // デストラクタ CGraphKindListBox::~CGraphKindListBox () { CCheckListBox::~CCheckListBox (); } //------------------------------------------------------------------------------ // オーバーライド //------------------------------------------------------------------------------ //------------------------------------------------------------------------------ // オペレーション //------------------------------------------------------------------------------ CSekaijuDoc* CGraphKindListBox::GetDocument () { return (CSekaijuDoc*)m_pDocument; } long CGraphKindListBox::GetLastRButtonDownIndex () { return m_lLastRButtonDownIndex; } //------------------------------------------------------------------------------ // メッセージマップ //------------------------------------------------------------------------------ // マウス右ボタン押された時 void CGraphKindListBox::OnRButtonDown (UINT nFlags, CPoint point) { this->SetFocus (); if (m_lMenuID == 0) { return; } BOOL bOutside; long lIndex = this->ItemFromPoint (point, bOutside); if (bOutside) { return; } if (lIndex < 0 || lIndex >= GetCount ()) { return; } m_lLastRButtonDownIndex = lIndex; // ポップアップメニューの表示 CPoint ptMenu (point); ClientToScreen (&ptMenu); CMenu theMenu; VERIFY (theMenu.LoadMenu (m_lMenuID)); CMenu* pContextMenu = theMenu.GetSubMenu (0); pContextMenu->TrackPopupMenu (TPM_LEFTALIGN | TPM_LEFTBUTTON | TPM_RIGHTBUTTON, ptMenu.x, ptMenu.y, GetParentFrame ()); }