104 lines
3.9 KiB
C++
104 lines
3.9 KiB
C++
#include <mixer/ChannelCtrlMgr.hpp>
|
|
#include <common/odlstalt.hpp>
|
|
|
|
char ChannelControlManager::szClassName[]="ChannelControlManager";
|
|
|
|
ChannelControlManager::ChannelControlManager(GUIWindow &parentWindow,const Rect &creationRect,UINT controlID)
|
|
{
|
|
|
|
mPaintHandler.setCallback(this,&ChannelControlManager::paintHandler);
|
|
insertHandler(VectorHandler::PaintHandler,&mPaintHandler);
|
|
registerClass();
|
|
createWindow(parentWindow,creationRect,controlID);
|
|
mListBox=new OwnerDrawListControl(*this,Rect(0,0,parentWindow.width()-4,parentWindow.height()-4),110);
|
|
mListBox->show(SW_SHOW);
|
|
mListBox->insertString(" ");
|
|
}
|
|
|
|
ChannelControlManager::~ChannelControlManager()
|
|
{
|
|
removeHandler(VectorHandler::PaintHandler,&mPaintHandler);
|
|
}
|
|
|
|
void ChannelControlManager::registerClass()
|
|
{
|
|
HINSTANCE hInstance(processInstance());
|
|
WNDCLASS wndClass;
|
|
|
|
if(::GetClassInfo(hInstance,szClassName,(WNDCLASS FAR*)&wndClass))return;
|
|
wndClass.style =CS_HREDRAW|CS_VREDRAW|CS_DBLCLKS|CS_OWNDC;
|
|
wndClass.lpfnWndProc =(WNDPROC)Window::WndProc;
|
|
wndClass.cbClsExtra =0;
|
|
wndClass.cbWndExtra =sizeof(ChannelControlManager*);
|
|
wndClass.hInstance =hInstance;
|
|
wndClass.hIcon =::LoadIcon(NULL,IDI_APPLICATION);
|
|
wndClass.hCursor =::LoadCursor(NULL,IDC_ARROW);
|
|
wndClass.hbrBackground =(HBRUSH)::GetStockObject(LTGRAY_BRUSH);
|
|
wndClass.lpszMenuName =0;
|
|
wndClass.lpszClassName =szClassName;
|
|
::RegisterClass(&wndClass);
|
|
}
|
|
|
|
void ChannelControlManager::createWindow(GUIWindow &parentWindow,const Rect &creationRect,UINT controlID)
|
|
{
|
|
::CreateWindow(szClassName,szClassName,WS_CHILDWINDOW|WS_CLIPCHILDREN|WS_CLIPSIBLINGS,creationRect.left(),creationRect.top(),creationRect.width(),creationRect.height(),parentWindow,NULL,processInstance(),(LPSTR)this);
|
|
}
|
|
|
|
CallbackData::ReturnType ChannelControlManager::paintHandler(CallbackData &someCallbackData)
|
|
{
|
|
// Rect winRect;
|
|
// if(!mBitmapBkGnd.isOkay())return (CallbackData::ReturnType)FALSE;
|
|
// windowRect(winRect);
|
|
// mDIBitmapBkGnd->copyBits(mBitmapBkGnd->ptrData(),mBitmapBkGnd->imageExtent());
|
|
// mDIBitmapBkGnd->usePalette(*mPureDevice,TRUE);
|
|
// mDIBitmapBkGnd->stretchBlt(*mPureDevice,Rect(0,0,(winRect.right()-winRect.left())+mxBorder,height()-mStatusBar->statusBarHeight()));
|
|
// mDIBitmapBkGnd->stretchBlt(*mPureDevice,Rect(0,0,(winRect.right()-winRect.left())+mxBorder,height()));
|
|
// mDIBitmapBkGnd->usePalette(*mPureDevice,FALSE);
|
|
return (CallbackData::ReturnType)FALSE;
|
|
}
|
|
|
|
// *******************************************************************************************************************
|
|
|
|
#include <common/purehdc.hpp>
|
|
#include <common/drawitem.hpp>
|
|
#include <common/resbmp.hpp>
|
|
#include <jpgimg/dib24.hpp>
|
|
|
|
OwnerDrawListControl::OwnerDrawListControl(GUIWindow &parentWnd,const Rect &initRect,UINT controlID,DWORD style)
|
|
: OwnerDrawList(parentWnd,initRect,controlID,style)
|
|
{
|
|
mButtonUp=new ResBitmap("BUTTONUP");
|
|
mButtonUp.disposition(PointerDisposition::Delete);
|
|
mButtonDown=new ResBitmap("BUTTONDN");
|
|
mButtonDown.disposition(PointerDisposition::Delete);
|
|
mSelectOff=new ResBitmap("SELOFF");
|
|
mSelectOff.disposition(PointerDisposition::Delete);
|
|
mSelectOn=new ResBitmap("SELON");
|
|
mSelectOn.disposition(PointerDisposition::Delete);
|
|
mMaxHeight=mSelectOff->height();
|
|
}
|
|
|
|
OwnerDrawListControl::~OwnerDrawListControl()
|
|
{
|
|
}
|
|
|
|
|
|
void OwnerDrawListControl::drawEntire(const DrawItem &drawItem)
|
|
{
|
|
int xLoc=0;
|
|
PureDevice pureDevice(drawItem.deviceContext());
|
|
Rect rectItem(drawItem.rectItem());
|
|
DIBitmap bitmap(pureDevice,rectItem.width(),mMaxHeight,*mSelectOff);
|
|
/* bitmap.overlay(*mButtonUp,Point(xLoc,0));
|
|
xLoc+=mButtonUp->width()+1; */
|
|
bitmap.overlay(*mSelectOff,Point(xLoc,0));
|
|
xLoc+=mSelectOff->width()+1;
|
|
/* bitmap.overlay(*mSelectOff,Point(xLoc,0));
|
|
xLoc+=mSelectOff->width()+1;
|
|
bitmap.overlay(*mSelectOff,Point(xLoc,0));
|
|
xLoc+=mSelectOff->width()+1;
|
|
bitmap.overlay(*mSelectOff,Point(xLoc,0));
|
|
xLoc+=mSelectOff->width()+1; */
|
|
bitmap.stretchBlt(pureDevice,rectItem);
|
|
}
|