SkinBuilderView.cpp 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655
  1. // SkinBuilderView.cpp : CSkinBuilderView 类的实现
  2. //
  3. #include "stdafx.h"
  4. #include "SkinBuilder.h"
  5. #include "SkinBuilderDoc.h"
  6. #include "SkinBuilderView.h"
  7. #include ".\skinbuilderview.h"
  8. #ifdef _DEBUG
  9. #define new DEBUG_NEW
  10. #endif
  11. static UINT indicators[] ={ID_SEPARATOR, // 状态行指示器
  12. ID_INDICATOR_CAPS, ID_INDICATOR_NUM, ID_INDICATOR_SCRL, };
  13. // CSkinBuilderView
  14. IMPLEMENT_DYNCREATE( CSkinBuilderView , CView )
  15. BEGIN_MESSAGE_MAP(CSkinBuilderView, CView)
  16. // 标准打印命令
  17. ON_COMMAND(ID_FILE_PRINT, CView::OnFilePrint)
  18. ON_COMMAND(ID_FILE_PRINT_DIRECT, CView::OnFilePrint)
  19. ON_COMMAND(ID_FILE_PRINT_PREVIEW, CView::OnFilePrintPreview)
  20. ON_WM_LBUTTONDOWN()
  21. ON_WM_CREATE()
  22. END_MESSAGE_MAP()
  23. // CSkinBuilderView 构造/析构
  24. CSkinBuilderView::CSkinBuilderView()
  25. {
  26. // TODO: 在此处添加构造代码
  27. m_trackerPos.m_nStyle = CRectTracker::resizeOutside;
  28. }
  29. CSkinBuilderView::~CSkinBuilderView()
  30. {
  31. }
  32. BOOL CSkinBuilderView::PreCreateWindow( CREATESTRUCT & cs )
  33. {
  34. return CView::PreCreateWindow( cs );
  35. }
  36. void CSkinBuilderView::OnDraw( CDC * pDC )
  37. {
  38. CSkinBuilderDoc * pDoc = GetDocument();
  39. ASSERT_VALID( pDoc );
  40. if ( pDoc->m_nSelectedType == OBJECT_TYPE_IMAGE )
  41. {
  42. if ( !pDoc->m_pCurrentImage )
  43. return;
  44. CRect rtClient;
  45. GetClientRect( &rtClient );
  46. int nWidth;
  47. int nHeight;
  48. CPoint pt;
  49. nHeight = GetDocument()->m_pCurrentImage->GetHeight();
  50. nWidth = GetDocument()->m_pCurrentImage->GetWidth();
  51. int nLeft, nTop, nRight, nBottom;
  52. nLeft = ( rtClient.Width() - nWidth ) / 2;
  53. nTop = ( rtClient.Height() - nHeight ) / 2;
  54. nRight = nLeft + nWidth;
  55. nBottom = nTop + nHeight;
  56. m_check.ShowWindow( SW_HIDE );
  57. m_push.ShowWindow( SW_HIDE );
  58. m_radio.ShowWindow( SW_HIDE );
  59. m_group.ShowWindow( SW_HIDE );
  60. m_static.ShowWindow( SW_HIDE );
  61. m_edit.ShowWindow( SW_HIDE );
  62. GetDocument()->m_pCurrentImage->TransparentDraw( pDC,RGB( 255,0,255 ),CRect( nLeft,nTop,nRight,nBottom ) );
  63. }
  64. else if ( pDoc->m_nSelectedType == OBJECT_TYPE_SKINOBJECT_WINDOW || pDoc->m_nSelectedType == OBJECT_TYPE_SKINOBJECT_WINBUTTON )
  65. {
  66. if ( pDoc->m_pCurrentObject == NULL )
  67. return;
  68. CRect rtClient;
  69. GetClientRect( &rtClient );
  70. int nWidth;
  71. int nHeight;
  72. CPoint pt;
  73. nHeight = pDoc->m_pCurrentObject->GetHeight();
  74. nWidth = pDoc->m_pCurrentObject->GetWidth();
  75. int nLeft, nTop, nRight, nBottom;
  76. nLeft = ( rtClient.Width() - nWidth ) / 2;
  77. nTop = ( rtClient.Height() - nHeight ) / 2;
  78. m_ptTopLeft = CPoint( nLeft,nTop );
  79. nRight = nLeft + nWidth;
  80. nBottom = nTop + nHeight;
  81. CWindowSkin * pWin = ( CWindowSkin * ) pDoc->m_pCurrentObject;
  82. pWin->DrawFrame( pDC,CRect( nLeft,nTop,nRight,nBottom ),true );
  83. pWin->DrawButton( pDC,CRect( nLeft,nTop,nRight,nBottom ),0 );
  84. if ( pDoc->m_nSelectedType == OBJECT_TYPE_SKINOBJECT_WINBUTTON )
  85. {
  86. CRect rt = pDoc->m_pCurrentWinButton->GetPosition();
  87. rt.OffsetRect( nLeft,nTop );
  88. pDoc->m_pCurrentWinButton->DrawButton( pDC,rt,0 );
  89. m_trackerPos.m_rect = rt;
  90. m_trackerPos.Draw( pDC );
  91. }
  92. m_check.ShowWindow( SW_HIDE );
  93. m_push.ShowWindow( SW_HIDE );
  94. m_radio.ShowWindow( SW_HIDE );
  95. m_group.ShowWindow( SW_HIDE );
  96. m_static.ShowWindow( SW_HIDE );
  97. m_edit.ShowWindow( SW_HIDE );
  98. // GetSkinDrawHelper()->DrawButton(pDC,CRect(12,12,33,33),pWin->winButtonSkin[0],keWinButtonHover);
  99. }
  100. else if ( pDoc->m_nSelectedType == OBJECT_TYPE_SKINOBJECT_SCROLLBAR )
  101. {
  102. // if(pDoc->m_pCurrentObject == NULL)
  103. // return;
  104. // CRect rtClient;
  105. // GetClientRect(&rtClient);
  106. // int nWidth;
  107. // int nHeight;
  108. // CPoint pt;
  109. // nHeight = 17;
  110. // nWidth = 150;
  111. // int nLeft,nTop;
  112. // nLeft = (rtClient.Width() - nWidth)/2;
  113. // nTop = (rtClient.Height()- nHeight)/2;
  114. // m_ptTopLeft = CPoint(nLeft,nTop);
  115. // CScrollBarSkin *pScrollBar = (CScrollBarSkin*)pDoc->m_pCurrentObject;
  116. //// pScrollBar->DrawHScroll(pDC,CRect(nLeft,nTop,nLeft + nWidth,nTop + nHeight),0);
  117. //// pScrollBar->DrawHThumb(pDC,CRect(nLeft+ nHeight,nTop,nLeft + 2*nHeight,nTop + nHeight),0);
  118. // nLeft += 160;
  119. // nTop -= 67;
  120. // nHeight = 150;
  121. // nWidth = 17;
  122. // //m_ptTopLeft += CPoint(155,-67);
  123. // pScrollBar->DrawVScroll(pDC,CRect(nLeft,nTop,nLeft + nWidth,nTop + nHeight),0);
  124. // pScrollBar->DrawVThumb(pDC,CRect(nLeft,nTop + nWidth,nLeft + nWidth,nTop + 2*nWidth ),0);
  125. // m_check.ShowWindow(SW_HIDE);
  126. // m_push.ShowWindow(SW_HIDE);
  127. // m_radio.ShowWindow(SW_HIDE);
  128. // m_group.ShowWindow(SW_HIDE);
  129. // m_static.ShowWindow(SW_HIDE);
  130. // m_edit.ShowWindow(SW_HIDE);
  131. }
  132. // TODO: 在此处为本机数据添加绘制代码
  133. }
  134. #ifdef _DEBUG
  135. void CSkinBuilderView::AssertValid() const
  136. {
  137. CView::AssertValid();
  138. }
  139. void CSkinBuilderView::Dump( CDumpContext & dc ) const
  140. {
  141. CView::Dump( dc );
  142. }
  143. CSkinBuilderDoc * CSkinBuilderView::GetDocument() const // 非调试版本是内联的
  144. {
  145. ASSERT( m_pDocument->IsKindOf( RUNTIME_CLASS( CSkinBuilderDoc ) ) );
  146. return ( CSkinBuilderDoc * ) m_pDocument;
  147. }
  148. #endif //_DEBUG
  149. // CSkinBuilderView 消息处理程序
  150. void CSkinBuilderView::OnUpdate( CView* /*pSender*/ , LPARAM /*lHint*/ , CObject* /*pHint*/ )
  151. {
  152. // TODO: Add your specialized code here and/or call the base class
  153. m_check.ShowWindow( SW_HIDE );
  154. m_push.ShowWindow( SW_HIDE );
  155. m_radio.ShowWindow( SW_HIDE );
  156. m_group.ShowWindow( SW_HIDE );
  157. m_static.ShowWindow( SW_HIDE );
  158. m_edit.ShowWindow( SW_HIDE );
  159. m_scrollbar.ShowWindow( SW_HIDE );
  160. m_combox.ShowWindow( SW_HIDE );
  161. m_listbox.ShowWindow( SW_HIDE );
  162. m_spin.ShowWindow( SW_HIDE );
  163. m_header.ShowWindow( SW_HIDE );
  164. m_slider.ShowWindow( SW_HIDE );
  165. m_tab.ShowWindow( SW_HIDE );
  166. m_statusbar.ShowWindow( SW_HIDE );
  167. m_toolbar.ShowWindow( SW_HIDE );
  168. CSkinBuilderDoc * pDoc = GetDocument();
  169. ASSERT_VALID( pDoc );
  170. if ( pDoc->m_nSelectedType == OBJECT_TYPE_SKINOBJECT_BUTTON )
  171. {
  172. if ( pDoc->m_pCurrentObject == NULL )
  173. return;
  174. CRect rtClient;
  175. GetClientRect( &rtClient );
  176. int nWidth;
  177. int nHeight;
  178. CPoint pt;
  179. nHeight = 23;
  180. nWidth = 80;
  181. int nLeft, nTop;
  182. nLeft = ( rtClient.Width() - nWidth ) / 2;
  183. nTop = ( rtClient.Height() - nHeight ) / 2;
  184. m_ptTopLeft = CPoint( nLeft,nTop );
  185. m_skinPush.LoadSkin();
  186. m_push.ShowWindow( SW_SHOW );
  187. m_push.MoveWindow( CRect( nLeft,nTop,nLeft + nWidth,nTop + nHeight ),TRUE );
  188. /* CButtonSkin *pButton = (CButtonSkin*)pDoc->m_pCurrentObject;
  189. pButton->DrawButton(pDC,CRect(nLeft,nTop,nLeft + nWidth,nTop + nHeight),0);*/
  190. }
  191. else if ( pDoc->m_nSelectedType == OBJECT_TYPE_SKINOBJECT_CHECK )
  192. {
  193. if ( pDoc->m_pCurrentObject == NULL )
  194. return;
  195. CRect rtClient;
  196. GetClientRect( &rtClient );
  197. int nWidth;
  198. int nHeight;
  199. CPoint pt;
  200. nHeight = 23;
  201. nWidth = 80;
  202. int nLeft, nTop;
  203. nLeft = ( rtClient.Width() - nWidth ) / 2;
  204. nTop = ( rtClient.Height() - nHeight ) / 2;
  205. m_ptTopLeft = CPoint( nLeft,nTop );
  206. m_skinCheck.LoadSkin();
  207. m_check.ShowWindow( SW_SHOW );
  208. m_check.MoveWindow( CRect( nLeft,nTop,nLeft + nWidth,nTop + nHeight ),TRUE );
  209. }
  210. else if ( pDoc->m_nSelectedType == OBJECT_TYPE_SKINOBJECT_RADIO )
  211. {
  212. if ( pDoc->m_pCurrentObject == NULL )
  213. return;
  214. CRect rtClient;
  215. GetClientRect( &rtClient );
  216. int nWidth;
  217. int nHeight;
  218. CPoint pt;
  219. nHeight = 23;
  220. nWidth = 80;
  221. int nLeft, nTop;
  222. nLeft = ( rtClient.Width() - nWidth ) / 2;
  223. nTop = ( rtClient.Height() - nHeight ) / 2;
  224. m_ptTopLeft = CPoint( nLeft,nTop );
  225. m_skinRadio.LoadSkin();
  226. m_radio.ShowWindow( SW_SHOW );
  227. m_radio.MoveWindow( CRect( nLeft,nTop,nLeft + nWidth,nTop + nHeight ),TRUE );
  228. }
  229. else if ( pDoc->m_nSelectedType == OBJECT_TYPE_SKINOBJECT_GROUP )
  230. {
  231. if ( pDoc->m_pCurrentObject == NULL )
  232. return;
  233. CRect rtClient;
  234. GetClientRect( &rtClient );
  235. int nWidth;
  236. int nHeight;
  237. CPoint pt;
  238. nHeight = 200;
  239. nWidth = 150;
  240. int nLeft, nTop;
  241. nLeft = ( rtClient.Width() - nWidth ) / 2;
  242. nTop = ( rtClient.Height() - nHeight ) / 2;
  243. m_ptTopLeft = CPoint( nLeft,nTop );
  244. m_skinGroup.LoadSkin();
  245. m_group.ShowWindow( SW_SHOW );
  246. m_group.MoveWindow( CRect( nLeft,nTop,nLeft + nWidth,nTop + nHeight ),TRUE );
  247. }
  248. else if ( pDoc->m_nSelectedType == OBJECT_TYPE_SKINOBJECT_STATIC )
  249. {
  250. if ( pDoc->m_pCurrentObject == NULL )
  251. return;
  252. CRect rtClient;
  253. GetClientRect( &rtClient );
  254. int nWidth;
  255. int nHeight;
  256. CPoint pt;
  257. nHeight = 30;
  258. nWidth = 80;
  259. int nLeft, nTop;
  260. nLeft = ( rtClient.Width() - nWidth ) / 2;
  261. nTop = ( rtClient.Height() - nHeight ) / 2;
  262. m_ptTopLeft = CPoint( nLeft,nTop );
  263. m_skinStatic.LoadSkin();
  264. m_static.ShowWindow( SW_SHOW );
  265. m_static.MoveWindow( CRect( nLeft,nTop,nLeft + nWidth,nTop + nHeight ),TRUE );
  266. }
  267. else if ( pDoc->m_nSelectedType == OBJECT_TYPE_SKINOBJECT_EDIT )
  268. {
  269. if ( pDoc->m_pCurrentObject == NULL )
  270. return;
  271. CRect rtClient;
  272. GetClientRect( &rtClient );
  273. int nWidth;
  274. int nHeight;
  275. CPoint pt;
  276. nHeight = 100;
  277. nWidth = 100;
  278. int nLeft, nTop;
  279. nLeft = ( rtClient.Width() - nWidth ) / 2;
  280. nTop = ( rtClient.Height() - nHeight ) / 2;
  281. m_ptTopLeft = CPoint( nLeft,nTop );
  282. m_skinEdit.LoadSkin();
  283. m_edit.ShowWindow( SW_SHOW );
  284. m_edit.MoveWindow( CRect( nLeft,nTop,nLeft + nWidth,nTop + nHeight ),TRUE );
  285. }
  286. else if ( pDoc->m_nSelectedType == OBJECT_TYPE_SKINOBJECT_SCROLLBAR )
  287. {
  288. if ( pDoc->m_pCurrentObject == NULL )
  289. return;
  290. CRect rtClient;
  291. GetClientRect( &rtClient );
  292. int nWidth;
  293. int nHeight;
  294. CPoint pt;
  295. nHeight = 17;
  296. nWidth = 150;
  297. int nLeft, nTop;
  298. nLeft = ( rtClient.Width() - nWidth ) / 2;
  299. nTop = ( rtClient.Height() - nHeight ) / 2;
  300. m_ptTopLeft = CPoint( nLeft,nTop );
  301. m_skinScrollBar.LoadSkin();
  302. m_scrollbar.ShowWindow( SW_SHOW );
  303. m_scrollbar.MoveWindow( CRect( nLeft,nTop,nLeft + nWidth,nTop + nHeight ),TRUE );
  304. }
  305. else if ( pDoc->m_nSelectedType == OBJECT_TYPE_SKINOBJECT_COMBOX )
  306. {
  307. if ( pDoc->m_pCurrentObject == NULL )
  308. return;
  309. CRect rtClient;
  310. GetClientRect( &rtClient );
  311. int nWidth;
  312. int nHeight;
  313. CPoint pt;
  314. nHeight = 100;
  315. nWidth = 100;
  316. int nLeft, nTop;
  317. nLeft = ( rtClient.Width() - nWidth ) / 2;
  318. nTop = ( rtClient.Height() - nHeight ) / 2;
  319. m_ptTopLeft = CPoint( nLeft,nTop );
  320. m_skinCombox.LoadSkin();
  321. m_combox.ShowWindow( SW_SHOW );
  322. m_combox.MoveWindow( CRect( nLeft,nTop,nLeft + nWidth,nTop + nHeight ),TRUE );
  323. }
  324. else if ( pDoc->m_nSelectedType == OBJECT_TYPE_SKINOBJECT_LISTBOX )
  325. {
  326. if ( pDoc->m_pCurrentObject == NULL )
  327. return;
  328. CRect rtClient;
  329. GetClientRect( &rtClient );
  330. int nWidth;
  331. int nHeight;
  332. CPoint pt;
  333. nHeight = 300;
  334. nWidth = 120;
  335. int nLeft, nTop;
  336. nLeft = ( rtClient.Width() - nWidth ) / 2;
  337. nTop = ( rtClient.Height() - nHeight ) / 2;
  338. m_ptTopLeft = CPoint( nLeft,nTop );
  339. m_skinListBox.LoadSkin();
  340. m_listbox.ShowWindow( SW_SHOW );
  341. m_listbox.MoveWindow( CRect( nLeft,nTop,nLeft + nWidth,nTop + nHeight ),TRUE );
  342. }
  343. else if ( pDoc->m_nSelectedType == OBJECT_TYPE_SKINOBJECT_SPIN )
  344. {
  345. if ( pDoc->m_pCurrentObject == NULL )
  346. return;
  347. CRect rtClient;
  348. GetClientRect( &rtClient );
  349. int nWidth;
  350. int nHeight;
  351. CPoint pt;
  352. nHeight = 40;
  353. nWidth = 20;
  354. int nLeft, nTop;
  355. nLeft = ( rtClient.Width() - nWidth ) / 2;
  356. nTop = ( rtClient.Height() - nHeight ) / 2;
  357. m_ptTopLeft = CPoint( nLeft,nTop );
  358. m_skinSpin.LoadSkin();
  359. m_spin.ShowWindow( SW_SHOW );
  360. m_spin.MoveWindow( CRect( nLeft,nTop,nLeft + nWidth,nTop + nHeight ),TRUE );
  361. }
  362. else if ( pDoc->m_nSelectedType == OBJECT_TYPE_SKINOBJECT_HEADER )
  363. {
  364. if ( pDoc->m_pCurrentObject == NULL )
  365. return;
  366. CRect rtClient;
  367. GetClientRect( &rtClient );
  368. int nWidth;
  369. int nHeight;
  370. CPoint pt;
  371. nHeight = 15;
  372. nWidth = 200;
  373. int nLeft, nTop;
  374. nLeft = ( rtClient.Width() - nWidth ) / 2;
  375. nTop = ( rtClient.Height() - nHeight ) / 2;
  376. m_ptTopLeft = CPoint( nLeft,nTop );
  377. m_skinHeader.LoadSkin();
  378. m_header.ShowWindow( SW_SHOW );
  379. m_header.MoveWindow( CRect( nLeft,nTop,nLeft + nWidth,nTop + nHeight ),TRUE );
  380. }
  381. else if ( pDoc->m_nSelectedType == OBJECT_TYPE_SKINOBJECT_SLIDER )
  382. {
  383. if ( pDoc->m_pCurrentObject == NULL )
  384. return;
  385. CRect rtClient;
  386. GetClientRect( &rtClient );
  387. int nWidth;
  388. int nHeight;
  389. CPoint pt;
  390. nHeight = 20;
  391. nWidth = 200;
  392. int nLeft, nTop;
  393. nLeft = ( rtClient.Width() - nWidth ) / 2;
  394. nTop = ( rtClient.Height() - nHeight ) / 2;
  395. m_ptTopLeft = CPoint( nLeft,nTop );
  396. m_skinSlider.LoadSkin();
  397. m_slider.ShowWindow( SW_SHOW );
  398. m_slider.MoveWindow( CRect( nLeft,nTop,nLeft + nWidth,nTop + nHeight ),TRUE );
  399. }
  400. else if ( pDoc->m_nSelectedType == OBJECT_TYPE_SKINOBJECT_TAB )
  401. {
  402. if ( pDoc->m_pCurrentObject == NULL )
  403. return;
  404. CRect rtClient;
  405. GetClientRect( &rtClient );
  406. int nWidth;
  407. int nHeight;
  408. CPoint pt;
  409. nHeight = 200;
  410. nWidth = 300;
  411. int nLeft, nTop;
  412. nLeft = ( rtClient.Width() - nWidth ) / 2;
  413. nTop = ( rtClient.Height() - nHeight ) / 2;
  414. m_ptTopLeft = CPoint( nLeft,nTop );
  415. m_skinTab.LoadSkin();
  416. m_tab.ShowWindow( SW_SHOW );
  417. m_tab.MoveWindow( CRect( nLeft,nTop,nLeft + nWidth,nTop + nHeight ),TRUE );
  418. }
  419. else if ( pDoc->m_nSelectedType == OBJECT_TYPE_SKINOBJECT_STATUSBAR )
  420. {
  421. if ( pDoc->m_pCurrentObject == NULL )
  422. return;
  423. CRect rtClient;
  424. GetClientRect( &rtClient );
  425. int nWidth;
  426. int nHeight;
  427. CPoint pt;
  428. nHeight = 20;
  429. nWidth = 300;
  430. int nLeft, nTop;
  431. nLeft = ( rtClient.Width() - nWidth ) / 2;
  432. nTop = ( rtClient.Height() - nHeight ) / 2;
  433. m_ptTopLeft = CPoint( nLeft,nTop );
  434. m_skinStatusbar.LoadSkin();
  435. m_statusbar.ShowWindow( SW_SHOW );
  436. m_statusbar.MoveWindow( CRect( nLeft,nTop,nLeft + nWidth,nTop + nHeight ),TRUE );
  437. }
  438. else if ( pDoc->m_nSelectedType == OBJECT_TYPE_SKINOBJECT_TOOLBAR )
  439. {
  440. if ( pDoc->m_pCurrentObject == NULL )
  441. return;
  442. CRect rtClient;
  443. GetClientRect( &rtClient );
  444. int nWidth;
  445. int nHeight;
  446. CPoint pt;
  447. nHeight = 30;
  448. nWidth = 300;
  449. int nLeft, nTop;
  450. nLeft = ( rtClient.Width() - nWidth ) / 2;
  451. nTop = ( rtClient.Height() - nHeight ) / 2;
  452. m_ptTopLeft = CPoint( nLeft,nTop );
  453. m_skinToolbar.LoadSkin();
  454. m_toolbar.ShowWindow( SW_SHOW );
  455. m_toolbar.MoveWindow( CRect( nLeft,nTop,nLeft + nWidth,nTop + nHeight ),TRUE );
  456. }
  457. Invalidate();
  458. UpdateWindow();
  459. }
  460. void CSkinBuilderView::OnLButtonDown( UINT nFlags , CPoint point )
  461. {
  462. // TODO: Add your message handler code here and/or call default
  463. CSkinBuilderDoc * pDoc = GetDocument();
  464. if ( m_trackerPos.Track( this,point,FALSE,NULL ) )
  465. {
  466. if ( pDoc->m_nSelectedType == OBJECT_TYPE_SKINOBJECT_WINBUTTON )
  467. {
  468. m_rtPos = m_trackerPos.m_rect ;
  469. m_rtPos -= m_ptTopLeft;
  470. pDoc->m_pCurrentWinButton->SetPosition( m_rtPos );
  471. }
  472. InvalidateRect( NULL );
  473. pDoc->UpdateAllViews( this );
  474. }
  475. CView::OnLButtonDown( nFlags,point );
  476. }
  477. int CSkinBuilderView::OnCreate( LPCREATESTRUCT lpCreateStruct )
  478. {
  479. if ( CView::OnCreate( lpCreateStruct ) == -1 )
  480. {
  481. return -1;
  482. }
  483. // TODO: Add your specialized creation code here
  484. m_check.Create( _T( "Check1" ),WS_CHILD | WS_VISIBLE | BS_AUTOCHECKBOX,CRect( 0,0,12,12 ),this,1 );
  485. m_check.ShowWindow( SW_HIDE );
  486. m_skinCheck.InstallSkin( m_check.GetSafeHwnd() );
  487. m_push.Create( _T( "Button" ),WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,CRect( 0,0,12,12 ),this,2 );
  488. m_push.ShowWindow( SW_HIDE );
  489. m_skinPush.InstallSkin( m_push.GetSafeHwnd() );
  490. m_radio.Create( _T( "Radio" ),WS_CHILD | WS_VISIBLE | BS_RADIOBUTTON,CRect( 0,0,12,12 ),this,3 );
  491. m_radio.ShowWindow( SW_HIDE );
  492. m_skinRadio.InstallSkin( m_radio.GetSafeHwnd() );
  493. m_group.Create( _T( "Group" ),WS_CHILD | WS_VISIBLE | BS_GROUPBOX,CRect( 0,0,12,12 ),this,4 );
  494. m_group.ShowWindow( SW_HIDE );
  495. m_skinGroup.InstallSkin( m_group.GetSafeHwnd() );
  496. m_static.Create( _T( "Static" ),WS_CHILD | WS_VISIBLE | SS_CENTER,CRect( 0,0,12,12 ),this,5 );
  497. m_static.ShowWindow( SW_HIDE );
  498. m_skinStatic.InstallSkin( m_static.GetSafeHwnd() );
  499. m_edit.Create( WS_CHILD | WS_VISIBLE | WS_HSCROLL | ES_AUTOHSCROLL,CRect( 0,0,12,12 ),this,6 );
  500. m_edit.ShowWindow( SW_HIDE );
  501. m_skinEdit.InstallSkin( m_edit.GetSafeHwnd() );
  502. m_scrollbar.Create( WS_CHILD | WS_VISIBLE | SBS_HORZ,CRect( 0,0,12,12 ),this,7 );
  503. m_scrollbar.ShowWindow( SW_HIDE );
  504. m_skinScrollBar.InstallSkin( m_scrollbar.GetSafeHwnd() );
  505. m_combox.Create( WS_CHILD | WS_VISIBLE | CBS_DROPDOWN,CRect( 0,0,30,100 ),this,8 );
  506. m_combox.ShowWindow( SW_HIDE );
  507. m_skinCombox.InstallSkin( m_combox.GetSafeHwnd() );
  508. m_listbox.Create( WS_CHILD | WS_VISIBLE | LBS_STANDARD,CRect( 0,0,30,100 ),this,9 );
  509. m_listbox.ShowWindow( SW_HIDE );
  510. m_skinListBox.InstallSkin( m_listbox.GetSafeHwnd() );
  511. m_spin.Create( WS_CHILD | WS_VISIBLE | PBS_VERTICAL,CRect( 0,0,12,12 ),this,10 );
  512. m_spin.ShowWindow( SW_HIDE );
  513. m_skinSpin.InstallSkin( m_spin.GetSafeHwnd() );
  514. m_header.Create( WS_CHILD | WS_VISIBLE | HDS_BUTTONS,CRect( 0,0,12,12 ),this,11 );
  515. m_header.ShowWindow( SW_HIDE );
  516. m_slider.Create( WS_CHILD | WS_VISIBLE | TBS_HORZ,CRect( 0,0,12,12 ),this,12 );
  517. m_slider.ShowWindow( SW_HIDE );
  518. m_skinSlider.InstallSkin( m_slider.GetSafeHwnd() );
  519. m_tab.Create( WS_CHILD | WS_VISIBLE | TCS_SINGLELINE,CRect( 0,0,12,12 ),this,13 );
  520. m_tab.ShowWindow( SW_HIDE );
  521. m_skinTab.InstallSkin( m_tab.GetSafeHwnd() );
  522. m_statusbar.Create( this,WS_CHILD | WS_VISIBLE | CBRS_ALIGN_ANY );
  523. m_statusbar.ShowWindow( SW_HIDE );
  524. m_statusbar.SetIndicators( indicators,sizeof( indicators ) / sizeof( UINT ) );
  525. m_skinStatusbar.InstallSkin( m_statusbar.GetSafeHwnd() );
  526. m_toolbar.Create( this,WS_CHILD | WS_VISIBLE | CBRS_ALIGN_ANY );
  527. m_toolbar.ShowWindow( SW_HIDE );
  528. m_skinToolbar.InstallSkin( m_toolbar.GetSafeHwnd() );
  529. m_toolbar.LoadToolBar( IDR_MAINFRAME );
  530. m_tab.InsertItem( 0,_T( "Item0" ) );
  531. m_tab.InsertItem( 1,_T( "Item1" ) );
  532. m_tab.InsertItem( 2,_T( "Item2" ) );
  533. HDITEM hItem;
  534. hItem.mask = HDI_WIDTH | HDI_TEXT | HDI_FORMAT;
  535. hItem.fmt = HDF_STRING;
  536. hItem.cxy = 30;
  537. hItem.pszText = _T( "Item1" );
  538. hItem.cchTextMax = 255;
  539. m_header.InsertItem( 0,&hItem );
  540. m_header.InsertItem( 1,&hItem );
  541. m_header.InsertItem( 2,&hItem );
  542. m_skinHeader.InstallSkin( m_header.GetSafeHwnd() );
  543. SCROLLINFO info;
  544. ::ZeroMemory( ( void * ) &info,sizeof( info ) );
  545. info.cbSize = sizeof( SCROLLINFO );
  546. info.fMask = SIF_ALL;
  547. info.nMax = 100;
  548. info.nMin = 0;
  549. info.nPage = 20;
  550. info.nPos = 10;
  551. m_scrollbar.SetScrollInfo( &info,FALSE );
  552. return 0;
  553. }