├── 1.png
├── 2.png
├── 3.png
├── 4.png
├── Bin
├── DuiLib.dll
├── DuiLib_d.dll
├── Resource
│ ├── chatlistitem.xml
│ ├── images
│ │ ├── 241_100.gif
│ │ ├── 251_100.gif
│ │ ├── Add_hover@2x.png
│ │ ├── Add_normal@2x.png
│ │ ├── Add_press@2x.png
│ │ ├── bg.png
│ │ ├── btn_close0.png
│ │ ├── btn_close1.png
│ │ ├── btn_close2.png
│ │ ├── btn_close_down.png
│ │ ├── btn_close_highlight.png
│ │ ├── btn_close_normal.png
│ │ ├── btn_login0.png
│ │ ├── btn_login1.png
│ │ ├── btn_login2.png
│ │ ├── btn_mini_down.png
│ │ ├── btn_mini_highlight.png
│ │ ├── btn_mini_normal.png
│ │ ├── button_login_down.png
│ │ ├── button_login_hover.png
│ │ ├── button_login_normal.png
│ │ ├── combo_hot.png
│ │ ├── combo_normal.png
│ │ ├── combo_pushed.png
│ │ ├── edit_frame_hover.png
│ │ ├── edit_frame_hover_reversed.png
│ │ ├── edit_frame_normal.png
│ │ ├── edit_frame_normal_reversed.png
│ │ ├── edit_hot.png
│ │ ├── edit_normal.png
│ │ ├── edit_pushed.png
│ │ ├── gh0st.png
│ │ ├── i.png
│ │ ├── icon_contacts_hover.png
│ │ ├── icon_contacts_normal.png
│ │ ├── icon_contacts_selected.png
│ │ ├── icon_file_hover.png
│ │ ├── icon_file_normal.png
│ │ ├── icon_file_selected.png
│ │ ├── icon_last_hover.png
│ │ ├── icon_last_normal.png
│ │ ├── icon_last_selected.png
│ │ ├── listen.png
│ │ ├── login_bg.png
│ │ ├── shadow.png
│ │ ├── tab_boom.png
│ │ ├── tab_right.png
│ │ ├── unify_btn_close_down.png
│ │ ├── unify_btn_close_hover.png
│ │ ├── unify_btn_close_normal.png
│ │ ├── unify_btn_max_down.png
│ │ ├── unify_btn_max_hover.png
│ │ ├── unify_btn_max_normal.png
│ │ ├── unify_btn_min_down.png
│ │ ├── unify_btn_min_hover.png
│ │ ├── unify_btn_min_normal.png
│ │ ├── unify_btn_restore_down.png
│ │ ├── unify_btn_restore_hover.png
│ │ └── unify_btn_restore_normal.png
│ ├── loginframe.xml
│ ├── mainframe.xml
│ └── mainmenu.xml
├── TIM.exe
├── TIM_d.exe
├── directui license.txt
└── duilib license.txt
├── DuiLib
├── Control
│ ├── UIActiveX.cpp
│ ├── UIActiveX.h
│ ├── UIButton.cpp
│ ├── UIButton.h
│ ├── UICheckBox.cpp
│ ├── UICheckBox.h
│ ├── UICombo.cpp
│ ├── UICombo.h
│ ├── UIDateTime.cpp
│ ├── UIDateTime.h
│ ├── UIEdit.cpp
│ ├── UIEdit.h
│ ├── UIFlash.cpp
│ ├── UIFlash.h
│ ├── UIGifAnim.cpp
│ ├── UIGifAnim.h
│ ├── UIHead.cpp
│ ├── UIHead.h
│ ├── UILabel.cpp
│ ├── UILabel.h
│ ├── UIList.cpp
│ ├── UIList.h
│ ├── UIListEx.cpp
│ ├── UIListEx.h
│ ├── UIListExItem.h
│ ├── UIListExNode.cpp
│ ├── UIListExNode.h
│ ├── UIMenu.cpp
│ ├── UIMenu.h
│ ├── UIOption.cpp
│ ├── UIOption.h
│ ├── UIProgress.cpp
│ ├── UIProgress.h
│ ├── UIRichEdit.cpp
│ ├── UIRichEdit.h
│ ├── UIScrollBar.cpp
│ ├── UIScrollBar.h
│ ├── UISlider.cpp
│ ├── UISlider.h
│ ├── UIText.cpp
│ ├── UIText.h
│ ├── UITreeView.cpp
│ ├── UITreeView.h
│ ├── UIWebBrowser.cpp
│ └── UIWebBrowser.h
├── Core
│ ├── UIBase.cpp
│ ├── UIBase.h
│ ├── UIContainer.cpp
│ ├── UIContainer.h
│ ├── UIControl.cpp
│ ├── UIControl.h
│ ├── UIDefine.h
│ ├── UIDlgBuilder.cpp
│ ├── UIDlgBuilder.h
│ ├── UIImageAttribute.cpp
│ ├── UIImageAttribute.h
│ ├── UIManager.cpp
│ ├── UIManager.h
│ ├── UIMarkup.cpp
│ ├── UIMarkup.h
│ ├── UIRender.cpp
│ └── UIRender.h
├── Debug
│ ├── DuiLib.log
│ ├── DuiLib.tlog
│ │ ├── CL.read.1.tlog
│ │ ├── CL.write.1.tlog
│ │ ├── DuiLib.lastbuildstate
│ │ ├── DuiLib.write.1u.tlog
│ │ ├── cl.command.1.tlog
│ │ ├── link.command.1.tlog
│ │ ├── link.read.1.tlog
│ │ └── link.write.1.tlog
│ ├── DuiLib_d.Build.CppClean.log
│ ├── DuiLib_d.pch
│ ├── StdAfx.obj
│ ├── ThirdParty.obj
│ ├── UIActiveX.obj
│ ├── UIBase.obj
│ ├── UIButton.obj
│ ├── UICheckBox.obj
│ ├── UIChildLayout.obj
│ ├── UICombo.obj
│ ├── UIContainer.obj
│ ├── UIControl.obj
│ ├── UIDateTime.obj
│ ├── UIDelegate.obj
│ ├── UIDlgBuilder.obj
│ ├── UIEdit.obj
│ ├── UIFlash.obj
│ ├── UIGifAnim.obj
│ ├── UIHead.obj
│ ├── UIHorizontalLayout.obj
│ ├── UIImageAttribute.obj
│ ├── UILabel.obj
│ ├── UIList.obj
│ ├── UIListEx.obj
│ ├── UIListExNode.obj
│ ├── UIManager.obj
│ ├── UIMarkup.obj
│ ├── UIMenu.obj
│ ├── UIOption.obj
│ ├── UIProgress.obj
│ ├── UIRender.obj
│ ├── UIRichEdit.obj
│ ├── UIScrollBar.obj
│ ├── UIShadow.obj
│ ├── UISlider.obj
│ ├── UITabLayout.obj
│ ├── UIText.obj
│ ├── UITileLayout.obj
│ ├── UITreeView.obj
│ ├── UIVerticalLayout.obj
│ ├── UIWebBrowser.obj
│ ├── UIlib.obj
│ ├── Utils.obj
│ ├── WinImplBase.obj
│ ├── XUnzip.obj
│ ├── stb_image.obj
│ ├── vc120.idb
│ └── vc120.pdb
├── DuiLib.vcproj
├── DuiLib.vcxproj
├── DuiLib.vcxproj.filters
├── DuiLib.vcxproj.user
├── Layout
│ ├── UIChildLayout.cpp
│ ├── UIChildLayout.h
│ ├── UIHorizontalLayout.cpp
│ ├── UIHorizontalLayout.h
│ ├── UITabLayout.cpp
│ ├── UITabLayout.h
│ ├── UITileLayout.cpp
│ ├── UITileLayout.h
│ ├── UIVerticalLayout.cpp
│ └── UIVerticalLayout.h
├── StdAfx.cpp
├── StdAfx.h
├── UIlib.cpp
├── UIlib.h
└── Utils
│ ├── Flash11.tlb
│ ├── FlashEventHandler.h
│ ├── ThirdParty.cpp
│ ├── ThirdParty.h
│ ├── UIDelegate.cpp
│ ├── UIDelegate.h
│ ├── UIShadow.cpp
│ ├── UIShadow.h
│ ├── Utils.cpp
│ ├── Utils.h
│ ├── WebBrowserEventHandler.h
│ ├── WinImplBase.cpp
│ ├── WinImplBase.h
│ ├── XUnzip.cpp
│ ├── downloadmgr.h
│ ├── flash11.tlh
│ ├── stb_image.c
│ └── stb_image.h
├── README.md
├── TIM.sln
├── TIM
├── ChatListItem.cpp
├── ChatListItem.h
├── DuiLib.exp
├── DuiLib.lib
├── DuiLib_d.exp
├── DuiLib_d.lib
├── LoginFrame.cpp
├── LoginFrame.h
├── MainFrame.cpp
├── MainFrame.h
├── ReadMe.txt
├── Resource.h
├── TIM.cpp
├── TIM.h
├── TIM.ico
├── TIM.rc
├── TIM.vcxproj
├── TIM.vcxproj.filters
├── TIM.vcxproj.user
├── small.ico
├── stdafx.cpp
├── stdafx.h
└── targetver.h
├── directui license.txt
└── duilib license.txt
/1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/1.png
--------------------------------------------------------------------------------
/2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/2.png
--------------------------------------------------------------------------------
/3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/3.png
--------------------------------------------------------------------------------
/4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/4.png
--------------------------------------------------------------------------------
/Bin/DuiLib.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/Bin/DuiLib.dll
--------------------------------------------------------------------------------
/Bin/DuiLib_d.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/Bin/DuiLib_d.dll
--------------------------------------------------------------------------------
/Bin/Resource/chatlistitem.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/Bin/Resource/images/241_100.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/Bin/Resource/images/241_100.gif
--------------------------------------------------------------------------------
/Bin/Resource/images/251_100.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/Bin/Resource/images/251_100.gif
--------------------------------------------------------------------------------
/Bin/Resource/images/Add_hover@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/Bin/Resource/images/Add_hover@2x.png
--------------------------------------------------------------------------------
/Bin/Resource/images/Add_normal@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/Bin/Resource/images/Add_normal@2x.png
--------------------------------------------------------------------------------
/Bin/Resource/images/Add_press@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/Bin/Resource/images/Add_press@2x.png
--------------------------------------------------------------------------------
/Bin/Resource/images/bg.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/Bin/Resource/images/bg.png
--------------------------------------------------------------------------------
/Bin/Resource/images/btn_close0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/Bin/Resource/images/btn_close0.png
--------------------------------------------------------------------------------
/Bin/Resource/images/btn_close1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/Bin/Resource/images/btn_close1.png
--------------------------------------------------------------------------------
/Bin/Resource/images/btn_close2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/Bin/Resource/images/btn_close2.png
--------------------------------------------------------------------------------
/Bin/Resource/images/btn_close_down.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/Bin/Resource/images/btn_close_down.png
--------------------------------------------------------------------------------
/Bin/Resource/images/btn_close_highlight.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/Bin/Resource/images/btn_close_highlight.png
--------------------------------------------------------------------------------
/Bin/Resource/images/btn_close_normal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/Bin/Resource/images/btn_close_normal.png
--------------------------------------------------------------------------------
/Bin/Resource/images/btn_login0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/Bin/Resource/images/btn_login0.png
--------------------------------------------------------------------------------
/Bin/Resource/images/btn_login1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/Bin/Resource/images/btn_login1.png
--------------------------------------------------------------------------------
/Bin/Resource/images/btn_login2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/Bin/Resource/images/btn_login2.png
--------------------------------------------------------------------------------
/Bin/Resource/images/btn_mini_down.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/Bin/Resource/images/btn_mini_down.png
--------------------------------------------------------------------------------
/Bin/Resource/images/btn_mini_highlight.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/Bin/Resource/images/btn_mini_highlight.png
--------------------------------------------------------------------------------
/Bin/Resource/images/btn_mini_normal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/Bin/Resource/images/btn_mini_normal.png
--------------------------------------------------------------------------------
/Bin/Resource/images/button_login_down.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/Bin/Resource/images/button_login_down.png
--------------------------------------------------------------------------------
/Bin/Resource/images/button_login_hover.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/Bin/Resource/images/button_login_hover.png
--------------------------------------------------------------------------------
/Bin/Resource/images/button_login_normal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/Bin/Resource/images/button_login_normal.png
--------------------------------------------------------------------------------
/Bin/Resource/images/combo_hot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/Bin/Resource/images/combo_hot.png
--------------------------------------------------------------------------------
/Bin/Resource/images/combo_normal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/Bin/Resource/images/combo_normal.png
--------------------------------------------------------------------------------
/Bin/Resource/images/combo_pushed.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/Bin/Resource/images/combo_pushed.png
--------------------------------------------------------------------------------
/Bin/Resource/images/edit_frame_hover.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/Bin/Resource/images/edit_frame_hover.png
--------------------------------------------------------------------------------
/Bin/Resource/images/edit_frame_hover_reversed.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/Bin/Resource/images/edit_frame_hover_reversed.png
--------------------------------------------------------------------------------
/Bin/Resource/images/edit_frame_normal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/Bin/Resource/images/edit_frame_normal.png
--------------------------------------------------------------------------------
/Bin/Resource/images/edit_frame_normal_reversed.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/Bin/Resource/images/edit_frame_normal_reversed.png
--------------------------------------------------------------------------------
/Bin/Resource/images/edit_hot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/Bin/Resource/images/edit_hot.png
--------------------------------------------------------------------------------
/Bin/Resource/images/edit_normal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/Bin/Resource/images/edit_normal.png
--------------------------------------------------------------------------------
/Bin/Resource/images/edit_pushed.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/Bin/Resource/images/edit_pushed.png
--------------------------------------------------------------------------------
/Bin/Resource/images/gh0st.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/Bin/Resource/images/gh0st.png
--------------------------------------------------------------------------------
/Bin/Resource/images/i.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/Bin/Resource/images/i.png
--------------------------------------------------------------------------------
/Bin/Resource/images/icon_contacts_hover.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/Bin/Resource/images/icon_contacts_hover.png
--------------------------------------------------------------------------------
/Bin/Resource/images/icon_contacts_normal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/Bin/Resource/images/icon_contacts_normal.png
--------------------------------------------------------------------------------
/Bin/Resource/images/icon_contacts_selected.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/Bin/Resource/images/icon_contacts_selected.png
--------------------------------------------------------------------------------
/Bin/Resource/images/icon_file_hover.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/Bin/Resource/images/icon_file_hover.png
--------------------------------------------------------------------------------
/Bin/Resource/images/icon_file_normal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/Bin/Resource/images/icon_file_normal.png
--------------------------------------------------------------------------------
/Bin/Resource/images/icon_file_selected.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/Bin/Resource/images/icon_file_selected.png
--------------------------------------------------------------------------------
/Bin/Resource/images/icon_last_hover.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/Bin/Resource/images/icon_last_hover.png
--------------------------------------------------------------------------------
/Bin/Resource/images/icon_last_normal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/Bin/Resource/images/icon_last_normal.png
--------------------------------------------------------------------------------
/Bin/Resource/images/icon_last_selected.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/Bin/Resource/images/icon_last_selected.png
--------------------------------------------------------------------------------
/Bin/Resource/images/listen.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/Bin/Resource/images/listen.png
--------------------------------------------------------------------------------
/Bin/Resource/images/login_bg.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/Bin/Resource/images/login_bg.png
--------------------------------------------------------------------------------
/Bin/Resource/images/shadow.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/Bin/Resource/images/shadow.png
--------------------------------------------------------------------------------
/Bin/Resource/images/tab_boom.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/Bin/Resource/images/tab_boom.png
--------------------------------------------------------------------------------
/Bin/Resource/images/tab_right.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/Bin/Resource/images/tab_right.png
--------------------------------------------------------------------------------
/Bin/Resource/images/unify_btn_close_down.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/Bin/Resource/images/unify_btn_close_down.png
--------------------------------------------------------------------------------
/Bin/Resource/images/unify_btn_close_hover.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/Bin/Resource/images/unify_btn_close_hover.png
--------------------------------------------------------------------------------
/Bin/Resource/images/unify_btn_close_normal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/Bin/Resource/images/unify_btn_close_normal.png
--------------------------------------------------------------------------------
/Bin/Resource/images/unify_btn_max_down.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/Bin/Resource/images/unify_btn_max_down.png
--------------------------------------------------------------------------------
/Bin/Resource/images/unify_btn_max_hover.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/Bin/Resource/images/unify_btn_max_hover.png
--------------------------------------------------------------------------------
/Bin/Resource/images/unify_btn_max_normal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/Bin/Resource/images/unify_btn_max_normal.png
--------------------------------------------------------------------------------
/Bin/Resource/images/unify_btn_min_down.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/Bin/Resource/images/unify_btn_min_down.png
--------------------------------------------------------------------------------
/Bin/Resource/images/unify_btn_min_hover.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/Bin/Resource/images/unify_btn_min_hover.png
--------------------------------------------------------------------------------
/Bin/Resource/images/unify_btn_min_normal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/Bin/Resource/images/unify_btn_min_normal.png
--------------------------------------------------------------------------------
/Bin/Resource/images/unify_btn_restore_down.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/Bin/Resource/images/unify_btn_restore_down.png
--------------------------------------------------------------------------------
/Bin/Resource/images/unify_btn_restore_hover.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/Bin/Resource/images/unify_btn_restore_hover.png
--------------------------------------------------------------------------------
/Bin/Resource/images/unify_btn_restore_normal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/Bin/Resource/images/unify_btn_restore_normal.png
--------------------------------------------------------------------------------
/Bin/Resource/loginframe.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
--------------------------------------------------------------------------------
/Bin/Resource/mainframe.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
--------------------------------------------------------------------------------
/Bin/Resource/mainmenu.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
16 |
--------------------------------------------------------------------------------
/Bin/TIM.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/Bin/TIM.exe
--------------------------------------------------------------------------------
/Bin/TIM_d.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/Bin/TIM_d.exe
--------------------------------------------------------------------------------
/Bin/directui license.txt:
--------------------------------------------------------------------------------
1 | DirectUI - UI Library
2 |
3 | Written by Bjarke Viksoe (bjarke@viksoe.dk)
4 | Copyright (c) 2006-2007 Bjarke Viksoe.
5 |
6 | This code may be used in compiled form in any way you desire. These
7 | source files may be redistributed by any means PROVIDING it is
8 | not sold for profit without the authors written consent, and
9 | providing that this notice and the authors name is included.
10 |
11 | This file is provided "as is" with no expressed or implied warranty.
12 | The author accepts no liability if it causes any damage to you or your
13 | computer whatsoever. It's free, so don't hassle me about it.
14 | Beware of bugs.
--------------------------------------------------------------------------------
/Bin/duilib license.txt:
--------------------------------------------------------------------------------
1 | Copyright (c) 2010-2011, duilib develop team(www.duilib.com).All rights reserved.
2 |
3 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met.
4 |
5 | Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
6 |
7 | Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
8 |
9 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
10 |
--------------------------------------------------------------------------------
/DuiLib/Control/UIActiveX.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/DuiLib/Control/UIActiveX.cpp
--------------------------------------------------------------------------------
/DuiLib/Control/UIActiveX.h:
--------------------------------------------------------------------------------
1 | #ifndef __UIACTIVEX_H__
2 | #define __UIACTIVEX_H__
3 |
4 | #pragma once
5 |
6 | struct IOleObject;
7 |
8 |
9 | namespace DuiLib {
10 | /////////////////////////////////////////////////////////////////////////////////////
11 | //
12 |
13 | class CActiveXCtrl;
14 |
15 | template< class T >
16 | class CSafeRelease
17 | {
18 | public:
19 | CSafeRelease(T* p) : m_p(p) { };
20 | ~CSafeRelease() { if( m_p != NULL ) m_p->Release(); };
21 | T* Detach() { T* t = m_p; m_p = NULL; return t; };
22 | T* m_p;
23 | };
24 |
25 | /////////////////////////////////////////////////////////////////////////////////////
26 | //
27 |
28 | class UILIB_API CActiveXUI : public CControlUI, public IMessageFilterUI
29 | {
30 | friend class CActiveXCtrl;
31 | public:
32 | CActiveXUI();
33 | virtual ~CActiveXUI();
34 |
35 | LPCTSTR GetClass() const;
36 | LPVOID GetInterface(LPCTSTR pstrName);
37 |
38 | HWND GetHostWindow() const;
39 |
40 | bool IsDelayCreate() const;
41 | void SetDelayCreate(bool bDelayCreate = true);
42 |
43 | bool CreateControl(const CLSID clsid);
44 | bool CreateControl(LPCTSTR pstrCLSID);
45 | HRESULT GetControl(const IID iid, LPVOID* ppRet);
46 | CLSID GetClisd() const;
47 | CDuiString GetModuleName() const;
48 | void SetModuleName(LPCTSTR pstrText);
49 |
50 | void SetVisible(bool bVisible = true);
51 | void SetInternVisible(bool bVisible = true);
52 | void SetPos(RECT rc);
53 | void DoPaint(HDC hDC, const RECT& rcPaint);
54 |
55 | void SetAttribute(LPCTSTR pstrName, LPCTSTR pstrValue);
56 |
57 | LRESULT MessageHandler(UINT uMsg, WPARAM wParam, LPARAM lParam, bool& bHandled);
58 |
59 | protected:
60 | virtual void ReleaseControl();
61 | virtual bool DoCreateControl();
62 |
63 | protected:
64 | CLSID m_clsid;
65 | CDuiString m_sModuleName;
66 | bool m_bCreated;
67 | bool m_bDelayCreate;
68 | IOleObject* m_pUnk;
69 | CActiveXCtrl* m_pControl;
70 | HWND m_hwndHost;
71 | };
72 |
73 | } // namespace DuiLib
74 |
75 | #endif // __UIACTIVEX_H__
76 |
--------------------------------------------------------------------------------
/DuiLib/Control/UIButton.h:
--------------------------------------------------------------------------------
1 | #ifndef __UIBUTTON_H__
2 | #define __UIBUTTON_H__
3 |
4 | #pragma once
5 |
6 | namespace DuiLib
7 | {
8 | class UILIB_API CButtonUI : public CLabelUI
9 | {
10 | public:
11 | CButtonUI();
12 |
13 | LPCTSTR GetClass() const;
14 | LPVOID GetInterface(LPCTSTR pstrName);
15 | UINT GetControlFlags() const;
16 |
17 | bool Activate();
18 | void SetEnabled(bool bEnable = true);
19 | void DoEvent(TEventUI& event);
20 |
21 | LPCTSTR GetHotForeImage();
22 | void SetHotForeImage(LPCTSTR pStrImage);
23 | LPCTSTR GetPushedForeImage();
24 | void SetPushedForeImage(LPCTSTR pStrImage);
25 |
26 | void BindTabIndex(int _BindTabIndex);
27 | void BindTabLayoutName(LPCTSTR _TabLayoutName);
28 | void BindTriggerTabSel(int _SetSelectIndex = -1);
29 | void RemoveBindTabIndex();
30 | int GetBindTabLayoutIndex();
31 | CDuiString GetBindTabLayoutName();
32 |
33 | void SetHotBkColor(DWORD dwColor);
34 | DWORD GetHotBkColor() const;
35 | void SetHotTextColor(DWORD dwColor);
36 | DWORD GetHotTextColor() const;
37 | void SetPushedTextColor(DWORD dwColor);
38 | DWORD GetPushedTextColor() const;
39 | void SetFocusedTextColor(DWORD dwColor);
40 | DWORD GetFocusedTextColor() const;
41 | SIZE EstimateSize(SIZE szAvailable);
42 | void SetAttribute(LPCTSTR pstrName, LPCTSTR pstrValue);
43 |
44 | void PaintText(HDC hDC);
45 | void PaintStatusImage(HDC hDC);
46 |
47 | protected:
48 | UINT m_uButtonState;
49 |
50 | DWORD m_dwHotBkColor;
51 | DWORD m_dwHotTextColor;
52 | DWORD m_dwPushedTextColor;
53 | DWORD m_dwFocusedTextColor;
54 |
55 | CImageAttribute m_hotForeImage;
56 | CImageAttribute m_pushedForeImage;
57 |
58 | int m_iBindTabIndex;
59 | CDuiString m_sBindTabLayoutName;
60 | };
61 |
62 | } // namespace DuiLib
63 |
64 | #endif // __UIBUTTON_H__
--------------------------------------------------------------------------------
/DuiLib/Control/UICheckBox.cpp:
--------------------------------------------------------------------------------
1 | #include "stdafx.h"
2 | #include "UICheckBox.h"
3 |
4 | namespace DuiLib
5 | {
6 | LPCTSTR CCheckBoxUI::GetClass() const
7 | {
8 | return _T("CheckBoxUI");
9 | }
10 |
11 | void CCheckBoxUI::SetCheck(bool bCheck)
12 | {
13 | Selected(bCheck);
14 | }
15 |
16 | bool CCheckBoxUI::GetCheck() const
17 | {
18 | return IsSelected();
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/DuiLib/Control/UICheckBox.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/DuiLib/Control/UICheckBox.h
--------------------------------------------------------------------------------
/DuiLib/Control/UICombo.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/DuiLib/Control/UICombo.cpp
--------------------------------------------------------------------------------
/DuiLib/Control/UICombo.h:
--------------------------------------------------------------------------------
1 | #ifndef __UICOMBO_H__
2 | #define __UICOMBO_H__
3 |
4 | #pragma once
5 |
6 | namespace DuiLib {
7 | /////////////////////////////////////////////////////////////////////////////////////
8 | //
9 |
10 | class CComboWnd;
11 |
12 | class UILIB_API CComboUI : public CContainerUI, public IListOwnerUI
13 | {
14 | friend class CComboWnd;
15 | public:
16 | CComboUI();
17 |
18 | LPCTSTR GetClass() const;
19 | LPVOID GetInterface(LPCTSTR pstrName);
20 |
21 | void DoInit();
22 | UINT GetControlFlags() const;
23 |
24 | CDuiString GetText() const;
25 | void SetEnabled(bool bEnable = true);
26 |
27 | CDuiString GetDropBoxAttributeList();
28 | void SetDropBoxAttributeList(LPCTSTR pstrList);
29 | SIZE GetDropBoxSize() const;
30 | void SetDropBoxSize(SIZE szDropBox);
31 |
32 | int GetCurSel() const;
33 | bool SelectItem(int iIndex, bool bTakeFocus = false);
34 |
35 | bool SetItemIndex(CControlUI* pControl, int iIndex);
36 | bool Add(CControlUI* pControl);
37 | bool AddAt(CControlUI* pControl, int iIndex);
38 | bool Remove(CControlUI* pControl);
39 | bool RemoveAt(int iIndex);
40 | void RemoveAll();
41 |
42 | bool Activate();
43 |
44 | RECT GetTextPadding() const;
45 | void SetTextPadding(RECT rc);
46 |
47 | TListInfoUI* GetListInfo();
48 | void SetItemFont(int index);
49 | void SetItemTextStyle(UINT uStyle);
50 | RECT GetItemTextPadding() const;
51 | void SetItemTextPadding(RECT rc);
52 | DWORD GetItemTextColor() const;
53 | void SetItemTextColor(DWORD dwTextColor);
54 | DWORD GetItemBkColor() const;
55 | void SetItemBkColor(DWORD dwBkColor);
56 | LPCTSTR GetItemBkImage() const;
57 | void SetItemBkImage(LPCTSTR pStrImage);
58 | bool IsAlternateBk() const;
59 | void SetAlternateBk(bool bAlternateBk);
60 | DWORD GetSelectedItemTextColor() const;
61 | void SetSelectedItemTextColor(DWORD dwTextColor);
62 | DWORD GetSelectedItemBkColor() const;
63 | void SetSelectedItemBkColor(DWORD dwBkColor);
64 | LPCTSTR GetSelectedItemImage() const;
65 | void SetSelectedItemImage(LPCTSTR pStrImage);
66 | DWORD GetHotItemTextColor() const;
67 | void SetHotItemTextColor(DWORD dwTextColor);
68 | DWORD GetHotItemBkColor() const;
69 | void SetHotItemBkColor(DWORD dwBkColor);
70 | LPCTSTR GetHotItemImage() const;
71 | void SetHotItemImage(LPCTSTR pStrImage);
72 | DWORD GetDisabledItemTextColor() const;
73 | void SetDisabledItemTextColor(DWORD dwTextColor);
74 | DWORD GetDisabledItemBkColor() const;
75 | void SetDisabledItemBkColor(DWORD dwBkColor);
76 | LPCTSTR GetDisabledItemImage() const;
77 | void SetDisabledItemImage(LPCTSTR pStrImage);
78 | DWORD GetItemLineColor() const;
79 | void SetItemLineColor(DWORD dwLineColor);
80 | bool IsItemShowHtml();
81 | void SetItemShowHtml(bool bShowHtml = true);
82 |
83 | SIZE EstimateSize(SIZE szAvailable);
84 | void SetPos(RECT rc);
85 | void DoEvent(TEventUI& event);
86 | void SetAttribute(LPCTSTR pstrName, LPCTSTR pstrValue);
87 |
88 | void DoPaint(HDC hDC, const RECT& rcPaint);
89 | void PaintText(HDC hDC);
90 | void PaintStatusImage(HDC hDC);
91 |
92 | protected:
93 | CComboWnd* m_pWindow;
94 |
95 | int m_iCurSel;
96 | RECT m_rcTextPadding;
97 | CDuiString m_sDropBoxAttributes;
98 | SIZE m_szDropBox;
99 | UINT m_uButtonState;
100 |
101 | TListInfoUI m_ListInfo;
102 | };
103 |
104 | } // namespace DuiLib
105 |
106 | #endif // __UICOMBO_H__
107 |
--------------------------------------------------------------------------------
/DuiLib/Control/UIDateTime.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/DuiLib/Control/UIDateTime.cpp
--------------------------------------------------------------------------------
/DuiLib/Control/UIDateTime.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/DuiLib/Control/UIDateTime.h
--------------------------------------------------------------------------------
/DuiLib/Control/UIEdit.h:
--------------------------------------------------------------------------------
1 | #ifndef __UIEDIT_H__
2 | #define __UIEDIT_H__
3 |
4 | #pragma once
5 |
6 | namespace DuiLib
7 | {
8 | class CEditWnd;
9 |
10 | class UILIB_API CEditUI : public CLabelUI
11 | {
12 | friend class CEditWnd;
13 | public:
14 | CEditUI();
15 |
16 | LPCTSTR GetClass() const;
17 | LPVOID GetInterface(LPCTSTR pstrName);
18 | UINT GetControlFlags() const;
19 |
20 | void SetEnabled(bool bEnable = true);
21 | void SetText(LPCTSTR pstrText);
22 | void SetMaxChar(UINT uMax);
23 | UINT GetMaxChar();
24 | void SetReadOnly(bool bReadOnly);
25 | bool IsReadOnly() const;
26 | void SetPasswordMode(bool bPasswordMode);
27 | bool IsPasswordMode() const;
28 | void SetPasswordChar(TCHAR cPasswordChar);
29 | TCHAR GetPasswordChar() const;
30 | void SetNumberOnly(bool bNumberOnly);
31 | bool IsNumberOnly() const;
32 | int GetWindowStyls() const;
33 |
34 | void SetNativeEditBkColor(DWORD dwBkColor);
35 | DWORD GetNativeEditBkColor() const;
36 | void SetNativeEditTextColor( LPCTSTR pStrColor );
37 | DWORD GetNativeEditTextColor() const;
38 |
39 | void SetSel(long nStartChar, long nEndChar);
40 | void SetSelAll();
41 | void SetReplaceSel(LPCTSTR lpszReplace);
42 |
43 | void SetTipValue(LPCTSTR pStrTipValue);
44 | LPCTSTR GetTipValue();
45 | void SetTipValueColor(LPCTSTR pStrColor);
46 | DWORD GetTipValueColor();
47 |
48 | void SetPos(RECT rc);
49 | void SetVisible(bool bVisible = true);
50 | void SetInternVisible(bool bVisible = true);
51 | SIZE EstimateSize(SIZE szAvailable);
52 | void DoEvent(TEventUI& event);
53 | void SetAttribute(LPCTSTR pstrName, LPCTSTR pstrValue);
54 |
55 | void PaintStatusImage(HDC hDC);
56 | void PaintText(HDC hDC);
57 |
58 | protected:
59 | CEditWnd* m_pWindow;
60 |
61 | UINT m_uMaxChar;
62 | bool m_bReadOnly;
63 | bool m_bPasswordMode;
64 | TCHAR m_cPasswordChar;
65 | UINT m_uButtonState;
66 | CDuiString m_sTipValue;
67 | DWORD m_dwTipValueColor;
68 | DWORD m_dwEditbkColor;
69 | DWORD m_dwEditTextColor;
70 | int m_iWindowStyls;
71 | };
72 | }
73 | #endif // __UIEDIT_H__
--------------------------------------------------------------------------------
/DuiLib/Control/UIFlash.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/DuiLib/Control/UIFlash.cpp
--------------------------------------------------------------------------------
/DuiLib/Control/UIFlash.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/DuiLib/Control/UIFlash.h
--------------------------------------------------------------------------------
/DuiLib/Control/UIGifAnim.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/DuiLib/Control/UIGifAnim.cpp
--------------------------------------------------------------------------------
/DuiLib/Control/UIGifAnim.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/DuiLib/Control/UIGifAnim.h
--------------------------------------------------------------------------------
/DuiLib/Control/UIHead.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/DuiLib/Control/UIHead.cpp
--------------------------------------------------------------------------------
/DuiLib/Control/UIHead.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/DuiLib/Control/UIHead.h
--------------------------------------------------------------------------------
/DuiLib/Control/UILabel.cpp:
--------------------------------------------------------------------------------
1 | #include "StdAfx.h"
2 | #include "UILabel.h"
3 | #include
4 |
5 | namespace DuiLib
6 | {
7 |
8 | CLabelUI::CLabelUI()
9 | : m_uTextStyle(DT_VCENTER)
10 | , m_dwTextColor(0)
11 | , m_dwDisabledTextColor(0)
12 | , m_iFont(-1)
13 | , m_bShowHtml(false)
14 | , m_bAutoCalcWidth(false)
15 | {
16 | ::ZeroMemory(&m_rcTextPadding, sizeof(m_rcTextPadding));
17 | }
18 |
19 | CLabelUI::~CLabelUI()
20 | {
21 |
22 | }
23 |
24 | LPCTSTR CLabelUI::GetClass() const
25 | {
26 | return _T("LabelUI");
27 | }
28 |
29 | LPVOID CLabelUI::GetInterface(LPCTSTR pstrName)
30 | {
31 | if( _tcscmp(pstrName, _T("Label")) == 0 ) return static_cast(this);
32 | return CControlUI::GetInterface(pstrName);
33 | }
34 |
35 | void CLabelUI::SetTextStyle(UINT uStyle)
36 | {
37 | m_uTextStyle = uStyle;
38 | Invalidate();
39 | }
40 |
41 | UINT CLabelUI::GetTextStyle() const
42 | {
43 | return m_uTextStyle;
44 | }
45 |
46 | void CLabelUI::SetTextColor(DWORD dwTextColor)
47 | {
48 | m_dwTextColor = dwTextColor;
49 | Invalidate();
50 | }
51 |
52 | DWORD CLabelUI::GetTextColor() const
53 | {
54 | return m_dwTextColor;
55 | }
56 |
57 | void CLabelUI::SetDisabledTextColor(DWORD dwTextColor)
58 | {
59 | m_dwDisabledTextColor = dwTextColor;
60 | Invalidate();
61 | }
62 |
63 | DWORD CLabelUI::GetDisabledTextColor() const
64 | {
65 | return m_dwDisabledTextColor;
66 | }
67 |
68 | void CLabelUI::SetFont(int index)
69 | {
70 | m_iFont = index;
71 | Invalidate();
72 | }
73 |
74 | int CLabelUI::GetFont() const
75 | {
76 | return m_iFont;
77 | }
78 |
79 | RECT CLabelUI::GetTextPadding() const
80 | {
81 | return m_rcTextPadding;
82 | }
83 |
84 | void CLabelUI::SetTextPadding(RECT rc)
85 | {
86 | m_rcTextPadding = rc;
87 | Invalidate();
88 | }
89 |
90 | bool CLabelUI::IsShowHtml()
91 | {
92 | return m_bShowHtml;
93 | }
94 |
95 | void CLabelUI::SetShowHtml(bool bShowHtml)
96 | {
97 | if( m_bShowHtml == bShowHtml ) return;
98 |
99 | m_bShowHtml = bShowHtml;
100 | Invalidate();
101 | }
102 |
103 | SIZE CLabelUI::EstimateSize(SIZE szAvailable)
104 | {
105 | if (m_bAutoCalcWidth)
106 | {
107 | RECT rcText = {0};
108 |
109 | CRenderEngine::DrawText(m_pManager->GetPaintDC(), m_pManager, rcText, m_sText, m_dwTextColor, m_iFont, DT_CALCRECT | m_uTextStyle);
110 | m_cxyFixed.cx = rcText.right - rcText.left + m_rcTextPadding.left + m_rcTextPadding.right;
111 | }
112 |
113 | if( m_cxyFixed.cy == 0 ) return CSize(m_cxyFixed.cx, m_pManager->GetFontInfo(GetFont())->tm.tmHeight + 4);
114 | return CControlUI::EstimateSize(szAvailable);
115 | }
116 |
117 | void CLabelUI::DoEvent(TEventUI& event)
118 | {
119 | if( event.Type == UIEVENT_SETFOCUS )
120 | {
121 | m_bFocused = true;
122 | return;
123 | }
124 | if( event.Type == UIEVENT_KILLFOCUS )
125 | {
126 | m_bFocused = false;
127 | return;
128 | }
129 | if( event.Type == UIEVENT_MOUSEENTER )
130 | {
131 | // return;
132 | }
133 | if( event.Type == UIEVENT_MOUSELEAVE )
134 | {
135 | // return;
136 | }
137 | CControlUI::DoEvent(event);
138 | }
139 |
140 | void CLabelUI::SetAttribute(LPCTSTR pstrName, LPCTSTR pstrValue)
141 | {
142 | if( _tcscmp(pstrName, _T("align")) == 0 ) {
143 | if( _tcsstr(pstrValue, _T("left")) != NULL ) {
144 | m_uTextStyle &= ~(DT_CENTER | DT_RIGHT | DT_SINGLELINE);
145 | m_uTextStyle |= DT_LEFT;
146 | }
147 | if( _tcsstr(pstrValue, _T("center")) != NULL ) {
148 | m_uTextStyle &= ~(DT_LEFT | DT_RIGHT );
149 | m_uTextStyle |= DT_CENTER;
150 | }
151 | if( _tcsstr(pstrValue, _T("right")) != NULL ) {
152 | m_uTextStyle &= ~(DT_LEFT | DT_CENTER | DT_SINGLELINE);
153 | m_uTextStyle |= DT_RIGHT;
154 | }
155 | }
156 | else if( _tcscmp(pstrName, _T("valign")) == 0 ) {
157 | if( _tcsstr(pstrValue, _T("top")) != NULL ) {
158 | m_uTextStyle &= ~(DT_BOTTOM | DT_VCENTER);
159 | m_uTextStyle |= (DT_TOP | DT_SINGLELINE);
160 | }
161 | if( _tcsstr(pstrValue, _T("center")) != NULL ) {
162 | m_uTextStyle &= ~(DT_TOP | DT_BOTTOM );
163 | m_uTextStyle |= (DT_VCENTER | DT_SINGLELINE);
164 | }
165 | if( _tcsstr(pstrValue, _T("bottom")) != NULL ) {
166 | m_uTextStyle &= ~(DT_TOP | DT_VCENTER);
167 | m_uTextStyle |= (DT_BOTTOM | DT_SINGLELINE);
168 | }
169 | }
170 | else if( _tcscmp(pstrName, _T("endellipsis")) == 0 ) {
171 | if( _tcscmp(pstrValue, _T("true")) == 0 ) m_uTextStyle |= DT_END_ELLIPSIS;
172 | else m_uTextStyle &= ~DT_END_ELLIPSIS;
173 | }
174 | else if( _tcscmp(pstrName, _T("font")) == 0 ) SetFont(_ttoi(pstrValue));
175 | else if( _tcscmp(pstrName, _T("textcolor")) == 0 ) {
176 | if( *pstrValue == _T('#')) pstrValue = ::CharNext(pstrValue);
177 | LPTSTR pstr = NULL;
178 | DWORD clrColor = _tcstoul(pstrValue, &pstr, 16);
179 | SetTextColor(clrColor);
180 | }
181 | else if( _tcscmp(pstrName, _T("disabledtextcolor")) == 0 ) {
182 | if( *pstrValue == _T('#')) pstrValue = ::CharNext(pstrValue);
183 | LPTSTR pstr = NULL;
184 | DWORD clrColor = _tcstoul(pstrValue, &pstr, 16);
185 | SetDisabledTextColor(clrColor);
186 | }
187 | else if( _tcscmp(pstrName, _T("textpadding")) == 0 ) {
188 | RECT rcTextPadding = { 0 };
189 | LPTSTR pstr = NULL;
190 | rcTextPadding.left = _tcstol(pstrValue, &pstr, 10); ASSERT(pstr);
191 | rcTextPadding.top = _tcstol(pstr + 1, &pstr, 10); ASSERT(pstr);
192 | rcTextPadding.right = _tcstol(pstr + 1, &pstr, 10); ASSERT(pstr);
193 | rcTextPadding.bottom = _tcstol(pstr + 1, &pstr, 10); ASSERT(pstr);
194 | SetTextPadding(rcTextPadding);
195 | }
196 | else if( _tcscmp(pstrName, _T("showhtml")) == 0 ) SetShowHtml(_tcscmp(pstrValue, _T("true")) == 0);
197 | else if( _tcscmp(pstrName, _T("autocalcwidth")) == 0 ) {
198 | SetAutoCalcWidth(_tcscmp(pstrValue, _T("true")) == 0);
199 | }
200 | else CControlUI::SetAttribute(pstrName, pstrValue);
201 | }
202 |
203 | void CLabelUI::PaintText(HDC hDC)
204 | {
205 | if( m_dwTextColor == 0 ) m_dwTextColor = m_pManager->GetDefaultFontColor();
206 | if( m_dwDisabledTextColor == 0 ) m_dwDisabledTextColor = m_pManager->GetDefaultDisabledColor();
207 |
208 | RECT rc = m_rcItem;
209 | rc.left += m_rcTextPadding.left;
210 | rc.right -= m_rcTextPadding.right;
211 | rc.top += m_rcTextPadding.top;
212 | rc.bottom -= m_rcTextPadding.bottom;
213 |
214 | if( m_sText.IsEmpty() ) return;
215 | int nLinks = 0;
216 | if( IsEnabled() ) {
217 | if( m_bShowHtml )
218 | CRenderEngine::DrawHtmlText(hDC, m_pManager, rc, m_sText, m_dwTextColor, \
219 | NULL, NULL, nLinks, DT_SINGLELINE | m_uTextStyle);
220 | else
221 | CRenderEngine::DrawText(hDC, m_pManager, rc, m_sText, m_dwTextColor, \
222 | m_iFont, DT_SINGLELINE | m_uTextStyle);
223 | }
224 | else {
225 | if( m_bShowHtml )
226 | CRenderEngine::DrawHtmlText(hDC, m_pManager, rc, m_sText, m_dwDisabledTextColor, \
227 | NULL, NULL, nLinks, DT_SINGLELINE | m_uTextStyle);
228 | else
229 | CRenderEngine::DrawText(hDC, m_pManager, rc, m_sText, m_dwDisabledTextColor, \
230 | m_iFont, DT_SINGLELINE | m_uTextStyle);
231 | }
232 | }
233 |
234 | bool CLabelUI::GetAutoCalcWidth() const
235 | {
236 | return m_bAutoCalcWidth;
237 | }
238 |
239 | void CLabelUI::SetAutoCalcWidth(bool bAutoCalcWidth)
240 | {
241 | m_bAutoCalcWidth = bAutoCalcWidth;
242 | }
243 | }
--------------------------------------------------------------------------------
/DuiLib/Control/UILabel.h:
--------------------------------------------------------------------------------
1 | #ifndef __UILABEL_H__
2 | #define __UILABEL_H__
3 |
4 | #pragma once
5 |
6 | namespace DuiLib
7 | {
8 | class UILIB_API CLabelUI : public CControlUI
9 | {
10 | public:
11 | CLabelUI();
12 | ~CLabelUI();
13 |
14 | LPCTSTR GetClass() const;
15 | LPVOID GetInterface(LPCTSTR pstrName);
16 |
17 | void SetTextStyle(UINT uStyle);
18 | UINT GetTextStyle() const;
19 | void SetTextColor(DWORD dwTextColor);
20 | DWORD GetTextColor() const;
21 | void SetDisabledTextColor(DWORD dwTextColor);
22 | DWORD GetDisabledTextColor() const;
23 | void SetFont(int index);
24 | int GetFont() const;
25 | RECT GetTextPadding() const;
26 | void SetTextPadding(RECT rc);
27 | bool IsShowHtml();
28 | void SetShowHtml(bool bShowHtml = true);
29 |
30 | SIZE EstimateSize(SIZE szAvailable);
31 | void DoEvent(TEventUI& event);
32 | void SetAttribute(LPCTSTR pstrName, LPCTSTR pstrValue);
33 |
34 | void PaintText(HDC hDC);
35 |
36 | virtual bool GetAutoCalcWidth() const;
37 | virtual void SetAutoCalcWidth(bool bAutoCalcWidth);
38 |
39 | protected:
40 | DWORD m_dwTextColor;
41 | DWORD m_dwDisabledTextColor;
42 | int m_iFont;
43 | UINT m_uTextStyle;
44 | RECT m_rcTextPadding;
45 | bool m_bShowHtml;
46 | bool m_bAutoCalcWidth;
47 |
48 | };
49 | }
50 |
51 | #endif // __UILABEL_H__
--------------------------------------------------------------------------------
/DuiLib/Control/UIList.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/DuiLib/Control/UIList.cpp
--------------------------------------------------------------------------------
/DuiLib/Control/UIList.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/DuiLib/Control/UIList.h
--------------------------------------------------------------------------------
/DuiLib/Control/UIListEx.cpp:
--------------------------------------------------------------------------------
1 | #include "stdafx.h"
2 | #include "UIListEx.h"
3 | #include "UIListExItem.h"
4 |
5 | namespace DuiLib
6 | {
7 |
8 |
9 | CListExUI::CListExUI(/*CPaintManagerUI& paint_manager*/)
10 | :/*paint_manager_(paint_manager),*/
11 | delay_deltaY_(0),
12 | delay_number_(0),
13 | delay_left_(0)
14 | {
15 | root_node_ = new Node;
16 | root_node_->data().list_elment_ = NULL;
17 | }
18 |
19 |
20 | CListExUI::~CListExUI()
21 | {
22 | RemoveAll();
23 | if (root_node_)
24 | delete root_node_;
25 | root_node_ = NULL;
26 | }
27 |
28 | static bool OnLogoButtonEvent(void* event)
29 | {
30 | if (((TEventUI*)event)->Type == UIEVENT_BUTTONDOWN)
31 | {
32 | CControlUI* pButton = ((TEventUI*)event)->pSender;
33 | if (pButton != NULL)
34 | {
35 | CListContainerElementUI* pListElement = (CListContainerElementUI*)(pButton->GetTag());
36 | if (pListElement != NULL) pListElement->DoEvent(*(TEventUI*)event);
37 | }
38 | }
39 | return true;
40 | }
41 |
42 | CListExItem* CListExUI::GetMyListItemAt(int index)
43 | {
44 | return root_node_->child(index)->data().list_item_;
45 | }
46 |
47 |
48 | Node* CListExUI::AddNode(CListExItem *item, Node* parent, int insertIndex)
49 | {
50 | if (parent == NULL)
51 | parent = root_node_;
52 |
53 | CListContainerElementUI *pListElement = item->GetListContainerElementUI();
54 |
55 | Node* node = new Node;
56 | node->data().list_elment_ = item->GetListContainerElementUI();
57 | node->data().list_item_ = item;
58 |
59 | pListElement->SetTag((UINT_PTR)node);
60 | pListElement->SetFixedHeight(60);
61 |
62 | int index = 0;
63 | if (parent->has_children())
64 | {
65 | Node* prev = parent->get_last_child();
66 | index = prev->data().list_elment_->GetIndex() + 1;
67 | }
68 | else
69 | {
70 | if (parent == root_node_)
71 | index = 0;
72 | else
73 | index = parent->data().list_elment_->GetIndex() + 1;
74 | }
75 | bool ret = CListUI::AddAt(pListElement, insertIndex == -1 ? index : insertIndex);
76 | if (ret == false)
77 | {
78 | delete pListElement;
79 | delete node;
80 | node = NULL;
81 | }
82 | parent->add_child(node);
83 | return node;
84 | }
85 |
86 | void CListExUI::DoEvent(TEventUI& event)
87 | {
88 | if (event.Type == UIEVENT_MOUSEENTER)
89 | {
90 |
91 | }
92 | if (event.Type == UIEVENT_TIMER && event.wParam == SCROLL_TIMERID)
93 | {
94 | if (delay_left_ > 0)
95 | {
96 | --delay_left_;
97 | SIZE sz = GetScrollPos();
98 | LONG lDeltaY = (LONG)(CalculateDelay((double)delay_left_ / delay_number_) * delay_deltaY_);
99 | if ((lDeltaY > 0 && sz.cy != 0) || (lDeltaY < 0 && sz.cy != GetScrollRange().cy))
100 | {
101 | sz.cy -= lDeltaY;
102 | SetScrollPos(sz);
103 | return;
104 | }
105 | }
106 | delay_deltaY_ = 0;
107 | delay_number_ = 0;
108 | delay_left_ = 0;
109 | m_pManager->KillTimer(this, SCROLL_TIMERID);
110 | return;
111 | }
112 | if (event.Type == UIEVENT_SCROLLWHEEL)
113 | {
114 | LONG lDeltaY = 0;
115 | if (delay_number_ > 0)
116 | lDeltaY = (LONG)(CalculateDelay((double)delay_left_ / delay_number_) * delay_deltaY_);
117 | switch (LOWORD(event.wParam))
118 | {
119 | case SB_LINEUP:
120 | if (delay_deltaY_ >= 0)
121 | delay_deltaY_ = lDeltaY + 7;
122 | else
123 | delay_deltaY_ = lDeltaY + 11;
124 | break;
125 | case SB_LINEDOWN:
126 | if (delay_deltaY_ <= 0)
127 | delay_deltaY_ = lDeltaY - 7;
128 | else
129 | delay_deltaY_ = lDeltaY - 11;
130 | break;
131 | }
132 | if
133 | (delay_deltaY_ > 100) delay_deltaY_ = 100;
134 | else if
135 | (delay_deltaY_ < -100) delay_deltaY_ = -100;
136 |
137 | delay_number_ = (DWORD)sqrt((double)abs(delay_deltaY_)) * 5;
138 | delay_left_ = delay_number_;
139 | m_pManager->SetTimer(this, SCROLL_TIMERID, 20U);
140 | return;
141 | }
142 | if (event.Type == UIEVENT_CONTEXTMENU)
143 | {
144 | //m_pManager->SendNotify(this, DUI_MSGTYPE_MYLIST_MENU, (WPARAM)GetCurSel(), event.lParam);
145 | }
146 |
147 |
148 | CListUI::DoEvent(event);
149 | }
150 |
151 | void CListExUI::RemoveAll()
152 | {
153 | CListUI::RemoveAll();
154 | for (int i = 0; inum_children();)
155 | {
156 | Node* child = root_node_->child(i);
157 | RemoveNode(child);
158 | }
159 | delete root_node_;
160 |
161 | root_node_ = new Node;
162 | root_node_->data().list_elment_ = NULL;
163 | }
164 |
165 | bool CListExUI::RemoveNode(Node* node)
166 | {
167 | if (!node || node == root_node_)
168 | return false;
169 | for (int i = 0; inum_children(); ++i)
170 | {
171 | Node* child = node->child(i);
172 | RemoveNode(child);
173 | }
174 |
175 | CListUI::Remove(node->data().list_elment_);
176 |
177 | node->parent()->remove_child(node);
178 | delete node;
179 | node = NULL;
180 | return true;
181 | }
182 |
183 | Node* CListExUI::GetRoot()
184 | {
185 | return root_node_;
186 | }
187 |
188 | bool CListExUI::OnButtonEvent(void* param)
189 | {
190 | TEventUI* pEvent = (TEventUI*)param;
191 | if (pEvent->Type == UIEVENT_SETCURSOR) {
192 | return false;
193 | }
194 | return true;
195 | }
196 | }
--------------------------------------------------------------------------------
/DuiLib/Control/UIListEx.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/DuiLib/Control/UIListEx.h
--------------------------------------------------------------------------------
/DuiLib/Control/UIListExItem.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | namespace DuiLib
4 | {
5 | class CListExItem
6 | {
7 | public:
8 | //CPaintManagerUI *m_pManager;
9 | CListExItem(CPaintManagerUI& paint_manager, const wchar_t *item_xml) : paint_manager_(paint_manager), item_xml_(item_xml)
10 | {
11 | CListContainerElementUI *pListElement = static_cast(m_dlgBuilder.Create(item_xml, (UINT)0, NULL, &paint_manager_));
12 | SetListContainerElementUI(pListElement);
13 | }
14 | ~CListExItem(){};
15 | CListContainerElementUI* GetListContainerElementUI() { return pListElement; }
16 | void SetListContainerElementUI(CListContainerElementUI* p){ pListElement = p; }
17 | CPaintManagerUI& paint_manager_;
18 | const wchar_t * item_xml_;
19 | virtual void UpdateData(BOOL b = TRUE){};
20 | private:
21 | int m_Id;
22 | int m_Index;
23 | CListContainerElementUI* pListElement;
24 | CDialogBuilder m_dlgBuilder;
25 | };
26 | }
27 |
--------------------------------------------------------------------------------
/DuiLib/Control/UIListExNode.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/DuiLib/Control/UIListExNode.cpp
--------------------------------------------------------------------------------
/DuiLib/Control/UIListExNode.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/DuiLib/Control/UIListExNode.h
--------------------------------------------------------------------------------
/DuiLib/Control/UIMenu.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/DuiLib/Control/UIMenu.cpp
--------------------------------------------------------------------------------
/DuiLib/Control/UIMenu.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/DuiLib/Control/UIMenu.h
--------------------------------------------------------------------------------
/DuiLib/Control/UIOption.cpp:
--------------------------------------------------------------------------------
1 | #include "stdafx.h"
2 | #include "UIOption.h"
3 |
4 | namespace DuiLib
5 | {
6 | COptionUI::COptionUI()
7 | : m_bSelected(false)
8 | , m_dwSelectedTextColor(0)
9 | , m_dwSelectedBkColor(0)
10 | {
11 | }
12 |
13 | COptionUI::~COptionUI()
14 | {
15 | if( !m_sGroupName.IsEmpty() && m_pManager ) m_pManager->RemoveOptionGroup(m_sGroupName, this);
16 | }
17 |
18 | LPCTSTR COptionUI::GetClass() const
19 | {
20 | return _T("OptionUI");
21 | }
22 |
23 | LPVOID COptionUI::GetInterface(LPCTSTR pstrName)
24 | {
25 | if( _tcscmp(pstrName, DUI_CTR_OPTION) == 0 ) return static_cast(this);
26 | return CButtonUI::GetInterface(pstrName);
27 | }
28 |
29 | void COptionUI::SetManager(CPaintManagerUI* pManager, CControlUI* pParent, bool bInit)
30 | {
31 | CControlUI::SetManager(pManager, pParent, bInit);
32 | if( bInit && !m_sGroupName.IsEmpty() ) {
33 | if (m_pManager) m_pManager->AddOptionGroup(m_sGroupName, this);
34 | }
35 | }
36 |
37 | LPCTSTR COptionUI::GetGroup() const
38 | {
39 | return m_sGroupName;
40 | }
41 |
42 | void COptionUI::SetGroup(LPCTSTR pStrGroupName)
43 | {
44 | if( pStrGroupName == NULL ) {
45 | if( m_sGroupName.IsEmpty() ) return;
46 | m_sGroupName.Empty();
47 | }
48 | else {
49 | if( m_sGroupName == pStrGroupName ) return;
50 | if (!m_sGroupName.IsEmpty() && m_pManager) m_pManager->RemoveOptionGroup(m_sGroupName, this);
51 | m_sGroupName = pStrGroupName;
52 | }
53 |
54 | if( !m_sGroupName.IsEmpty() ) {
55 | if (m_pManager) m_pManager->AddOptionGroup(m_sGroupName, this);
56 | }
57 | else {
58 | if (m_pManager) m_pManager->RemoveOptionGroup(m_sGroupName, this);
59 | }
60 |
61 | Selected(m_bSelected);
62 | }
63 |
64 | bool COptionUI::IsSelected() const
65 | {
66 | return m_bSelected;
67 | }
68 |
69 | void COptionUI::Selected(bool bSelected)
70 | {
71 | // if( m_bSelected == bSelected ) return;
72 | m_bSelected = bSelected;
73 | if( m_bSelected ) m_uButtonState |= UISTATE_SELECTED;
74 | else m_uButtonState &= ~UISTATE_SELECTED;
75 |
76 | if( m_pManager != NULL ) {
77 | if( !m_sGroupName.IsEmpty() ) {
78 | if( m_bSelected ) {
79 | CStdPtrArray* aOptionGroup = m_pManager->GetOptionGroup(m_sGroupName);
80 | for( int i = 0; i < aOptionGroup->GetSize(); i++ ) {
81 | COptionUI* pControl = static_cast(aOptionGroup->GetAt(i));
82 | if( pControl != this ) {
83 | pControl->Selected(false);
84 | }
85 | }
86 | m_pManager->SendNotify(this, DUI_MSGTYPE_SELECTCHANGED);
87 | }
88 | }
89 | else {
90 | m_pManager->SendNotify(this, DUI_MSGTYPE_SELECTCHANGED);
91 | }
92 | }
93 |
94 | Invalidate();
95 | }
96 |
97 | bool COptionUI::Activate()
98 | {
99 | if( !CButtonUI::Activate() ) return false;
100 | if( !m_sGroupName.IsEmpty() ) Selected(true);
101 | else Selected(!m_bSelected);
102 |
103 | return true;
104 | }
105 |
106 | void COptionUI::SetEnabled(bool bEnable)
107 | {
108 | CControlUI::SetEnabled(bEnable);
109 | if( !IsEnabled() ) {
110 | if( m_bSelected ) m_uButtonState = UISTATE_SELECTED;
111 | else m_uButtonState = 0;
112 | }
113 | }
114 |
115 | LPCTSTR COptionUI::GetSelectedImage()
116 | {
117 | return m_selectedImage.GetAttributeString();
118 | }
119 |
120 | void COptionUI::SetSelectedImage(LPCTSTR pStrImage)
121 | {
122 | m_selectedImage.SetAttributeString(pStrImage);
123 | Invalidate();
124 | }
125 |
126 | LPCTSTR COptionUI::GetSelectedHotImage()
127 | {
128 | return m_selectedHotImage.GetAttributeString();
129 | }
130 |
131 | void COptionUI::SetSelectedHotImage( LPCTSTR pStrImage )
132 | {
133 | m_selectedHotImage.SetAttributeString(pStrImage);
134 | Invalidate();
135 | }
136 |
137 | LPCTSTR COptionUI::GetSelectedPushedImage()
138 | {
139 | return m_selectedPushedImage.GetAttributeString();
140 | }
141 |
142 | void COptionUI::SetSelectedPushedImage(LPCTSTR pStrImage)
143 | {
144 | m_selectedPushedImage.SetAttributeString(pStrImage);
145 | Invalidate();
146 | }
147 |
148 | void COptionUI::SetSelectedTextColor(DWORD dwTextColor)
149 | {
150 | m_dwSelectedTextColor = dwTextColor;
151 | }
152 |
153 | DWORD COptionUI::GetSelectedTextColor()
154 | {
155 | if (m_dwSelectedTextColor == 0) m_dwSelectedTextColor = m_pManager->GetDefaultFontColor();
156 | return m_dwSelectedTextColor;
157 | }
158 |
159 | void COptionUI::SetSelectedBkColor( DWORD dwBkColor )
160 | {
161 | m_dwSelectedBkColor = dwBkColor;
162 | }
163 |
164 | DWORD COptionUI::GetSelectBkColor()
165 | {
166 | return m_dwSelectedBkColor;
167 | }
168 |
169 | LPCTSTR COptionUI::GetSelectedForedImage()
170 | {
171 | return m_selectedForeImage.GetAttributeString();
172 | }
173 |
174 | void COptionUI::SetSelectedForedImage(LPCTSTR pStrImage)
175 | {
176 | m_selectedForeImage.SetAttributeString(pStrImage);
177 | Invalidate();
178 | }
179 |
180 | SIZE COptionUI::EstimateSize(SIZE szAvailable)
181 | {
182 | if( m_cxyFixed.cy == 0 ) return CSize(m_cxyFixed.cx, m_pManager->GetFontInfo(GetFont())->tm.tmHeight + 8);
183 | return CControlUI::EstimateSize(szAvailable);
184 | }
185 |
186 | void COptionUI::SetAttribute(LPCTSTR pstrName, LPCTSTR pstrValue)
187 | {
188 | if( _tcscmp(pstrName, _T("group")) == 0 ) SetGroup(pstrValue);
189 | else if( _tcscmp(pstrName, _T("selected")) == 0 ) Selected(_tcscmp(pstrValue, _T("true")) == 0);
190 | else if( _tcscmp(pstrName, _T("selectedimage")) == 0 ) SetSelectedImage(pstrValue);
191 | else if( _tcscmp(pstrName, _T("selectedhotimage")) == 0 ) SetSelectedHotImage(pstrValue);
192 | else if( _tcscmp(pstrName, _T("selectedpushedimage")) == 0 ) SetSelectedPushedImage(pstrValue);
193 | else if( _tcscmp(pstrName, _T("selectedforeimage")) == 0 ) SetSelectedForedImage(pstrValue);
194 | else if( _tcscmp(pstrName, _T("selectedbkcolor")) == 0 ) {
195 | if( *pstrValue == _T('#')) pstrValue = ::CharNext(pstrValue);
196 | LPTSTR pstr = NULL;
197 | DWORD clrColor = _tcstoul(pstrValue, &pstr, 16);
198 | SetSelectedBkColor(clrColor);
199 | }
200 | else if( _tcscmp(pstrName, _T("selectedtextcolor")) == 0 ) {
201 | if( *pstrValue == _T('#')) pstrValue = ::CharNext(pstrValue);
202 | LPTSTR pstr = NULL;
203 | DWORD clrColor = _tcstoul(pstrValue, &pstr, 16);
204 | SetSelectedTextColor(clrColor);
205 | }
206 | else CButtonUI::SetAttribute(pstrName, pstrValue);
207 | }
208 |
209 | void COptionUI::PaintStatusImage(HDC hDC)
210 | {
211 | do
212 | {
213 | if ((m_uButtonState & UISTATE_PUSHED) != 0 && IsSelected() && m_selectedPushedImage.IsLoadSuccess())
214 | {
215 | if (DrawImage(hDC, m_selectedPushedImage))
216 | break;
217 | }
218 | else if ((m_uButtonState & UISTATE_HOT) != 0 && IsSelected() && m_selectedHotImage.IsLoadSuccess()) {
219 | if (DrawImage(hDC, m_selectedHotImage))
220 | break;
221 | }
222 | else if ((m_uButtonState & UISTATE_SELECTED) != 0)
223 | {
224 | if (m_selectedImage.IsLoadSuccess())
225 | {
226 | if (DrawImage(hDC, m_selectedImage))
227 | break;
228 | }
229 | else if (m_dwSelectedBkColor != 0)
230 | {
231 | CRenderEngine::DrawColor(hDC, m_rcPaint, GetAdjustColor(m_dwSelectedBkColor));
232 | return;
233 | }
234 | }
235 |
236 | CButtonUI::PaintStatusImage(hDC);
237 | } while (0);
238 |
239 | if ( IsSelected() && m_selectedForeImage.IsLoadSuccess())
240 | {
241 | DrawImage(hDC, m_selectedForeImage);
242 | }
243 | else if( m_foreImage.IsLoadSuccess() )
244 | {
245 | DrawImage(hDC, m_foreImage);
246 | }
247 |
248 | }
249 |
250 | void COptionUI::PaintText(HDC hDC)
251 | {
252 | if( (m_uButtonState & UISTATE_SELECTED) != 0 )
253 | {
254 | DWORD oldTextColor = m_dwTextColor;
255 | if( m_dwSelectedTextColor != 0 ) m_dwTextColor = m_dwSelectedTextColor;
256 |
257 | if( m_dwTextColor == 0 ) m_dwTextColor = m_pManager->GetDefaultFontColor();
258 | if( m_dwDisabledTextColor == 0 ) m_dwDisabledTextColor = m_pManager->GetDefaultDisabledColor();
259 |
260 | if( m_sText.IsEmpty() ) return;
261 | int nLinks = 0;
262 | RECT rc = m_rcItem;
263 | rc.left += m_rcTextPadding.left;
264 | rc.right -= m_rcTextPadding.right;
265 | rc.top += m_rcTextPadding.top;
266 | rc.bottom -= m_rcTextPadding.bottom;
267 |
268 | if( m_bShowHtml )
269 | CRenderEngine::DrawHtmlText(hDC, m_pManager, rc, m_sText, IsEnabled()?m_dwTextColor:m_dwDisabledTextColor, \
270 | NULL, NULL, nLinks, m_uTextStyle);
271 | else
272 | CRenderEngine::DrawText(hDC, m_pManager, rc, m_sText, IsEnabled()?m_dwTextColor:m_dwDisabledTextColor, \
273 | m_iFont, m_uTextStyle);
274 |
275 | m_dwTextColor = oldTextColor;
276 | }
277 | else
278 | CButtonUI::PaintText(hDC);
279 | }
280 | }
--------------------------------------------------------------------------------
/DuiLib/Control/UIOption.h:
--------------------------------------------------------------------------------
1 | #ifndef __UIOPTION_H__
2 | #define __UIOPTION_H__
3 |
4 | #pragma once
5 |
6 | namespace DuiLib
7 | {
8 | class UILIB_API COptionUI : public CButtonUI
9 | {
10 | public:
11 | COptionUI();
12 | ~COptionUI();
13 |
14 | LPCTSTR GetClass() const;
15 | LPVOID GetInterface(LPCTSTR pstrName);
16 |
17 | void SetManager(CPaintManagerUI* pManager, CControlUI* pParent, bool bInit = true);
18 |
19 | bool Activate();
20 | void SetEnabled(bool bEnable = true);
21 |
22 | LPCTSTR GetSelectedImage();
23 | void SetSelectedImage(LPCTSTR pStrImage);
24 |
25 | LPCTSTR GetSelectedHotImage();
26 | void SetSelectedHotImage(LPCTSTR pStrImage);
27 |
28 | LPCTSTR GetSelectedPushedImage();
29 | void SetSelectedPushedImage(LPCTSTR pStrImage);
30 |
31 | void SetSelectedTextColor(DWORD dwTextColor);
32 | DWORD GetSelectedTextColor();
33 |
34 | void SetSelectedBkColor(DWORD dwBkColor);
35 | DWORD GetSelectBkColor();
36 |
37 | LPCTSTR GetSelectedForedImage();
38 | void SetSelectedForedImage(LPCTSTR pStrImage);
39 |
40 | LPCTSTR GetGroup() const;
41 | void SetGroup(LPCTSTR pStrGroupName = NULL);
42 | bool IsSelected() const;
43 | virtual void Selected(bool bSelected);
44 |
45 | SIZE EstimateSize(SIZE szAvailable);
46 | void SetAttribute(LPCTSTR pstrName, LPCTSTR pstrValue);
47 |
48 | void PaintStatusImage(HDC hDC);
49 | void PaintText(HDC hDC);
50 |
51 | protected:
52 | bool m_bSelected;
53 | CDuiString m_sGroupName;
54 |
55 | DWORD m_dwSelectedBkColor;
56 | DWORD m_dwSelectedTextColor;
57 |
58 | CImageAttribute m_selectedImage;
59 | CImageAttribute m_selectedHotImage;
60 | CImageAttribute m_selectedPushedImage;
61 | CImageAttribute m_selectedForeImage;
62 | };
63 |
64 | } // namespace DuiLib
65 |
66 | #endif // __UIOPTION_H__
--------------------------------------------------------------------------------
/DuiLib/Control/UIProgress.cpp:
--------------------------------------------------------------------------------
1 | #include "stdafx.h"
2 | #include "UIProgress.h"
3 |
4 | namespace DuiLib
5 | {
6 | CProgressUI::CProgressUI() : m_bHorizontal(true), m_nMin(0), m_nMax(100), m_nValue(0), m_bStretchForeImage(true)
7 | {
8 | m_uTextStyle = DT_SINGLELINE | DT_CENTER;
9 | SetFixedHeight(12);
10 | }
11 |
12 | LPCTSTR CProgressUI::GetClass() const
13 | {
14 | return _T("ProgressUI");
15 | }
16 |
17 | LPVOID CProgressUI::GetInterface(LPCTSTR pstrName)
18 | {
19 | if( _tcscmp(pstrName, DUI_CTR_PROGRESS) == 0 ) return static_cast(this);
20 | return CLabelUI::GetInterface(pstrName);
21 | }
22 |
23 | bool CProgressUI::IsHorizontal()
24 | {
25 | return m_bHorizontal;
26 | }
27 |
28 | void CProgressUI::SetHorizontal(bool bHorizontal)
29 | {
30 | if( m_bHorizontal == bHorizontal ) return;
31 |
32 | m_bHorizontal = bHorizontal;
33 | Invalidate();
34 | }
35 |
36 | int CProgressUI::GetMinValue() const
37 | {
38 | return m_nMin;
39 | }
40 |
41 | void CProgressUI::SetMinValue(int nMin)
42 | {
43 | m_nMin = nMin;
44 | Invalidate();
45 | }
46 |
47 | int CProgressUI::GetMaxValue() const
48 | {
49 | return m_nMax;
50 | }
51 |
52 | void CProgressUI::SetMaxValue(int nMax)
53 | {
54 | m_nMax = nMax;
55 | Invalidate();
56 | }
57 |
58 | int CProgressUI::GetValue() const
59 | {
60 | return m_nValue;
61 | }
62 |
63 | void CProgressUI::SetValue(int nValue)
64 | {
65 | if(nValue == m_nValue || nValue m_nMax)
66 | {
67 | return;
68 | }
69 | m_nValue = nValue;
70 | Invalidate();
71 | }
72 |
73 | void CProgressUI::SetAttribute(LPCTSTR pstrName, LPCTSTR pstrValue)
74 | {
75 | if( _tcscmp(pstrName, _T("hor")) == 0 ) SetHorizontal(_tcscmp(pstrValue, _T("true")) == 0);
76 | else if( _tcscmp(pstrName, _T("min")) == 0 ) SetMinValue(_ttoi(pstrValue));
77 | else if( _tcscmp(pstrName, _T("max")) == 0 ) SetMaxValue(_ttoi(pstrValue));
78 | else if( _tcscmp(pstrName, _T("value")) == 0 ) SetValue(_ttoi(pstrValue));
79 | else if( _tcscmp(pstrName, _T("isstretchfore"))==0) SetStretchForeImage(_tcscmp(pstrValue, _T("true")) == 0? true : false);
80 | else CLabelUI::SetAttribute(pstrName, pstrValue);
81 | }
82 |
83 | void CProgressUI::PaintStatusImage(HDC hDC)
84 | {
85 | if( m_nMax <= m_nMin ) m_nMax = m_nMin + 1;
86 | if( m_nValue > m_nMax ) m_nValue = m_nMax;
87 | if( m_nValue < m_nMin ) m_nValue = m_nMin;
88 |
89 | RECT rc = {0};
90 | if( m_bHorizontal ) {
91 | rc.right = (m_nValue - m_nMin) * (m_rcItem.right - m_rcItem.left) / (m_nMax - m_nMin);
92 | rc.bottom = m_rcItem.bottom - m_rcItem.top;
93 | }
94 | else {
95 | rc.top = (m_rcItem.bottom - m_rcItem.top) * (m_nMax - m_nValue) / (m_nMax - m_nMin);
96 | rc.right = m_rcItem.right - m_rcItem.left;
97 | rc.bottom = m_rcItem.bottom - m_rcItem.top;
98 | }
99 |
100 | if( m_foreImage.IsLoadSuccess() )
101 | {
102 | m_sForeImageModify.Empty();
103 | if (m_bStretchForeImage)
104 | m_sForeImageModify.SmallFormat(_T("dest='%d,%d,%d,%d'"), rc.left, rc.top, rc.right, rc.bottom);
105 | else
106 | m_sForeImageModify.SmallFormat(_T("dest='%d,%d,%d,%d' source='%d,%d,%d,%d'")
107 | , rc.left, rc.top, rc.right, rc.bottom
108 | , rc.left, rc.top, rc.right, rc.bottom);
109 |
110 | DrawImage(hDC, m_foreImage, m_sForeImageModify);
111 | }
112 | }
113 |
114 | bool CProgressUI::IsStretchForeImage()
115 | {
116 | return m_bStretchForeImage;
117 | }
118 |
119 | void CProgressUI::SetStretchForeImage( bool bStretchForeImage /*= true*/ )
120 | {
121 | if (m_bStretchForeImage==bStretchForeImage) return;
122 | m_bStretchForeImage=bStretchForeImage;
123 | Invalidate();
124 | }
125 | }
126 |
--------------------------------------------------------------------------------
/DuiLib/Control/UIProgress.h:
--------------------------------------------------------------------------------
1 | #ifndef __UIPROGRESS_H__
2 | #define __UIPROGRESS_H__
3 |
4 | #pragma once
5 |
6 | namespace DuiLib
7 | {
8 | class UILIB_API CProgressUI : public CLabelUI
9 | {
10 | public:
11 | CProgressUI();
12 |
13 | LPCTSTR GetClass() const;
14 | LPVOID GetInterface(LPCTSTR pstrName);
15 |
16 | bool IsHorizontal();
17 | void SetHorizontal(bool bHorizontal = true);
18 | bool IsStretchForeImage();
19 | void SetStretchForeImage(bool bStretchForeImage = true);
20 | int GetMinValue() const;
21 | void SetMinValue(int nMin);
22 | int GetMaxValue() const;
23 | void SetMaxValue(int nMax);
24 | int GetValue() const;
25 | void SetValue(int nValue);
26 |
27 | void SetAttribute(LPCTSTR pstrName, LPCTSTR pstrValue);
28 | void PaintStatusImage(HDC hDC);
29 |
30 | protected:
31 | bool m_bHorizontal;
32 | bool m_bStretchForeImage;
33 | int m_nMax;
34 | int m_nMin;
35 | int m_nValue;
36 |
37 | CDuiString m_sForeImageModify;
38 | };
39 |
40 | } // namespace DuiLib
41 |
42 | #endif // __UIPROGRESS_H__
43 |
--------------------------------------------------------------------------------
/DuiLib/Control/UIRichEdit.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/DuiLib/Control/UIRichEdit.cpp
--------------------------------------------------------------------------------
/DuiLib/Control/UIRichEdit.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/DuiLib/Control/UIRichEdit.h
--------------------------------------------------------------------------------
/DuiLib/Control/UIScrollBar.h:
--------------------------------------------------------------------------------
1 | #ifndef __UISCROLLBAR_H__
2 | #define __UISCROLLBAR_H__
3 |
4 | #pragma once
5 |
6 | namespace DuiLib
7 | {
8 | class UILIB_API CScrollBarUI : public CControlUI
9 | {
10 | public:
11 | CScrollBarUI();
12 |
13 | LPCTSTR GetClass() const;
14 | LPVOID GetInterface(LPCTSTR pstrName);
15 |
16 | CContainerUI* GetOwner() const;
17 | void SetOwner(CContainerUI* pOwner);
18 |
19 | void SetVisible(bool bVisible = true);
20 | void SetEnabled(bool bEnable = true);
21 | void SetFocus();
22 |
23 | bool IsHorizontal();
24 | void SetHorizontal(bool bHorizontal = true);
25 | int GetScrollRange() const;
26 | void SetScrollRange(int nRange);
27 | int GetScrollPos() const;
28 | void SetScrollPos(int nPos);
29 | int GetLineSize() const;
30 | void SetLineSize(int nSize);
31 |
32 | bool GetShowButton1();
33 | void SetShowButton1(bool bShow);
34 | LPCTSTR GetButton1NormalImage();
35 | void SetButton1NormalImage(LPCTSTR pStrImage);
36 | LPCTSTR GetButton1HotImage();
37 | void SetButton1HotImage(LPCTSTR pStrImage);
38 | LPCTSTR GetButton1PushedImage();
39 | void SetButton1PushedImage(LPCTSTR pStrImage);
40 | LPCTSTR GetButton1DisabledImage();
41 | void SetButton1DisabledImage(LPCTSTR pStrImage);
42 |
43 | bool GetShowButton2();
44 | void SetShowButton2(bool bShow);
45 | LPCTSTR GetButton2NormalImage();
46 | void SetButton2NormalImage(LPCTSTR pStrImage);
47 | LPCTSTR GetButton2HotImage();
48 | void SetButton2HotImage(LPCTSTR pStrImage);
49 | LPCTSTR GetButton2PushedImage();
50 | void SetButton2PushedImage(LPCTSTR pStrImage);
51 | LPCTSTR GetButton2DisabledImage();
52 | void SetButton2DisabledImage(LPCTSTR pStrImage);
53 |
54 | LPCTSTR GetThumbNormalImage();
55 | void SetThumbNormalImage(LPCTSTR pStrImage);
56 | LPCTSTR GetThumbHotImage();
57 | void SetThumbHotImage(LPCTSTR pStrImage);
58 | LPCTSTR GetThumbPushedImage();
59 | void SetThumbPushedImage(LPCTSTR pStrImage);
60 | LPCTSTR GetThumbDisabledImage();
61 | void SetThumbDisabledImage(LPCTSTR pStrImage);
62 |
63 | LPCTSTR GetRailNormalImage();
64 | void SetRailNormalImage(LPCTSTR pStrImage);
65 | LPCTSTR GetRailHotImage();
66 | void SetRailHotImage(LPCTSTR pStrImage);
67 | LPCTSTR GetRailPushedImage();
68 | void SetRailPushedImage(LPCTSTR pStrImage);
69 | LPCTSTR GetRailDisabledImage();
70 | void SetRailDisabledImage(LPCTSTR pStrImage);
71 |
72 | void SetPos(RECT rc);
73 | void DoEvent(TEventUI& event);
74 | void SetAttribute(LPCTSTR pstrName, LPCTSTR pstrValue);
75 |
76 | void DoPaint(HDC hDC, const RECT& rcPaint);
77 |
78 | void PaintBk(HDC hDC);
79 | void PaintButton1(HDC hDC);
80 | void PaintButton2(HDC hDC);
81 | void PaintThumb(HDC hDC);
82 | void PaintRail(HDC hDC);
83 |
84 | protected:
85 |
86 | enum
87 | {
88 | DEFAULT_SCROLLBAR_SIZE = 16,
89 | DEFAULT_TIMERID = 10,
90 | };
91 |
92 | bool m_bHorizontal;
93 | int m_nRange;
94 | int m_nScrollPos;
95 | int m_nLineSize;
96 | CContainerUI* m_pOwner;
97 | POINT ptLastMouse;
98 | int m_nLastScrollPos;
99 | int m_nLastScrollOffset;
100 | int m_nScrollRepeatDelay;
101 |
102 | bool m_bShowButton1;
103 | RECT m_rcButton1;
104 | UINT m_uButton1State;
105 | CImageAttribute m_button1NormalImage;
106 | CImageAttribute m_button1HotImage;
107 | CImageAttribute m_button1PushedImage;
108 | CImageAttribute m_button1DisabledImage;
109 |
110 | bool m_bShowButton2;
111 | RECT m_rcButton2;
112 | UINT m_uButton2State;
113 | CImageAttribute m_button2NormalImage;
114 | CImageAttribute m_button2HotImage;
115 | CImageAttribute m_button2PushedImage;
116 | CImageAttribute m_button2DisabledImage;
117 |
118 | RECT m_rcThumb;
119 | UINT m_uThumbState;
120 | CImageAttribute m_thumbNormalImage;
121 | CImageAttribute m_thumbHotImage;
122 | CImageAttribute m_thumbPushedImage;
123 | CImageAttribute m_thumbDisabledImage;
124 |
125 | CImageAttribute m_railNormalImage;
126 | CImageAttribute m_railHotImage;
127 | CImageAttribute m_railPushedImage;
128 | CImageAttribute m_railDisabledImage;
129 | };
130 | }
131 |
132 | #endif // __UISCROLLBAR_H__
--------------------------------------------------------------------------------
/DuiLib/Control/UISlider.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/DuiLib/Control/UISlider.cpp
--------------------------------------------------------------------------------
/DuiLib/Control/UISlider.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/DuiLib/Control/UISlider.h
--------------------------------------------------------------------------------
/DuiLib/Control/UIText.cpp:
--------------------------------------------------------------------------------
1 | #include "StdAfx.h"
2 | #include "UIText.h"
3 |
4 | namespace DuiLib
5 | {
6 | CTextUI::CTextUI() : m_nLinks(0), m_nHoverLink(-1)
7 | {
8 | m_uTextStyle = DT_WORDBREAK ;
9 | m_rcTextPadding.left = 2;
10 | m_rcTextPadding.right = 2;
11 | ::ZeroMemory(m_rcLinks, sizeof(m_rcLinks));
12 |
13 | m_dwShadowColor = 0;
14 | }
15 |
16 | CTextUI::~CTextUI()
17 | {
18 | }
19 |
20 | LPCTSTR CTextUI::GetClass() const
21 | {
22 | return _T("TextUI");
23 | }
24 |
25 | LPVOID CTextUI::GetInterface(LPCTSTR pstrName)
26 | {
27 | if( _tcscmp(pstrName, DUI_CTR_TEXT) == 0 ) return static_cast(this);
28 | return CLabelUI::GetInterface(pstrName);
29 | }
30 |
31 | UINT CTextUI::GetControlFlags() const
32 | {
33 | if( IsEnabled() && m_nLinks > 0 ) return UIFLAG_SETCURSOR;
34 | else return 0;
35 | }
36 |
37 | void CTextUI::SetText(LPCTSTR pstrText)
38 | {
39 | if (m_sText != pstrText)
40 | {
41 | __super::SetText(pstrText);
42 | if (m_pParent != NULL)
43 | m_pParent->NeedUpdate();
44 | }
45 | }
46 |
47 | CDuiString* CTextUI::GetLinkContent(int iIndex)
48 | {
49 | if( iIndex >= 0 && iIndex < m_nLinks ) return &m_sLinks[iIndex];
50 | return NULL;
51 | }
52 |
53 | void CTextUI::DoEvent(TEventUI& event)
54 | {
55 | if( !IsMouseEnabled() && event.Type > UIEVENT__MOUSEBEGIN && event.Type < UIEVENT__MOUSEEND ) {
56 | if( m_pParent != NULL ) m_pParent->DoEvent(event);
57 | else CLabelUI::DoEvent(event);
58 | return;
59 | }
60 |
61 | if( event.Type == UIEVENT_SETCURSOR ) {
62 | for( int i = 0; i < m_nLinks; i++ ) {
63 | if( ::PtInRect(&m_rcLinks[i], event.ptMouse) ) {
64 | ::SetCursor(::LoadCursor(NULL, MAKEINTRESOURCE(IDC_HAND)));
65 | return;
66 | }
67 | }
68 | }
69 | if( event.Type == UIEVENT_BUTTONDOWN || event.Type == UIEVENT_DBLCLICK && IsEnabled() ) {
70 | for( int i = 0; i < m_nLinks; i++ ) {
71 | if( ::PtInRect(&m_rcLinks[i], event.ptMouse) ) {
72 | Invalidate();
73 | return;
74 | }
75 | }
76 | }
77 | if( event.Type == UIEVENT_BUTTONUP && IsEnabled() ) {
78 | for( int i = 0; i < m_nLinks; i++ ) {
79 | if( ::PtInRect(&m_rcLinks[i], event.ptMouse) ) {
80 | m_pManager->SendNotify(this, DUI_MSGTYPE_LINK, i);
81 | return;
82 | }
83 | }
84 | }
85 | if( event.Type == UIEVENT_CONTEXTMENU )
86 | {
87 | return;
88 | }
89 | // When you move over a link
90 | if( m_nLinks > 0 && event.Type == UIEVENT_MOUSEMOVE && IsEnabled() ) {
91 | int nHoverLink = -1;
92 | for( int i = 0; i < m_nLinks; i++ ) {
93 | if( ::PtInRect(&m_rcLinks[i], event.ptMouse) ) {
94 | nHoverLink = i;
95 | break;
96 | }
97 | }
98 |
99 | if(m_nHoverLink != nHoverLink) {
100 | m_nHoverLink = nHoverLink;
101 | Invalidate();
102 | return;
103 | }
104 | }
105 | if( event.Type == UIEVENT_MOUSELEAVE ) {
106 | if( m_nLinks > 0 && IsEnabled() ) {
107 | if(m_nHoverLink != -1) {
108 | m_nHoverLink = -1;
109 | Invalidate();
110 | return;
111 | }
112 | }
113 | }
114 |
115 | CLabelUI::DoEvent(event);
116 | }
117 |
118 | SIZE CTextUI::EstimateSize(SIZE szAvailable)
119 | {
120 |
121 | RECT rcText = { 0, 0, m_bAutoCalcWidth ? 9999 : m_cxyFixed.cx, 9999 };
122 | rcText.left += m_rcTextPadding.left;
123 | rcText.right -= m_rcTextPadding.right;
124 |
125 | if( m_bShowHtml ) {
126 | int nLinks = 0;
127 | CRenderEngine::DrawHtmlText(m_pManager->GetPaintDC(), m_pManager, rcText, m_sText, m_dwTextColor, NULL, NULL, nLinks, DT_CALCRECT | m_uTextStyle);
128 | }
129 | else {
130 | CRenderEngine::DrawText(m_pManager->GetPaintDC(), m_pManager, rcText, m_sText, m_dwTextColor, m_iFont, DT_CALCRECT | m_uTextStyle);
131 | }
132 | SIZE cXY = {rcText.right - rcText.left + m_rcTextPadding.left + m_rcTextPadding.right,
133 | rcText.bottom - rcText.top + m_rcTextPadding.top + m_rcTextPadding.bottom};
134 |
135 | if (m_bAutoCalcWidth)
136 | {
137 | m_cxyFixed.cx = cXY.cx;
138 | }
139 |
140 | return CControlUI::EstimateSize(szAvailable);
141 | }
142 |
143 | void CTextUI::PaintText(HDC hDC)
144 | {
145 | if( m_sText.IsEmpty() ) {
146 | m_nLinks = 0;
147 | return;
148 | }
149 |
150 | if( m_dwTextColor == 0 ) m_dwTextColor = m_pManager->GetDefaultFontColor();
151 | if( m_dwDisabledTextColor == 0 ) m_dwDisabledTextColor = m_pManager->GetDefaultDisabledColor();
152 |
153 | if( m_sText.IsEmpty() ) return;
154 |
155 | m_nLinks = lengthof(m_rcLinks);
156 | RECT rc = m_rcItem;
157 | rc.left += m_rcTextPadding.left;
158 | rc.right -= m_rcTextPadding.right;
159 | rc.top += m_rcTextPadding.top;
160 | rc.bottom -= m_rcTextPadding.bottom;
161 |
162 | DWORD dwTextColor = m_dwTextColor;
163 | if (!IsEnabled())
164 | dwTextColor = m_dwDisabledTextColor;
165 |
166 | if( m_bShowHtml )
167 | CRenderEngine::DrawHtmlText(hDC, m_pManager, rc, m_sText, dwTextColor, \
168 | m_rcLinks, m_sLinks, m_nLinks, m_uTextStyle);
169 | else
170 | {
171 | if (m_dwShadowColor != 0)
172 | {
173 | RECT rcShadow = rc;
174 | rcShadow.left += 1;
175 | rcShadow.right += 1;
176 | rcShadow.top += 1;
177 | rcShadow.bottom += 1;
178 | CRenderEngine::DrawText(hDC, m_pManager, rcShadow, m_sText, m_dwShadowColor, \
179 | m_iFont, m_uTextStyle);
180 | }
181 |
182 | CRenderEngine::DrawText(hDC, m_pManager, rc, m_sText, dwTextColor, \
183 | m_iFont, m_uTextStyle);
184 |
185 | }
186 |
187 | }
188 |
189 | void CTextUI::SetAttribute(LPCTSTR pstrName, LPCTSTR pstrValue)
190 | {
191 | if (_tcscmp(pstrName, _T("shadowcolor")) == 0) {
192 | if (*pstrValue == _T('#')) pstrValue = ::CharNext(pstrValue);
193 | LPTSTR pstr = NULL;
194 | DWORD clrColor = _tcstoul(pstrValue, &pstr, 16);
195 | SetShadowColor(clrColor);
196 | }
197 | else
198 | __super::SetAttribute(pstrName, pstrValue);
199 | }
200 |
201 | void CTextUI::SetShadowColor(DWORD dwTextColor)
202 | {
203 | m_dwShadowColor = dwTextColor;
204 | }
205 |
206 | DWORD CTextUI::GetShadowColor() const
207 | {
208 | return m_dwShadowColor;
209 | }
210 |
211 | }
212 |
--------------------------------------------------------------------------------
/DuiLib/Control/UIText.h:
--------------------------------------------------------------------------------
1 | #ifndef __UITEXT_H__
2 | #define __UITEXT_H__
3 |
4 | #pragma once
5 |
6 | namespace DuiLib
7 | {
8 | class UILIB_API CTextUI : public CLabelUI
9 | {
10 | public:
11 | CTextUI();
12 | ~CTextUI();
13 |
14 | LPCTSTR GetClass() const;
15 | UINT GetControlFlags() const;
16 | LPVOID GetInterface(LPCTSTR pstrName);
17 | void SetText(LPCTSTR pstrText) override;
18 |
19 | CDuiString* GetLinkContent(int iIndex);
20 |
21 | void DoEvent(TEventUI& event);
22 | SIZE EstimateSize(SIZE szAvailable);
23 |
24 | void SetAttribute(LPCTSTR pstrName, LPCTSTR pstrValue);
25 | void SetShadowColor(DWORD dwTextColor);
26 | DWORD GetShadowColor() const;
27 | void PaintText(HDC hDC);
28 |
29 | protected:
30 | enum { MAX_LINK = 8 };
31 | int m_nLinks;
32 | RECT m_rcLinks[MAX_LINK];
33 | CDuiString m_sLinks[MAX_LINK];
34 | int m_nHoverLink;
35 |
36 | DWORD m_dwShadowColor;
37 | };
38 |
39 | } // namespace DuiLib
40 |
41 | #endif //__UITEXT_H__
--------------------------------------------------------------------------------
/DuiLib/Control/UITreeView.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/DuiLib/Control/UITreeView.cpp
--------------------------------------------------------------------------------
/DuiLib/Control/UITreeView.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/DuiLib/Control/UITreeView.h
--------------------------------------------------------------------------------
/DuiLib/Control/UIWebBrowser.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/DuiLib/Control/UIWebBrowser.cpp
--------------------------------------------------------------------------------
/DuiLib/Control/UIWebBrowser.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/DuiLib/Control/UIWebBrowser.h
--------------------------------------------------------------------------------
/DuiLib/Core/UIBase.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/DuiLib/Core/UIBase.cpp
--------------------------------------------------------------------------------
/DuiLib/Core/UIBase.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/DuiLib/Core/UIBase.h
--------------------------------------------------------------------------------
/DuiLib/Core/UIContainer.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/DuiLib/Core/UIContainer.cpp
--------------------------------------------------------------------------------
/DuiLib/Core/UIContainer.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/DuiLib/Core/UIContainer.h
--------------------------------------------------------------------------------
/DuiLib/Core/UIControl.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/DuiLib/Core/UIControl.cpp
--------------------------------------------------------------------------------
/DuiLib/Core/UIControl.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/DuiLib/Core/UIControl.h
--------------------------------------------------------------------------------
/DuiLib/Core/UIDefine.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/DuiLib/Core/UIDefine.h
--------------------------------------------------------------------------------
/DuiLib/Core/UIDlgBuilder.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/DuiLib/Core/UIDlgBuilder.cpp
--------------------------------------------------------------------------------
/DuiLib/Core/UIDlgBuilder.h:
--------------------------------------------------------------------------------
1 | #ifndef __UIDLGBUILDER_H__
2 | #define __UIDLGBUILDER_H__
3 |
4 | #pragma once
5 |
6 | namespace DuiLib {
7 |
8 | class IDialogBuilderCallback
9 | {
10 | public:
11 | virtual CControlUI* CreateControl(LPCTSTR pstrClass) = 0;
12 | };
13 |
14 |
15 | class UILIB_API CDialogBuilder
16 | {
17 | public:
18 | CDialogBuilder();
19 | CControlUI* Create(STRINGorID xml, LPCTSTR type = NULL, IDialogBuilderCallback* pCallback = NULL,
20 | CPaintManagerUI* pManager = NULL, CControlUI* pParent = NULL);
21 | CControlUI* Create(IDialogBuilderCallback* pCallback = NULL, CPaintManagerUI* pManager = NULL,
22 | CControlUI* pParent = NULL);
23 |
24 | CMarkup* GetMarkup();
25 |
26 | void GetLastErrorMessage(LPTSTR pstrMessage, SIZE_T cchMax) const;
27 | void GetLastErrorLocation(LPTSTR pstrSource, SIZE_T cchMax) const;
28 | private:
29 | CControlUI* _Parse(CMarkupNode* parent, CControlUI* pParent = NULL, CPaintManagerUI* pManager = NULL);
30 |
31 | CMarkup m_xml;
32 | IDialogBuilderCallback* m_pCallback;
33 | LPCTSTR m_pstrtype;
34 | };
35 |
36 | } // namespace DuiLib
37 |
38 | #endif // __UIDLGBUILDER_H__
39 |
--------------------------------------------------------------------------------
/DuiLib/Core/UIImageAttribute.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/DuiLib/Core/UIImageAttribute.cpp
--------------------------------------------------------------------------------
/DuiLib/Core/UIImageAttribute.h:
--------------------------------------------------------------------------------
1 | #ifndef __UIIMAGE_ATTRIBUTE_H__
2 | #define __UIIMAGE_ATTRIBUTE_H__
3 |
4 | #pragma once
5 |
6 | namespace DuiLib {
7 |
8 | /////////////////////////////////////////////////////////////////////////////////////
9 | //
10 |
11 | class UILIB_API CImageAttribute
12 | {
13 | public:
14 | CImageAttribute();
15 | CImageAttribute(const CImageAttribute&);
16 | const CImageAttribute& operator=(const CImageAttribute&);
17 | virtual ~CImageAttribute();
18 |
19 | const CDuiString& GetAttributeString() const;
20 | void SetAttributeString(LPCTSTR pStrImageAttri);
21 | void ModifyAttribute(LPCTSTR pStrModify);
22 | bool LoadImage(CPaintManagerUI* pManager);
23 | bool IsLoadSuccess();
24 |
25 | RECT GetDest() const;
26 | void SetDest(const RECT &rcDest);
27 | const TImageInfo* GetImageInfo() const;
28 | private:
29 | void Clone(const CImageAttribute&);
30 | void Clear();
31 | void ParseAttribute(LPCTSTR pStrImageAttri);
32 |
33 | protected:
34 | friend class CRenderEngine;
35 | CDuiString m_sImageAttribute;
36 |
37 | CDuiString m_sImage;
38 | CDuiString m_sResType;
39 | TImageInfo *m_imageInfo;
40 | bool m_bLoadSuccess;
41 |
42 | RECT m_rcDest;
43 | RECT m_rcSource;
44 | RECT m_rcCorner;
45 | BYTE m_bFade;
46 | DWORD m_dwMask;
47 | bool m_bHole;
48 | bool m_bTiledX;
49 | bool m_bTiledY;
50 |
51 | };
52 |
53 | } // namespace DuiLib
54 |
55 | #endif // __UIIMAGE_ATTRIBUTE_H__
56 |
--------------------------------------------------------------------------------
/DuiLib/Core/UIManager.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/DuiLib/Core/UIManager.cpp
--------------------------------------------------------------------------------
/DuiLib/Core/UIManager.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/DuiLib/Core/UIManager.h
--------------------------------------------------------------------------------
/DuiLib/Core/UIMarkup.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/DuiLib/Core/UIMarkup.cpp
--------------------------------------------------------------------------------
/DuiLib/Core/UIMarkup.h:
--------------------------------------------------------------------------------
1 | #ifndef __UIMARKUP_H__
2 | #define __UIMARKUP_H__
3 |
4 | #pragma once
5 |
6 | namespace DuiLib {
7 |
8 | enum
9 | {
10 | XMLFILE_ENCODING_UTF8 = 0,
11 | XMLFILE_ENCODING_UNICODE = 1,
12 | XMLFILE_ENCODING_ASNI = 2,
13 | };
14 |
15 | class CMarkup;
16 | class CMarkupNode;
17 |
18 |
19 | class UILIB_API CMarkup
20 | {
21 | friend class CMarkupNode;
22 | public:
23 | CMarkup(LPCTSTR pstrXML = NULL);
24 | ~CMarkup();
25 |
26 | bool Load(LPCTSTR pstrXML);
27 | bool LoadFromMem(BYTE* pByte, DWORD dwSize, int encoding = XMLFILE_ENCODING_UTF8);
28 | void Release();
29 | bool IsValid() const;
30 |
31 | void SetPreserveWhitespace(bool bPreserve = true);
32 | void GetLastErrorMessage(LPTSTR pstrMessage, SIZE_T cchMax) const;
33 | void GetLastErrorLocation(LPTSTR pstrSource, SIZE_T cchMax) const;
34 |
35 | CMarkupNode GetRoot();
36 |
37 | private:
38 | typedef struct tagXMLELEMENT
39 | {
40 | ULONG iStart;
41 | ULONG iChild;
42 | ULONG iNext;
43 | ULONG iParent;
44 | ULONG iData;
45 | } XMLELEMENT;
46 |
47 | LPTSTR m_pstrXML;
48 | XMLELEMENT* m_pElements;
49 | ULONG m_nElements;
50 | ULONG m_nReservedElements;
51 | TCHAR m_szErrorMsg[100];
52 | TCHAR m_szErrorXML[50];
53 | bool m_bPreserveWhitespace;
54 |
55 | private:
56 | bool _Parse();
57 | bool _Parse(LPTSTR& pstrText, ULONG iParent);
58 | XMLELEMENT* _ReserveElement();
59 | inline void _SkipWhitespace(LPTSTR& pstr) const;
60 | inline void _SkipWhitespace(LPCTSTR& pstr) const;
61 | inline void _SkipIdentifier(LPTSTR& pstr) const;
62 | inline void _SkipIdentifier(LPCTSTR& pstr) const;
63 | bool _ParseData(LPTSTR& pstrText, LPTSTR& pstrData, char cEnd);
64 | void _ParseMetaChar(LPTSTR& pstrText, LPTSTR& pstrDest);
65 | bool _ParseAttributes(LPTSTR& pstrText);
66 | bool _Failed(LPCTSTR pstrError, LPCTSTR pstrLocation = NULL);
67 | };
68 |
69 |
70 | class UILIB_API CMarkupNode
71 | {
72 | friend class CMarkup;
73 | private:
74 | CMarkupNode();
75 | CMarkupNode(CMarkup* pOwner, int iPos);
76 |
77 | public:
78 | bool IsValid() const;
79 |
80 | CMarkupNode GetParent();
81 | CMarkupNode GetSibling();
82 | CMarkupNode GetChild();
83 | CMarkupNode GetChild(LPCTSTR pstrName);
84 |
85 | bool HasSiblings() const;
86 | bool HasChildren() const;
87 | LPCTSTR GetName() const;
88 | LPCTSTR GetValue() const;
89 |
90 | bool HasAttributes();
91 | bool HasAttribute(LPCTSTR pstrName);
92 | int GetAttributeCount();
93 | LPCTSTR GetAttributeName(int iIndex);
94 | LPCTSTR GetAttributeValue(int iIndex);
95 | LPCTSTR GetAttributeValue(LPCTSTR pstrName);
96 | bool GetAttributeValue(int iIndex, LPTSTR pstrValue, SIZE_T cchMax);
97 | bool GetAttributeValue(LPCTSTR pstrName, LPTSTR pstrValue, SIZE_T cchMax);
98 |
99 | private:
100 | void _MapAttributes();
101 |
102 | enum { MAX_XML_ATTRIBUTES = 64 };
103 |
104 | typedef struct
105 | {
106 | ULONG iName;
107 | ULONG iValue;
108 | } XMLATTRIBUTE;
109 |
110 | int m_iPos;
111 | int m_nAttributes;
112 | XMLATTRIBUTE m_aAttributes[MAX_XML_ATTRIBUTES];
113 | CMarkup* m_pOwner;
114 | };
115 |
116 | } // namespace DuiLib
117 |
118 | #endif // __UIMARKUP_H__
119 |
--------------------------------------------------------------------------------
/DuiLib/Core/UIRender.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/DuiLib/Core/UIRender.cpp
--------------------------------------------------------------------------------
/DuiLib/Core/UIRender.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/DuiLib/Core/UIRender.h
--------------------------------------------------------------------------------
/DuiLib/Debug/DuiLib.log:
--------------------------------------------------------------------------------
1 | 生成启动时间为 2018/6/21 18:37:06。
2 | 1>项目“D:\Code\TIM\DuiLib\DuiLib.vcxproj”在节点 3 上(Build 个目标)。
3 | 1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppBuild.targets(357,5): warning MSB8004: Output Directory does not end with a trailing slash. This build instance will add the slash as it is required to allow proper evaluation of the Output Directory.
4 | 1>Link:
5 | DuiLib.vcxproj -> D:\Code\TIM\DuiLib\..\Bin\DuiLib_d.dll
6 | 1>已完成生成项目“D:\Code\TIM\DuiLib\DuiLib.vcxproj”(Build 个目标)的操作。
7 |
8 | 生成成功。
9 |
10 | 已用时间 00:00:00.27
11 |
--------------------------------------------------------------------------------
/DuiLib/Debug/DuiLib.tlog/CL.read.1.tlog:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/DuiLib/Debug/DuiLib.tlog/CL.read.1.tlog
--------------------------------------------------------------------------------
/DuiLib/Debug/DuiLib.tlog/CL.write.1.tlog:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/DuiLib/Debug/DuiLib.tlog/CL.write.1.tlog
--------------------------------------------------------------------------------
/DuiLib/Debug/DuiLib.tlog/DuiLib.lastbuildstate:
--------------------------------------------------------------------------------
1 | #TargetFrameworkVersion=v4.0:PlatformToolSet=v120:EnableManagedIncrementalBuild=false:VCToolArchitecture=Native32Bit
2 | Debug|Win32|D:\Code\TIM\|
3 |
--------------------------------------------------------------------------------
/DuiLib/Debug/DuiLib.tlog/DuiLib.write.1u.tlog:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/DuiLib/Debug/DuiLib.tlog/DuiLib.write.1u.tlog
--------------------------------------------------------------------------------
/DuiLib/Debug/DuiLib.tlog/cl.command.1.tlog:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/DuiLib/Debug/DuiLib.tlog/cl.command.1.tlog
--------------------------------------------------------------------------------
/DuiLib/Debug/DuiLib.tlog/link.command.1.tlog:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/DuiLib/Debug/DuiLib.tlog/link.command.1.tlog
--------------------------------------------------------------------------------
/DuiLib/Debug/DuiLib.tlog/link.read.1.tlog:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/DuiLib/Debug/DuiLib.tlog/link.read.1.tlog
--------------------------------------------------------------------------------
/DuiLib/Debug/DuiLib.tlog/link.write.1.tlog:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/DuiLib/Debug/DuiLib.tlog/link.write.1.tlog
--------------------------------------------------------------------------------
/DuiLib/Debug/DuiLib_d.Build.CppClean.log:
--------------------------------------------------------------------------------
1 | d:\code\tim\duilib\debug\duilib_d.pch
2 | d:\code\tim\duilib\debug\vc120.pdb
3 | d:\code\tim\duilib\debug\vc120.idb
4 | d:\code\tim\duilib\debug\stdafx.obj
5 | d:\code\tim\duilib\debug\uiverticallayout.obj
6 | d:\code\tim\duilib\debug\uiactivex.obj
7 | d:\code\tim\duilib\debug\uibutton.obj
8 | d:\code\tim\duilib\debug\uicheckbox.obj
9 | d:\code\tim\duilib\debug\uicombo.obj
10 | d:\code\tim\duilib\debug\uidatetime.obj
11 | d:\code\tim\duilib\debug\uiedit.obj
12 | d:\code\tim\duilib\debug\uiflash.obj
13 | d:\code\tim\duilib\debug\uigifanim.obj
14 | d:\code\tim\duilib\debug\uilabel.obj
15 | d:\code\tim\duilib\debug\uilist.obj
16 | d:\code\tim\duilib\debug\uimenu.obj
17 | d:\code\tim\duilib\debug\uioption.obj
18 | d:\code\tim\duilib\debug\uiprogress.obj
19 | d:\code\tim\duilib\debug\uirichedit.obj
20 | d:\code\tim\duilib\debug\uiscrollbar.obj
21 | d:\code\tim\duilib\debug\uislider.obj
22 | d:\code\tim\duilib\debug\uitext.obj
23 | d:\code\tim\duilib\debug\uitreeview.obj
24 | d:\code\tim\duilib\debug\uiwebbrowser.obj
25 | d:\code\tim\duilib\debug\uilistex.obj
26 | d:\code\tim\duilib\debug\uilistexnode.obj
27 | d:\code\tim\duilib\debug\uilib.obj
28 | d:\code\tim\duilib\debug\thirdparty.obj
29 | d:\code\tim\duilib\debug\uidelegate.obj
30 | d:\code\tim\duilib\debug\uishadow.obj
31 | d:\code\tim\duilib\debug\utils.obj
32 | d:\code\tim\duilib\debug\winimplbase.obj
33 | d:\code\tim\duilib\debug\uibase.obj
34 | d:\code\tim\duilib\debug\uicontainer.obj
35 | d:\code\tim\duilib\debug\uicontrol.obj
36 | d:\code\tim\duilib\debug\uidlgbuilder.obj
37 | d:\code\tim\duilib\debug\uiimageattribute.obj
38 | d:\code\tim\duilib\debug\uimanager.obj
39 | d:\code\tim\duilib\debug\uimarkup.obj
40 | d:\code\tim\duilib\debug\uirender.obj
41 | d:\code\tim\duilib\debug\uichildlayout.obj
42 | d:\code\tim\duilib\debug\uihorizontallayout.obj
43 | d:\code\tim\duilib\debug\uitablayout.obj
44 | d:\code\tim\duilib\debug\uitilelayout.obj
45 | d:\code\tim\duilib\debug\uihead.obj
46 | d:\code\tim\duilib\debug\stb_image.obj
47 | d:\code\tim\duilib\debug\xunzip.obj
48 | d:\code\tim\tim\duilib_d.lib
49 | d:\code\tim\tim\duilib_d.exp
50 | d:\code\tim\bin\duilib_d.dll
51 | d:\code\tim\bin\duilib_d.pdb
52 | d:\code\tim\duilib\..\bin\duilib_d.dll
53 | d:\code\tim\duilib\debug\duilib.tlog\cl.command.1.tlog
54 | d:\code\tim\duilib\debug\duilib.tlog\cl.read.1.tlog
55 | d:\code\tim\duilib\debug\duilib.tlog\cl.write.1.tlog
56 | d:\code\tim\duilib\debug\duilib.tlog\duilib.write.1u.tlog
57 | d:\code\tim\duilib\debug\duilib.tlog\link.command.1.tlog
58 | d:\code\tim\duilib\debug\duilib.tlog\link.read.1.tlog
59 | d:\code\tim\duilib\debug\duilib.tlog\link.write.1.tlog
60 |
--------------------------------------------------------------------------------
/DuiLib/Debug/DuiLib_d.pch:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/DuiLib/Debug/DuiLib_d.pch
--------------------------------------------------------------------------------
/DuiLib/Debug/StdAfx.obj:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/DuiLib/Debug/StdAfx.obj
--------------------------------------------------------------------------------
/DuiLib/Debug/ThirdParty.obj:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/DuiLib/Debug/ThirdParty.obj
--------------------------------------------------------------------------------
/DuiLib/Debug/UIActiveX.obj:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/DuiLib/Debug/UIActiveX.obj
--------------------------------------------------------------------------------
/DuiLib/Debug/UIBase.obj:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/DuiLib/Debug/UIBase.obj
--------------------------------------------------------------------------------
/DuiLib/Debug/UIButton.obj:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/DuiLib/Debug/UIButton.obj
--------------------------------------------------------------------------------
/DuiLib/Debug/UICheckBox.obj:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/DuiLib/Debug/UICheckBox.obj
--------------------------------------------------------------------------------
/DuiLib/Debug/UIChildLayout.obj:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/DuiLib/Debug/UIChildLayout.obj
--------------------------------------------------------------------------------
/DuiLib/Debug/UICombo.obj:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/DuiLib/Debug/UICombo.obj
--------------------------------------------------------------------------------
/DuiLib/Debug/UIContainer.obj:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/DuiLib/Debug/UIContainer.obj
--------------------------------------------------------------------------------
/DuiLib/Debug/UIControl.obj:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/DuiLib/Debug/UIControl.obj
--------------------------------------------------------------------------------
/DuiLib/Debug/UIDateTime.obj:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/DuiLib/Debug/UIDateTime.obj
--------------------------------------------------------------------------------
/DuiLib/Debug/UIDelegate.obj:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/DuiLib/Debug/UIDelegate.obj
--------------------------------------------------------------------------------
/DuiLib/Debug/UIDlgBuilder.obj:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/DuiLib/Debug/UIDlgBuilder.obj
--------------------------------------------------------------------------------
/DuiLib/Debug/UIEdit.obj:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/DuiLib/Debug/UIEdit.obj
--------------------------------------------------------------------------------
/DuiLib/Debug/UIFlash.obj:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/DuiLib/Debug/UIFlash.obj
--------------------------------------------------------------------------------
/DuiLib/Debug/UIGifAnim.obj:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/DuiLib/Debug/UIGifAnim.obj
--------------------------------------------------------------------------------
/DuiLib/Debug/UIHead.obj:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/DuiLib/Debug/UIHead.obj
--------------------------------------------------------------------------------
/DuiLib/Debug/UIHorizontalLayout.obj:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/DuiLib/Debug/UIHorizontalLayout.obj
--------------------------------------------------------------------------------
/DuiLib/Debug/UIImageAttribute.obj:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/DuiLib/Debug/UIImageAttribute.obj
--------------------------------------------------------------------------------
/DuiLib/Debug/UILabel.obj:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/DuiLib/Debug/UILabel.obj
--------------------------------------------------------------------------------
/DuiLib/Debug/UIList.obj:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/DuiLib/Debug/UIList.obj
--------------------------------------------------------------------------------
/DuiLib/Debug/UIListEx.obj:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/DuiLib/Debug/UIListEx.obj
--------------------------------------------------------------------------------
/DuiLib/Debug/UIListExNode.obj:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/DuiLib/Debug/UIListExNode.obj
--------------------------------------------------------------------------------
/DuiLib/Debug/UIManager.obj:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/DuiLib/Debug/UIManager.obj
--------------------------------------------------------------------------------
/DuiLib/Debug/UIMarkup.obj:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/DuiLib/Debug/UIMarkup.obj
--------------------------------------------------------------------------------
/DuiLib/Debug/UIMenu.obj:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/DuiLib/Debug/UIMenu.obj
--------------------------------------------------------------------------------
/DuiLib/Debug/UIOption.obj:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/DuiLib/Debug/UIOption.obj
--------------------------------------------------------------------------------
/DuiLib/Debug/UIProgress.obj:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/DuiLib/Debug/UIProgress.obj
--------------------------------------------------------------------------------
/DuiLib/Debug/UIRender.obj:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/DuiLib/Debug/UIRender.obj
--------------------------------------------------------------------------------
/DuiLib/Debug/UIRichEdit.obj:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/DuiLib/Debug/UIRichEdit.obj
--------------------------------------------------------------------------------
/DuiLib/Debug/UIScrollBar.obj:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/DuiLib/Debug/UIScrollBar.obj
--------------------------------------------------------------------------------
/DuiLib/Debug/UIShadow.obj:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/DuiLib/Debug/UIShadow.obj
--------------------------------------------------------------------------------
/DuiLib/Debug/UISlider.obj:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/DuiLib/Debug/UISlider.obj
--------------------------------------------------------------------------------
/DuiLib/Debug/UITabLayout.obj:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/DuiLib/Debug/UITabLayout.obj
--------------------------------------------------------------------------------
/DuiLib/Debug/UIText.obj:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/DuiLib/Debug/UIText.obj
--------------------------------------------------------------------------------
/DuiLib/Debug/UITileLayout.obj:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/DuiLib/Debug/UITileLayout.obj
--------------------------------------------------------------------------------
/DuiLib/Debug/UITreeView.obj:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/DuiLib/Debug/UITreeView.obj
--------------------------------------------------------------------------------
/DuiLib/Debug/UIVerticalLayout.obj:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/DuiLib/Debug/UIVerticalLayout.obj
--------------------------------------------------------------------------------
/DuiLib/Debug/UIWebBrowser.obj:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/DuiLib/Debug/UIWebBrowser.obj
--------------------------------------------------------------------------------
/DuiLib/Debug/UIlib.obj:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/DuiLib/Debug/UIlib.obj
--------------------------------------------------------------------------------
/DuiLib/Debug/Utils.obj:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/DuiLib/Debug/Utils.obj
--------------------------------------------------------------------------------
/DuiLib/Debug/WinImplBase.obj:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/DuiLib/Debug/WinImplBase.obj
--------------------------------------------------------------------------------
/DuiLib/Debug/XUnzip.obj:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/DuiLib/Debug/XUnzip.obj
--------------------------------------------------------------------------------
/DuiLib/Debug/stb_image.obj:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/DuiLib/Debug/stb_image.obj
--------------------------------------------------------------------------------
/DuiLib/Debug/vc120.idb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/DuiLib/Debug/vc120.idb
--------------------------------------------------------------------------------
/DuiLib/Debug/vc120.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/DuiLib/Debug/vc120.pdb
--------------------------------------------------------------------------------
/DuiLib/DuiLib.vcxproj.user:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/DuiLib/Layout/UIChildLayout.cpp:
--------------------------------------------------------------------------------
1 | #include "stdafx.h"
2 | #include "UIChildLayout.h"
3 |
4 | namespace DuiLib
5 | {
6 | CChildLayoutUI::CChildLayoutUI()
7 | {
8 |
9 | }
10 |
11 | void CChildLayoutUI::Init()
12 | {
13 | if (!m_pstrXMLFile.IsEmpty())
14 | {
15 | CDialogBuilder builder;
16 | CContainerUI* pChildWindow = static_cast(builder.Create(m_pstrXMLFile.GetData(), (UINT)0, NULL, m_pManager));
17 | if (pChildWindow)
18 | {
19 | this->Add(pChildWindow);
20 | }
21 | else
22 | {
23 | this->RemoveAll();
24 | }
25 | }
26 | }
27 |
28 | void CChildLayoutUI::SetAttribute( LPCTSTR pstrName, LPCTSTR pstrValue )
29 | {
30 | if( _tcscmp(pstrName, _T("xmlfile")) == 0 )
31 | SetChildLayoutXML(pstrValue);
32 | else
33 | CContainerUI::SetAttribute(pstrName,pstrValue);
34 | }
35 |
36 | void CChildLayoutUI::SetChildLayoutXML( DuiLib::CDuiString pXML )
37 | {
38 | m_pstrXMLFile=pXML;
39 | }
40 |
41 | DuiLib::CDuiString CChildLayoutUI::GetChildLayoutXML()
42 | {
43 | return m_pstrXMLFile;
44 | }
45 |
46 | LPVOID CChildLayoutUI::GetInterface( LPCTSTR pstrName )
47 | {
48 | if( _tcscmp(pstrName, DUI_CTR_CHILDLAYOUT) == 0 ) return static_cast(this);
49 | return CControlUI::GetInterface(pstrName);
50 | }
51 |
52 | LPCTSTR CChildLayoutUI::GetClass() const
53 | {
54 | return _T("ChildLayoutUI");
55 | }
56 | } // namespace DuiLib
57 |
--------------------------------------------------------------------------------
/DuiLib/Layout/UIChildLayout.h:
--------------------------------------------------------------------------------
1 | #ifndef __UICHILDLAYOUT_H__
2 | #define __UICHILDLAYOUT_H__
3 |
4 | #pragma once
5 |
6 | namespace DuiLib
7 | {
8 | class UILIB_API CChildLayoutUI : public CContainerUI
9 | {
10 | public:
11 | CChildLayoutUI();
12 |
13 | void Init();
14 | void SetAttribute(LPCTSTR pstrName, LPCTSTR pstrValue);
15 | void SetChildLayoutXML(CDuiString pXML);
16 | DuiLib::CDuiString GetChildLayoutXML();
17 | virtual LPVOID GetInterface(LPCTSTR pstrName);
18 | virtual LPCTSTR GetClass() const;
19 |
20 | private:
21 | DuiLib::CDuiString m_pstrXMLFile;
22 | };
23 | } // namespace DuiLib
24 | #endif // __UICHILDLAYOUT_H__
25 |
--------------------------------------------------------------------------------
/DuiLib/Layout/UIHorizontalLayout.cpp:
--------------------------------------------------------------------------------
1 | #include "stdafx.h"
2 | #include "UIHorizontalLayout.h"
3 |
4 | namespace DuiLib
5 | {
6 | CHorizontalLayoutUI::CHorizontalLayoutUI() : m_iSepWidth(0), m_uButtonState(0), m_bImmMode(false)
7 | {
8 | ptLastMouse.x = ptLastMouse.y = 0;
9 | ::ZeroMemory(&m_rcNewPos, sizeof(m_rcNewPos));
10 | }
11 |
12 | LPCTSTR CHorizontalLayoutUI::GetClass() const
13 | {
14 | return _T("HorizontalLayoutUI");
15 | }
16 |
17 | LPVOID CHorizontalLayoutUI::GetInterface(LPCTSTR pstrName)
18 | {
19 | if( _tcscmp(pstrName, DUI_CTR_HORIZONTALLAYOUT) == 0 ) return static_cast(this);
20 | return CContainerUI::GetInterface(pstrName);
21 | }
22 |
23 | UINT CHorizontalLayoutUI::GetControlFlags() const
24 | {
25 | if( IsEnabled() && m_iSepWidth != 0 ) return UIFLAG_SETCURSOR;
26 | else return 0;
27 | }
28 |
29 | void CHorizontalLayoutUI::SetPos(RECT rc)
30 | {
31 | CControlUI::SetPos(rc);
32 | rc = m_rcItem;
33 |
34 | // Adjust for inset
35 | rc.left += m_rcInset.left;
36 | rc.top += m_rcInset.top;
37 | rc.right -= m_rcInset.right;
38 | rc.bottom -= m_rcInset.bottom;
39 |
40 | if( m_items.GetSize() == 0) {
41 | ProcessScrollBar(rc, 0, 0);
42 | return;
43 | }
44 |
45 | if( m_pVerticalScrollBar && m_pVerticalScrollBar->IsVisible() ) rc.right -= m_pVerticalScrollBar->GetFixedWidth();
46 | if( m_pHorizontalScrollBar && m_pHorizontalScrollBar->IsVisible() ) rc.bottom -= m_pHorizontalScrollBar->GetFixedHeight();
47 |
48 | // Determine the width of elements that are sizeable
49 | SIZE szAvailable = { rc.right - rc.left, rc.bottom - rc.top };
50 | if( m_pHorizontalScrollBar && m_pHorizontalScrollBar->IsVisible() )
51 | szAvailable.cx += m_pHorizontalScrollBar->GetScrollRange();
52 |
53 | int nAdjustables = 0;
54 | int cxFixed = 0;
55 | int nEstimateNum = 0;
56 | for( int it1 = 0; it1 < m_items.GetSize(); it1++ ) {
57 | CControlUI* pControl = static_cast(m_items[it1]);
58 | if( !pControl->IsVisible() ) continue;
59 | if( pControl->IsFloat() ) continue;
60 | SIZE sz = pControl->EstimateSize(szAvailable);
61 | if( sz.cx == 0 ) {
62 | nAdjustables++;
63 | }
64 | else {
65 | if( sz.cx < pControl->GetMinWidth() ) sz.cx = pControl->GetMinWidth();
66 | if( sz.cx > pControl->GetMaxWidth() ) sz.cx = pControl->GetMaxWidth();
67 | }
68 | cxFixed += sz.cx + pControl->GetPadding().left + pControl->GetPadding().right;
69 | nEstimateNum++;
70 | }
71 | cxFixed += (nEstimateNum - 1) * m_iChildPadding;
72 |
73 | int cxExpand = 0;
74 | int cxNeeded = 0;
75 | if( nAdjustables > 0 ) cxExpand = MAX(0, (szAvailable.cx - cxFixed) / nAdjustables);
76 | // Position the elements
77 | SIZE szRemaining = szAvailable;
78 | int iPosX = rc.left;
79 | if( m_pHorizontalScrollBar && m_pHorizontalScrollBar->IsVisible() ) {
80 | iPosX -= m_pHorizontalScrollBar->GetScrollPos();
81 | }
82 | int iAdjustable = 0;
83 | int cxFixedRemaining = cxFixed;
84 | for( int it2 = 0; it2 < m_items.GetSize(); it2++ ) {
85 | CControlUI* pControl = static_cast(m_items[it2]);
86 | if( !pControl->IsVisible() ) continue;
87 | if( pControl->IsFloat() ) {
88 | SetFloatPos(it2);
89 | continue;
90 | }
91 | RECT rcPadding = pControl->GetPadding();
92 | szRemaining.cx -= rcPadding.left;
93 | SIZE sz = pControl->EstimateSize(szRemaining);
94 | if( sz.cx == 0 ) {
95 | iAdjustable++;
96 | sz.cx = cxExpand;
97 | // Distribute remaining to last element (usually round-off left-overs)
98 | // if( iAdjustable == nAdjustables ) {
99 | // sz.cx = MAX(0, szRemaining.cx - rcPadding.right - cxFixedRemaining);
100 | // }
101 | if( sz.cx < pControl->GetMinWidth() ) sz.cx = pControl->GetMinWidth();
102 | if( sz.cx > pControl->GetMaxWidth() ) sz.cx = pControl->GetMaxWidth();
103 | }
104 | else {
105 | if( sz.cx < pControl->GetMinWidth() ) sz.cx = pControl->GetMinWidth();
106 | if( sz.cx > pControl->GetMaxWidth() ) sz.cx = pControl->GetMaxWidth();
107 |
108 | // cxFixedRemaining -= sz.cx + rcPadding.left + rcPadding.right ;
109 | }
110 |
111 | // cxFixedRemaining -= m_iChildPadding;
112 |
113 | sz.cy = pControl->GetFixedHeight();
114 | if( sz.cy == 0 ) sz.cy = rc.bottom - rc.top - rcPadding.top - rcPadding.bottom;
115 | if( sz.cy < 0 ) sz.cy = 0;
116 | if( sz.cy < pControl->GetMinHeight() ) sz.cy = pControl->GetMinHeight();
117 | if( sz.cy > pControl->GetMaxHeight() ) sz.cy = pControl->GetMaxHeight();
118 |
119 | RECT rcCtrl = { iPosX + rcPadding.left, rc.top + rcPadding.top, iPosX + sz.cx + rcPadding.left , rc.top + rcPadding.top + sz.cy};
120 | pControl->SetPos(rcCtrl);
121 | iPosX += sz.cx + m_iChildPadding + rcPadding.left + rcPadding.right;
122 | cxNeeded += sz.cx + rcPadding.left + rcPadding.right;
123 | szRemaining.cx -= sz.cx + m_iChildPadding + rcPadding.right;
124 | }
125 | cxNeeded += (nEstimateNum - 1) * m_iChildPadding;
126 | //reddrain
127 | if( m_pHorizontalScrollBar != NULL ) {
128 | if( cxNeeded > rc.right - rc.left ) {
129 | if( m_pHorizontalScrollBar->IsVisible() ) {
130 | m_pHorizontalScrollBar->SetScrollRange(cxNeeded - (rc.right - rc.left));
131 | }
132 | else {
133 | m_pHorizontalScrollBar->SetVisible(true);
134 | m_pHorizontalScrollBar->SetScrollRange(cxNeeded - (rc.right - rc.left));
135 | m_pHorizontalScrollBar->SetScrollPos(0);
136 | rc.bottom -= m_pHorizontalScrollBar->GetFixedHeight();
137 | }
138 | }
139 | else {
140 | if( m_pHorizontalScrollBar->IsVisible() ) {
141 | m_pHorizontalScrollBar->SetVisible(false);
142 | m_pHorizontalScrollBar->SetScrollRange(0);
143 | m_pHorizontalScrollBar->SetScrollPos(0);
144 | rc.bottom += m_pHorizontalScrollBar->GetFixedHeight();
145 | }
146 | }
147 | }
148 | //redrain
149 | // Process the scrollbar
150 | ProcessScrollBar(rc, cxNeeded, 0);
151 | }
152 |
153 | void CHorizontalLayoutUI::DoPostPaint(HDC hDC, const RECT& rcPaint)
154 | {
155 | if( (m_uButtonState & UISTATE_CAPTURED) != 0 && !m_bImmMode ) {
156 | RECT rcSeparator = GetThumbRect(true);
157 | CRenderEngine::DrawColor(hDC, rcSeparator, 0xAA000000);
158 | }
159 | }
160 |
161 | void CHorizontalLayoutUI::SetSepWidth(int iWidth)
162 | {
163 | m_iSepWidth = iWidth;
164 | }
165 |
166 | int CHorizontalLayoutUI::GetSepWidth() const
167 | {
168 | return m_iSepWidth;
169 | }
170 |
171 | void CHorizontalLayoutUI::SetSepImmMode(bool bImmediately)
172 | {
173 | if( m_bImmMode == bImmediately ) return;
174 | if( (m_uButtonState & UISTATE_CAPTURED) != 0 && !m_bImmMode && m_pManager != NULL ) {
175 | m_pManager->RemovePostPaint(this);
176 | }
177 |
178 | m_bImmMode = bImmediately;
179 | }
180 |
181 | bool CHorizontalLayoutUI::IsSepImmMode() const
182 | {
183 | return m_bImmMode;
184 | }
185 |
186 | void CHorizontalLayoutUI::SetAttribute(LPCTSTR pstrName, LPCTSTR pstrValue)
187 | {
188 | if( _tcscmp(pstrName, _T("sepwidth")) == 0 ) SetSepWidth(_ttoi(pstrValue));
189 | else if( _tcscmp(pstrName, _T("sepimm")) == 0 ) SetSepImmMode(_tcscmp(pstrValue, _T("true")) == 0);
190 | else CContainerUI::SetAttribute(pstrName, pstrValue);
191 | }
192 |
193 | void CHorizontalLayoutUI::DoEvent(TEventUI& event)
194 | {
195 | if( m_iSepWidth != 0 ) {
196 | if( event.Type == UIEVENT_BUTTONDOWN && IsEnabled() )
197 | {
198 | RECT rcSeparator = GetThumbRect(false);
199 | if( ::PtInRect(&rcSeparator, event.ptMouse) ) {
200 | m_uButtonState |= UISTATE_CAPTURED;
201 | ptLastMouse = event.ptMouse;
202 | m_rcNewPos = m_rcItem;
203 | if( !m_bImmMode && m_pManager ) m_pManager->AddPostPaint(this);
204 | return;
205 | }
206 | }
207 | if( event.Type == UIEVENT_BUTTONUP )
208 | {
209 | if( (m_uButtonState & UISTATE_CAPTURED) != 0 ) {
210 | m_uButtonState &= ~UISTATE_CAPTURED;
211 | m_rcItem = m_rcNewPos;
212 | if( !m_bImmMode && m_pManager ) m_pManager->RemovePostPaint(this);
213 | NeedParentUpdate();
214 | return;
215 | }
216 | }
217 | if( event.Type == UIEVENT_MOUSEMOVE )
218 | {
219 | if( (m_uButtonState & UISTATE_CAPTURED) != 0 ) {
220 | LONG cx = event.ptMouse.x - ptLastMouse.x;
221 | ptLastMouse = event.ptMouse;
222 | RECT rc = m_rcNewPos;
223 | if( m_iSepWidth >= 0 ) {
224 | if( cx > 0 && event.ptMouse.x < m_rcNewPos.right - m_iSepWidth ) return;
225 | if( cx < 0 && event.ptMouse.x > m_rcNewPos.right ) return;
226 | rc.right += cx;
227 | if( rc.right - rc.left <= GetMinWidth() ) {
228 | if( m_rcNewPos.right - m_rcNewPos.left <= GetMinWidth() ) return;
229 | rc.right = rc.left + GetMinWidth();
230 | }
231 | if( rc.right - rc.left >= GetMaxWidth() ) {
232 | if( m_rcNewPos.right - m_rcNewPos.left >= GetMaxWidth() ) return;
233 | rc.right = rc.left + GetMaxWidth();
234 | }
235 | }
236 | else {
237 | if( cx > 0 && event.ptMouse.x < m_rcNewPos.left ) return;
238 | if( cx < 0 && event.ptMouse.x > m_rcNewPos.left - m_iSepWidth ) return;
239 | rc.left += cx;
240 | if( rc.right - rc.left <= GetMinWidth() ) {
241 | if( m_rcNewPos.right - m_rcNewPos.left <= GetMinWidth() ) return;
242 | rc.left = rc.right - GetMinWidth();
243 | }
244 | if( rc.right - rc.left >= GetMaxWidth() ) {
245 | if( m_rcNewPos.right - m_rcNewPos.left >= GetMaxWidth() ) return;
246 | rc.left = rc.right - GetMaxWidth();
247 | }
248 | }
249 |
250 | CDuiRect rcInvalidate = GetThumbRect(true);
251 | m_rcNewPos = rc;
252 | m_cxyFixed.cx = m_rcNewPos.right - m_rcNewPos.left;
253 |
254 | if( m_bImmMode ) {
255 | m_rcItem = m_rcNewPos;
256 | NeedParentUpdate();
257 | }
258 | else {
259 | rcInvalidate.Join(GetThumbRect(true));
260 | rcInvalidate.Join(GetThumbRect(false));
261 | if( m_pManager ) m_pManager->Invalidate(rcInvalidate);
262 | }
263 | return;
264 | }
265 | }
266 | if( event.Type == UIEVENT_SETCURSOR )
267 | {
268 | RECT rcSeparator = GetThumbRect(false);
269 | if( IsEnabled() && ::PtInRect(&rcSeparator, event.ptMouse) ) {
270 | ::SetCursor(::LoadCursor(NULL, MAKEINTRESOURCE(IDC_SIZEWE)));
271 | return;
272 | }
273 | }
274 | }
275 | CContainerUI::DoEvent(event);
276 | }
277 |
278 | RECT CHorizontalLayoutUI::GetThumbRect(bool bUseNew) const
279 | {
280 | if( (m_uButtonState & UISTATE_CAPTURED) != 0 && bUseNew) {
281 | if( m_iSepWidth >= 0 ) return CDuiRect(m_rcNewPos.right - m_iSepWidth, m_rcNewPos.top, m_rcNewPos.right, m_rcNewPos.bottom);
282 | else return CDuiRect(m_rcNewPos.left, m_rcNewPos.top, m_rcNewPos.left - m_iSepWidth, m_rcNewPos.bottom);
283 | }
284 | else {
285 | if( m_iSepWidth >= 0 ) return CDuiRect(m_rcItem.right - m_iSepWidth, m_rcItem.top, m_rcItem.right, m_rcItem.bottom);
286 | else return CDuiRect(m_rcItem.left, m_rcItem.top, m_rcItem.left - m_iSepWidth, m_rcItem.bottom);
287 | }
288 | }
289 | }
290 |
--------------------------------------------------------------------------------
/DuiLib/Layout/UIHorizontalLayout.h:
--------------------------------------------------------------------------------
1 | #ifndef __UIHORIZONTALLAYOUT_H__
2 | #define __UIHORIZONTALLAYOUT_H__
3 |
4 | #pragma once
5 |
6 | namespace DuiLib
7 | {
8 | class UILIB_API CHorizontalLayoutUI : public CContainerUI
9 | {
10 | public:
11 | CHorizontalLayoutUI();
12 |
13 | LPCTSTR GetClass() const;
14 | LPVOID GetInterface(LPCTSTR pstrName);
15 | UINT GetControlFlags() const;
16 |
17 | void SetSepWidth(int iWidth);
18 | int GetSepWidth() const;
19 | void SetSepImmMode(bool bImmediately);
20 | bool IsSepImmMode() const;
21 | void SetAttribute(LPCTSTR pstrName, LPCTSTR pstrValue);
22 | void DoEvent(TEventUI& event);
23 |
24 | void SetPos(RECT rc);
25 | void DoPostPaint(HDC hDC, const RECT& rcPaint);
26 |
27 | RECT GetThumbRect(bool bUseNew = false) const;
28 |
29 | protected:
30 | int m_iSepWidth;
31 | UINT m_uButtonState;
32 | POINT ptLastMouse;
33 | RECT m_rcNewPos;
34 | bool m_bImmMode;
35 | };
36 | }
37 | #endif // __UIHORIZONTALLAYOUT_H__
38 |
--------------------------------------------------------------------------------
/DuiLib/Layout/UITabLayout.cpp:
--------------------------------------------------------------------------------
1 | #include "stdafx.h"
2 | #include "UITabLayout.h"
3 |
4 | namespace DuiLib
5 | {
6 | CTabLayoutUI::CTabLayoutUI() : m_iCurSel(-1)
7 | {
8 | }
9 |
10 | LPCTSTR CTabLayoutUI::GetClass() const
11 | {
12 | return _T("TabLayoutUI");
13 | }
14 |
15 | LPVOID CTabLayoutUI::GetInterface(LPCTSTR pstrName)
16 | {
17 | if( _tcscmp(pstrName, DUI_CTR_TABLAYOUT) == 0 ) return static_cast(this);
18 | return CContainerUI::GetInterface(pstrName);
19 | }
20 |
21 | bool CTabLayoutUI::Add(CControlUI* pControl)
22 | {
23 | bool ret = CContainerUI::Add(pControl);
24 | if( !ret ) return ret;
25 |
26 | if(m_iCurSel == -1 && pControl->IsVisible())
27 | {
28 | m_iCurSel = GetItemIndex(pControl);
29 | }
30 | else
31 | {
32 | pControl->SetVisible(false);
33 | }
34 |
35 | return ret;
36 | }
37 |
38 | bool CTabLayoutUI::AddAt(CControlUI* pControl, int iIndex)
39 | {
40 | bool ret = CContainerUI::AddAt(pControl, iIndex);
41 | if( !ret ) return ret;
42 |
43 | if(m_iCurSel == -1 && pControl->IsVisible())
44 | {
45 | m_iCurSel = GetItemIndex(pControl);
46 | }
47 | else if( m_iCurSel != -1 && iIndex <= m_iCurSel )
48 | {
49 | m_iCurSel += 1;
50 | }
51 | else
52 | {
53 | pControl->SetVisible(false);
54 | }
55 |
56 | return ret;
57 | }
58 |
59 | bool CTabLayoutUI::Remove(CControlUI* pControl)
60 | {
61 | if( pControl == NULL) return false;
62 |
63 | int index = GetItemIndex(pControl);
64 | bool ret = CContainerUI::Remove(pControl);
65 | if( !ret ) return false;
66 |
67 | if( m_iCurSel == index)
68 | {
69 | if( GetCount() > 0 )
70 | {
71 | m_iCurSel=0;
72 | GetItemAt(m_iCurSel)->SetVisible(true);
73 | }
74 | else
75 | m_iCurSel=-1;
76 | NeedParentUpdate();
77 | }
78 | else if( m_iCurSel > index )
79 | {
80 | m_iCurSel -= 1;
81 | }
82 |
83 | return ret;
84 | }
85 |
86 | void CTabLayoutUI::RemoveAll()
87 | {
88 | m_iCurSel = -1;
89 | CContainerUI::RemoveAll();
90 | NeedParentUpdate();
91 | }
92 |
93 | int CTabLayoutUI::GetCurSel() const
94 | {
95 | return m_iCurSel;
96 | }
97 |
98 | bool CTabLayoutUI::SelectItem(int iIndex)
99 | {
100 | if( iIndex < 0 || iIndex >= m_items.GetSize() ) return false;
101 | if( iIndex == m_iCurSel ) return true;
102 |
103 | int iOldSel = m_iCurSel;
104 | m_iCurSel = iIndex;
105 | for( int it = 0; it < m_items.GetSize(); it++ )
106 | {
107 | if( it == iIndex ) {
108 | GetItemAt(it)->SetVisible(true);
109 | GetItemAt(it)->SetFocus();
110 | SetPos(m_rcItem);
111 | }
112 | else GetItemAt(it)->SetVisible(false);
113 | }
114 | NeedParentUpdate();
115 |
116 | if( m_pManager != NULL ) {
117 | m_pManager->SetNextTabControl();
118 | m_pManager->SendNotify(this, DUI_MSGTYPE_TABSELECT, m_iCurSel, iOldSel);
119 | }
120 | return true;
121 | }
122 |
123 | bool CTabLayoutUI::SelectItem( CControlUI* pControl )
124 | {
125 | int iIndex=GetItemIndex(pControl);
126 | if (iIndex==-1)
127 | return false;
128 | else
129 | return SelectItem(iIndex);
130 | }
131 |
132 | void CTabLayoutUI::SetAttribute(LPCTSTR pstrName, LPCTSTR pstrValue)
133 | {
134 | if( _tcscmp(pstrName, _T("selectedid")) == 0 ) SelectItem(_ttoi(pstrValue));
135 | return CContainerUI::SetAttribute(pstrName, pstrValue);
136 | }
137 |
138 | void CTabLayoutUI::SetPos(RECT rc)
139 | {
140 | CControlUI::SetPos(rc);
141 | rc = m_rcItem;
142 |
143 | // Adjust for inset
144 | rc.left += m_rcInset.left;
145 | rc.top += m_rcInset.top;
146 | rc.right -= m_rcInset.right;
147 | rc.bottom -= m_rcInset.bottom;
148 |
149 | for( int it = 0; it < m_items.GetSize(); it++ ) {
150 | CControlUI* pControl = static_cast(m_items[it]);
151 | if( !pControl->IsVisible() ) continue;
152 | if( pControl->IsFloat() ) {
153 | SetFloatPos(it);
154 | continue;
155 | }
156 |
157 | if( it != m_iCurSel ) continue;
158 |
159 | RECT rcPadding = pControl->GetPadding();
160 | rc.left += rcPadding.left;
161 | rc.top += rcPadding.top;
162 | rc.right -= rcPadding.right;
163 | rc.bottom -= rcPadding.bottom;
164 |
165 | SIZE szAvailable = { rc.right - rc.left, rc.bottom - rc.top };
166 |
167 | SIZE sz = pControl->EstimateSize(szAvailable);
168 | if( sz.cx == 0 ) {
169 | sz.cx = MAX(0, szAvailable.cx);
170 | }
171 | if( sz.cx < pControl->GetMinWidth() ) sz.cx = pControl->GetMinWidth();
172 | if( sz.cx > pControl->GetMaxWidth() ) sz.cx = pControl->GetMaxWidth();
173 |
174 | if(sz.cy == 0) {
175 | sz.cy = MAX(0, szAvailable.cy);
176 | }
177 | if( sz.cy < pControl->GetMinHeight() ) sz.cy = pControl->GetMinHeight();
178 | if( sz.cy > pControl->GetMaxHeight() ) sz.cy = pControl->GetMaxHeight();
179 |
180 | RECT rcCtrl = { rc.left, rc.top, rc.left + sz.cx, rc.top + sz.cy};
181 | pControl->SetPos(rcCtrl);
182 | }
183 | }
184 | }
185 |
--------------------------------------------------------------------------------
/DuiLib/Layout/UITabLayout.h:
--------------------------------------------------------------------------------
1 | #ifndef __UITABLAYOUT_H__
2 | #define __UITABLAYOUT_H__
3 |
4 | #pragma once
5 |
6 | namespace DuiLib
7 | {
8 | class UILIB_API CTabLayoutUI : public CContainerUI
9 | {
10 | public:
11 | CTabLayoutUI();
12 |
13 | LPCTSTR GetClass() const;
14 | LPVOID GetInterface(LPCTSTR pstrName);
15 |
16 | bool Add(CControlUI* pControl);
17 | bool AddAt(CControlUI* pControl, int iIndex);
18 | bool Remove(CControlUI* pControl);
19 | void RemoveAll();
20 | int GetCurSel() const;
21 | virtual bool SelectItem(int iIndex);
22 | virtual bool SelectItem(CControlUI* pControl);
23 |
24 | void SetPos(RECT rc);
25 |
26 | void SetAttribute(LPCTSTR pstrName, LPCTSTR pstrValue);
27 |
28 | protected:
29 | int m_iCurSel;
30 | };
31 | }
32 | #endif // __UITABLAYOUT_H__
33 |
--------------------------------------------------------------------------------
/DuiLib/Layout/UITileLayout.cpp:
--------------------------------------------------------------------------------
1 | #include "stdafx.h"
2 | #include "UITileLayout.h"
3 |
4 | namespace DuiLib
5 | {
6 | CTileLayoutUI::CTileLayoutUI() : m_nColumns(1)
7 | {
8 | m_szItem.cx = m_szItem.cy = 0;
9 | }
10 |
11 | LPCTSTR CTileLayoutUI::GetClass() const
12 | {
13 | return _T("TileLayoutUI");
14 | }
15 |
16 | LPVOID CTileLayoutUI::GetInterface(LPCTSTR pstrName)
17 | {
18 | if( _tcscmp(pstrName, DUI_CTR_TILELAYOUT) == 0 ) return static_cast(this);
19 | return CContainerUI::GetInterface(pstrName);
20 | }
21 |
22 | SIZE CTileLayoutUI::GetItemSize() const
23 | {
24 | return m_szItem;
25 | }
26 |
27 | void CTileLayoutUI::SetItemSize(SIZE szItem)
28 | {
29 | if( m_szItem.cx != szItem.cx || m_szItem.cy != szItem.cy ) {
30 | m_szItem = szItem;
31 | NeedUpdate();
32 | }
33 | }
34 |
35 | int CTileLayoutUI::GetColumns() const
36 | {
37 | return m_nColumns;
38 | }
39 |
40 | void CTileLayoutUI::SetColumns(int nCols)
41 | {
42 | if( nCols <= 0 ) return;
43 | m_nColumns = nCols;
44 | NeedUpdate();
45 | }
46 |
47 | void CTileLayoutUI::SetAttribute(LPCTSTR pstrName, LPCTSTR pstrValue)
48 | {
49 | if( _tcscmp(pstrName, _T("itemsize")) == 0 ) {
50 | SIZE szItem = { 0 };
51 | LPTSTR pstr = NULL;
52 | szItem.cx = _tcstol(pstrValue, &pstr, 10); ASSERT(pstr);
53 | szItem.cy = _tcstol(pstr + 1, &pstr, 10); ASSERT(pstr);
54 | SetItemSize(szItem);
55 | }
56 | else if( _tcscmp(pstrName, _T("columns")) == 0 ) SetColumns(_ttoi(pstrValue));
57 | else CContainerUI::SetAttribute(pstrName, pstrValue);
58 | }
59 |
60 | void CTileLayoutUI::SetPos(RECT rc)
61 | {
62 | CControlUI::SetPos(rc);
63 | rc = m_rcItem;
64 |
65 | // Adjust for inset
66 | rc.left += m_rcInset.left;
67 | rc.top += m_rcInset.top;
68 | rc.right -= m_rcInset.right;
69 | rc.bottom -= m_rcInset.bottom;
70 |
71 | if( m_items.GetSize() == 0) {
72 | ProcessScrollBar(rc, 0, 0);
73 | return;
74 | }
75 |
76 | if( m_pVerticalScrollBar && m_pVerticalScrollBar->IsVisible() ) rc.right -= m_pVerticalScrollBar->GetFixedWidth();
77 | if( m_pHorizontalScrollBar && m_pHorizontalScrollBar->IsVisible() ) rc.bottom -= m_pHorizontalScrollBar->GetFixedHeight();
78 |
79 | // Position the elements
80 | if( m_szItem.cx > 0 ) m_nColumns = (rc.right - rc.left) / m_szItem.cx;
81 | if( m_nColumns == 0 ) m_nColumns = 1;
82 |
83 | int cyNeeded = 0;
84 | int cxWidth = (rc.right - rc.left) / m_nColumns;
85 | if( m_pHorizontalScrollBar && m_pHorizontalScrollBar->IsVisible() )
86 | cxWidth = (rc.right - rc.left + m_pHorizontalScrollBar->GetScrollRange() ) / m_nColumns; ;
87 |
88 | int cyHeight = 0;
89 | int iCount = 0;
90 | POINT ptTile = { rc.left, rc.top };
91 | if( m_pVerticalScrollBar && m_pVerticalScrollBar->IsVisible() ) {
92 | ptTile.y -= m_pVerticalScrollBar->GetScrollPos();
93 | }
94 | int iPosX = rc.left;
95 | if( m_pHorizontalScrollBar && m_pHorizontalScrollBar->IsVisible() ) {
96 | iPosX -= m_pHorizontalScrollBar->GetScrollPos();
97 | ptTile.x = iPosX;
98 | }
99 | for( int it1 = 0; it1 < m_items.GetSize(); it1++ ) {
100 | CControlUI* pControl = static_cast(m_items[it1]);
101 | if( !pControl->IsVisible() ) continue;
102 | if( pControl->IsFloat() ) {
103 | SetFloatPos(it1);
104 | continue;
105 | }
106 |
107 | // Determine size
108 | RECT rcTile = { ptTile.x, ptTile.y, ptTile.x + cxWidth, ptTile.y };
109 | if( (iCount % m_nColumns) == 0 )
110 | {
111 | int iIndex = iCount;
112 | for( int it2 = it1; it2 < m_items.GetSize(); it2++ ) {
113 | CControlUI* pLineControl = static_cast(m_items[it2]);
114 | if( !pLineControl->IsVisible() ) continue;
115 | if( pLineControl->IsFloat() ) continue;
116 |
117 | RECT rcPadding = pLineControl->GetPadding();
118 | SIZE szAvailable = { rcTile.right - rcTile.left - rcPadding.left - rcPadding.right, 9999 };
119 | if( iIndex == iCount || (iIndex + 1) % m_nColumns == 0 ) {
120 | szAvailable.cx -= m_iChildPadding / 2;
121 | }
122 | else {
123 | szAvailable.cx -= m_iChildPadding;
124 | }
125 |
126 | if( szAvailable.cx < pControl->GetMinWidth() ) szAvailable.cx = pControl->GetMinWidth();
127 | if( szAvailable.cx > pControl->GetMaxWidth() ) szAvailable.cx = pControl->GetMaxWidth();
128 |
129 | SIZE szTile = pLineControl->EstimateSize(szAvailable);
130 | if( szTile.cx < pControl->GetMinWidth() ) szTile.cx = pControl->GetMinWidth();
131 | if( szTile.cx > pControl->GetMaxWidth() ) szTile.cx = pControl->GetMaxWidth();
132 | if( szTile.cy < pControl->GetMinHeight() ) szTile.cy = pControl->GetMinHeight();
133 | if( szTile.cy > pControl->GetMaxHeight() ) szTile.cy = pControl->GetMaxHeight();
134 |
135 | cyHeight = MAX(cyHeight, szTile.cy + rcPadding.top + rcPadding.bottom);
136 | if( (++iIndex % m_nColumns) == 0) break;
137 | }
138 | }
139 |
140 | RECT rcPadding = pControl->GetPadding();
141 |
142 | rcTile.left += rcPadding.left + m_iChildPadding / 2;
143 | rcTile.right -= rcPadding.right + m_iChildPadding / 2;
144 | if( (iCount % m_nColumns) == 0 ) {
145 | rcTile.left -= m_iChildPadding / 2;
146 | }
147 |
148 | if( ( (iCount + 1) % m_nColumns) == 0 ) {
149 | rcTile.right += m_iChildPadding / 2;
150 | }
151 |
152 | // Set position
153 | rcTile.top = ptTile.y + rcPadding.top;
154 | rcTile.bottom = ptTile.y + cyHeight;
155 |
156 | SIZE szAvailable = { rcTile.right - rcTile.left, rcTile.bottom - rcTile.top };
157 | SIZE szTile = pControl->EstimateSize(szAvailable);
158 | if( szTile.cx == 0 ) szTile.cx = szAvailable.cx;
159 | if( szTile.cy == 0 ) szTile.cy = szAvailable.cy;
160 | if( szTile.cx < pControl->GetMinWidth() ) szTile.cx = pControl->GetMinWidth();
161 | if( szTile.cx > pControl->GetMaxWidth() ) szTile.cx = pControl->GetMaxWidth();
162 | if( szTile.cy < pControl->GetMinHeight() ) szTile.cy = pControl->GetMinHeight();
163 | if( szTile.cy > pControl->GetMaxHeight() ) szTile.cy = pControl->GetMaxHeight();
164 | RECT rcPos = {(rcTile.left + rcTile.right - szTile.cx) / 2, (rcTile.top + rcTile.bottom - szTile.cy) / 2,
165 | (rcTile.left + rcTile.right - szTile.cx) / 2 + szTile.cx, (rcTile.top + rcTile.bottom - szTile.cy) / 2 + szTile.cy};
166 | pControl->SetPos(rcPos);
167 |
168 | if( (++iCount % m_nColumns) == 0 ) {
169 | ptTile.x = iPosX;
170 | ptTile.y += cyHeight + m_iChildPadding;
171 | cyHeight = 0;
172 | }
173 | else {
174 | ptTile.x += cxWidth;
175 | }
176 | cyNeeded = rcTile.bottom - rc.top;
177 | if( m_pVerticalScrollBar && m_pVerticalScrollBar->IsVisible() ) cyNeeded += m_pVerticalScrollBar->GetScrollPos();
178 | }
179 |
180 | // Process the scrollbar
181 | ProcessScrollBar(rc, 0, cyNeeded);
182 | }
183 | }
184 |
--------------------------------------------------------------------------------
/DuiLib/Layout/UITileLayout.h:
--------------------------------------------------------------------------------
1 | #ifndef __UITILELAYOUT_H__
2 | #define __UITILELAYOUT_H__
3 |
4 | #pragma once
5 |
6 | namespace DuiLib
7 | {
8 | class UILIB_API CTileLayoutUI : public CContainerUI
9 | {
10 | public:
11 | CTileLayoutUI();
12 |
13 | LPCTSTR GetClass() const;
14 | LPVOID GetInterface(LPCTSTR pstrName);
15 |
16 | void SetPos(RECT rc);
17 |
18 | SIZE GetItemSize() const;
19 | void SetItemSize(SIZE szItem);
20 | int GetColumns() const;
21 | void SetColumns(int nCols);
22 |
23 | void SetAttribute(LPCTSTR pstrName, LPCTSTR pstrValue);
24 |
25 | protected:
26 | SIZE m_szItem;
27 | int m_nColumns;
28 | };
29 | }
30 | #endif // __UITILELAYOUT_H__
31 |
--------------------------------------------------------------------------------
/DuiLib/Layout/UIVerticalLayout.cpp:
--------------------------------------------------------------------------------
1 | #include "stdafx.h"
2 | #include "UIVerticalLayout.h"
3 |
4 | namespace DuiLib
5 | {
6 | CVerticalLayoutUI::CVerticalLayoutUI() : m_iSepHeight(0), m_uButtonState(0), m_bImmMode(false)
7 | {
8 | ptLastMouse.x = ptLastMouse.y = 0;
9 | ::ZeroMemory(&m_rcNewPos, sizeof(m_rcNewPos));
10 | }
11 |
12 | LPCTSTR CVerticalLayoutUI::GetClass() const
13 | {
14 | return _T("VerticalLayoutUI");
15 | }
16 |
17 | LPVOID CVerticalLayoutUI::GetInterface(LPCTSTR pstrName)
18 | {
19 | if( _tcscmp(pstrName, DUI_CTR_VERTICALLAYOUT) == 0 ) return static_cast(this);
20 | return CContainerUI::GetInterface(pstrName);
21 | }
22 |
23 | UINT CVerticalLayoutUI::GetControlFlags() const
24 | {
25 | if( IsEnabled() && m_iSepHeight != 0 ) return UIFLAG_SETCURSOR;
26 | else return 0;
27 | }
28 |
29 | void CVerticalLayoutUI::SetPos(RECT rc)
30 | {
31 | CControlUI::SetPos(rc);
32 | rc = m_rcItem;
33 |
34 | // Adjust for inset
35 | rc.left += m_rcInset.left;
36 | rc.top += m_rcInset.top;
37 | rc.right -= m_rcInset.right;
38 | rc.bottom -= m_rcInset.bottom;
39 | if( m_pVerticalScrollBar && m_pVerticalScrollBar->IsVisible() ) rc.right -= m_pVerticalScrollBar->GetFixedWidth();
40 | if( m_pHorizontalScrollBar && m_pHorizontalScrollBar->IsVisible() ) rc.bottom -= m_pHorizontalScrollBar->GetFixedHeight();
41 |
42 | if( m_items.GetSize() == 0) {
43 | ProcessScrollBar(rc, 0, 0);
44 | return;
45 | }
46 |
47 | // Determine the minimum size
48 | SIZE szAvailable = { rc.right - rc.left, rc.bottom - rc.top };
49 | if( m_pHorizontalScrollBar && m_pHorizontalScrollBar->IsVisible() )
50 | szAvailable.cx += m_pHorizontalScrollBar->GetScrollRange();
51 |
52 | int nAdjustables = 0;
53 | int cyFixed = 0;
54 | int nEstimateNum = 0;
55 | for( int it1 = 0; it1 < m_items.GetSize(); it1++ ) {
56 | CControlUI* pControl = static_cast(m_items[it1]);
57 | if( !pControl->IsVisible() ) continue;
58 | if( pControl->IsFloat() ) continue;
59 | SIZE sz = pControl->EstimateSize(szAvailable);
60 | if( sz.cy == 0 ) {
61 | nAdjustables++;
62 | }
63 | else {
64 | if( sz.cy < pControl->GetMinHeight() ) sz.cy = pControl->GetMinHeight();
65 | if( sz.cy > pControl->GetMaxHeight() ) sz.cy = pControl->GetMaxHeight();
66 | }
67 | cyFixed += sz.cy + pControl->GetPadding().top + pControl->GetPadding().bottom;
68 | nEstimateNum++;
69 | }
70 | cyFixed += (nEstimateNum - 1) * m_iChildPadding;
71 |
72 | // Place elements
73 | int cyNeeded = 0;
74 | int cyExpand = 0;
75 | if( nAdjustables > 0 ) cyExpand = MAX(0, (szAvailable.cy - cyFixed) / nAdjustables);
76 | // Position the elements
77 | SIZE szRemaining = szAvailable;
78 | int iPosY = rc.top;
79 | if( m_pVerticalScrollBar && m_pVerticalScrollBar->IsVisible() ) {
80 | iPosY -= m_pVerticalScrollBar->GetScrollPos();
81 | }
82 | int iPosX = rc.left;
83 | if( m_pHorizontalScrollBar && m_pHorizontalScrollBar->IsVisible() ) {
84 | iPosX -= m_pHorizontalScrollBar->GetScrollPos();
85 | }
86 | int iAdjustable = 0;
87 | int cyFixedRemaining = cyFixed;
88 | for( int it2 = 0; it2 < m_items.GetSize(); it2++ ) {
89 | CControlUI* pControl = static_cast(m_items[it2]);
90 | if( !pControl->IsVisible() ) continue;
91 | if( pControl->IsFloat() ) {
92 | SetFloatPos(it2);
93 | continue;
94 | }
95 |
96 | RECT rcPadding = pControl->GetPadding();
97 | szRemaining.cy -= rcPadding.top;
98 | SIZE sz = pControl->EstimateSize(szRemaining);
99 | if( sz.cy == 0 ) {
100 | iAdjustable++;
101 | sz.cy = cyExpand;
102 | // Distribute remaining to last element (usually round-off left-overs)
103 | // if( iAdjustable == nAdjustables ) {
104 | // sz.cy = MAX(0, szRemaining.cy - rcPadding.bottom - cyFixedRemaining);
105 | // }
106 | if( sz.cy < pControl->GetMinHeight() ) sz.cy = pControl->GetMinHeight();
107 | if( sz.cy > pControl->GetMaxHeight() ) sz.cy = pControl->GetMaxHeight();
108 | }
109 | else {
110 | if( sz.cy < pControl->GetMinHeight() ) sz.cy = pControl->GetMinHeight();
111 | if( sz.cy > pControl->GetMaxHeight() ) sz.cy = pControl->GetMaxHeight();
112 | // cyFixedRemaining -= sz.cy + rcPadding.top + rcPadding.bottom;
113 | }
114 |
115 | // cyFixedRemaining -= m_iChildPadding;
116 |
117 | sz.cx = pControl->GetFixedWidth();
118 | if( sz.cx == 0 ) sz.cx = szAvailable.cx - rcPadding.left - rcPadding.right;
119 | if( sz.cx < 0 ) sz.cx = 0;
120 | if( sz.cx < pControl->GetMinWidth() ) sz.cx = pControl->GetMinWidth();
121 | if( sz.cx > pControl->GetMaxWidth() ) sz.cx = pControl->GetMaxWidth();
122 |
123 | RECT rcCtrl = { iPosX + rcPadding.left, iPosY + rcPadding.top, iPosX + rcPadding.left + sz.cx, iPosY + sz.cy + rcPadding.top };
124 | pControl->SetPos(rcCtrl);
125 |
126 | iPosY += sz.cy + m_iChildPadding + rcPadding.top + rcPadding.bottom;
127 | cyNeeded += sz.cy + rcPadding.top + rcPadding.bottom;
128 | szRemaining.cy -= sz.cy + m_iChildPadding + rcPadding.bottom;
129 | }
130 | cyNeeded += (nEstimateNum - 1) * m_iChildPadding;
131 |
132 | // Process the scrollbar
133 | ProcessScrollBar(rc, 0, cyNeeded);
134 | }
135 |
136 | void CVerticalLayoutUI::DoPostPaint(HDC hDC, const RECT& rcPaint)
137 | {
138 | if( (m_uButtonState & UISTATE_CAPTURED) != 0 && !m_bImmMode ) {
139 | RECT rcSeparator = GetThumbRect(true);
140 | CRenderEngine::DrawColor(hDC, rcSeparator, 0xAA000000);
141 | }
142 | }
143 |
144 | void CVerticalLayoutUI::SetSepHeight(int iHeight)
145 | {
146 | m_iSepHeight = iHeight;
147 | }
148 |
149 | int CVerticalLayoutUI::GetSepHeight() const
150 | {
151 | return m_iSepHeight;
152 | }
153 |
154 | void CVerticalLayoutUI::SetSepImmMode(bool bImmediately)
155 | {
156 | if( m_bImmMode == bImmediately ) return;
157 | if( (m_uButtonState & UISTATE_CAPTURED) != 0 && !m_bImmMode && m_pManager != NULL ) {
158 | m_pManager->RemovePostPaint(this);
159 | }
160 |
161 | m_bImmMode = bImmediately;
162 | }
163 |
164 | bool CVerticalLayoutUI::IsSepImmMode() const
165 | {
166 | return m_bImmMode;
167 | }
168 |
169 | void CVerticalLayoutUI::SetAttribute(LPCTSTR pstrName, LPCTSTR pstrValue)
170 | {
171 | if( _tcscmp(pstrName, _T("sepheight")) == 0 ) SetSepHeight(_ttoi(pstrValue));
172 | else if( _tcscmp(pstrName, _T("sepimm")) == 0 ) SetSepImmMode(_tcscmp(pstrValue, _T("true")) == 0);
173 | else CContainerUI::SetAttribute(pstrName, pstrValue);
174 | }
175 |
176 | void CVerticalLayoutUI::DoEvent(TEventUI& event)
177 | {
178 | if( m_iSepHeight != 0 ) {
179 | if( event.Type == UIEVENT_BUTTONDOWN && IsEnabled() )
180 | {
181 | RECT rcSeparator = GetThumbRect(false);
182 | if( ::PtInRect(&rcSeparator, event.ptMouse) ) {
183 | m_uButtonState |= UISTATE_CAPTURED;
184 | ptLastMouse = event.ptMouse;
185 | m_rcNewPos = m_rcItem;
186 | if( !m_bImmMode && m_pManager ) m_pManager->AddPostPaint(this);
187 | return;
188 | }
189 | }
190 | if( event.Type == UIEVENT_BUTTONUP )
191 | {
192 | if( (m_uButtonState & UISTATE_CAPTURED) != 0 ) {
193 | m_uButtonState &= ~UISTATE_CAPTURED;
194 | m_rcItem = m_rcNewPos;
195 | if( !m_bImmMode && m_pManager ) m_pManager->RemovePostPaint(this);
196 | NeedParentUpdate();
197 | return;
198 | }
199 | }
200 | if( event.Type == UIEVENT_MOUSEMOVE )
201 | {
202 | if( (m_uButtonState & UISTATE_CAPTURED) != 0 ) {
203 | LONG cy = event.ptMouse.y - ptLastMouse.y;
204 | ptLastMouse = event.ptMouse;
205 | RECT rc = m_rcNewPos;
206 | if( m_iSepHeight >= 0 ) {
207 | if( cy > 0 && event.ptMouse.y < m_rcNewPos.bottom + m_iSepHeight ) return;
208 | if( cy < 0 && event.ptMouse.y > m_rcNewPos.bottom ) return;
209 | rc.bottom += cy;
210 | if( rc.bottom - rc.top <= GetMinHeight() ) {
211 | if( m_rcNewPos.bottom - m_rcNewPos.top <= GetMinHeight() ) return;
212 | rc.bottom = rc.top + GetMinHeight();
213 | }
214 | if( rc.bottom - rc.top >= GetMaxHeight() ) {
215 | if( m_rcNewPos.bottom - m_rcNewPos.top >= GetMaxHeight() ) return;
216 | rc.bottom = rc.top + GetMaxHeight();
217 | }
218 | }
219 | else {
220 | if( cy > 0 && event.ptMouse.y < m_rcNewPos.top ) return;
221 | if( cy < 0 && event.ptMouse.y > m_rcNewPos.top + m_iSepHeight ) return;
222 | rc.top += cy;
223 | if( rc.bottom - rc.top <= GetMinHeight() ) {
224 | if( m_rcNewPos.bottom - m_rcNewPos.top <= GetMinHeight() ) return;
225 | rc.top = rc.bottom - GetMinHeight();
226 | }
227 | if( rc.bottom - rc.top >= GetMaxHeight() ) {
228 | if( m_rcNewPos.bottom - m_rcNewPos.top >= GetMaxHeight() ) return;
229 | rc.top = rc.bottom - GetMaxHeight();
230 | }
231 | }
232 |
233 | CDuiRect rcInvalidate = GetThumbRect(true);
234 | m_rcNewPos = rc;
235 | m_cxyFixed.cy = m_rcNewPos.bottom - m_rcNewPos.top;
236 |
237 | if( m_bImmMode ) {
238 | m_rcItem = m_rcNewPos;
239 | NeedParentUpdate();
240 | }
241 | else {
242 | rcInvalidate.Join(GetThumbRect(true));
243 | rcInvalidate.Join(GetThumbRect(false));
244 | if( m_pManager ) m_pManager->Invalidate(rcInvalidate);
245 | }
246 | return;
247 | }
248 | }
249 | if( event.Type == UIEVENT_SETCURSOR )
250 | {
251 | RECT rcSeparator = GetThumbRect(false);
252 | if( IsEnabled() && ::PtInRect(&rcSeparator, event.ptMouse) ) {
253 | ::SetCursor(::LoadCursor(NULL, MAKEINTRESOURCE(IDC_SIZENS)));
254 | return;
255 | }
256 | }
257 | }
258 | CContainerUI::DoEvent(event);
259 | }
260 |
261 | RECT CVerticalLayoutUI::GetThumbRect(bool bUseNew) const
262 | {
263 | if( (m_uButtonState & UISTATE_CAPTURED) != 0 && bUseNew) {
264 | if( m_iSepHeight >= 0 )
265 | return CDuiRect(m_rcNewPos.left, MAX(m_rcNewPos.bottom - m_iSepHeight, m_rcNewPos.top),
266 | m_rcNewPos.right, m_rcNewPos.bottom);
267 | else
268 | return CDuiRect(m_rcNewPos.left, m_rcNewPos.top, m_rcNewPos.right,
269 | MIN(m_rcNewPos.top - m_iSepHeight, m_rcNewPos.bottom));
270 | }
271 | else {
272 | if( m_iSepHeight >= 0 )
273 | return CDuiRect(m_rcItem.left, MAX(m_rcItem.bottom - m_iSepHeight, m_rcItem.top), m_rcItem.right,
274 | m_rcItem.bottom);
275 | else
276 | return CDuiRect(m_rcItem.left, m_rcItem.top, m_rcItem.right,
277 | MIN(m_rcItem.top - m_iSepHeight, m_rcItem.bottom));
278 |
279 | }
280 | }
281 | }
282 |
--------------------------------------------------------------------------------
/DuiLib/Layout/UIVerticalLayout.h:
--------------------------------------------------------------------------------
1 | #ifndef __UIVERTICALLAYOUT_H__
2 | #define __UIVERTICALLAYOUT_H__
3 |
4 | #pragma once
5 |
6 | namespace DuiLib
7 | {
8 | class UILIB_API CVerticalLayoutUI : public CContainerUI
9 | {
10 | public:
11 | CVerticalLayoutUI();
12 |
13 | LPCTSTR GetClass() const;
14 | LPVOID GetInterface(LPCTSTR pstrName);
15 | UINT GetControlFlags() const;
16 |
17 | void SetSepHeight(int iHeight);
18 | int GetSepHeight() const;
19 | void SetSepImmMode(bool bImmediately);
20 | bool IsSepImmMode() const;
21 | void SetAttribute(LPCTSTR pstrName, LPCTSTR pstrValue);
22 | void DoEvent(TEventUI& event);
23 |
24 | void SetPos(RECT rc);
25 | void DoPostPaint(HDC hDC, const RECT& rcPaint);
26 |
27 | RECT GetThumbRect(bool bUseNew = false) const;
28 |
29 | protected:
30 | int m_iSepHeight;
31 | UINT m_uButtonState;
32 | POINT ptLastMouse;
33 | RECT m_rcNewPos;
34 | bool m_bImmMode;
35 | };
36 | }
37 | #endif // __UIVERTICALLAYOUT_H__
38 |
--------------------------------------------------------------------------------
/DuiLib/StdAfx.cpp:
--------------------------------------------------------------------------------
1 | // stdafx.cpp : source file that includes just the standard includes
2 | // UIlib.pch will be the pre-compiled header
3 | // stdafx.obj will contain the pre-compiled type information
4 |
5 | #include "StdAfx.h"
6 |
7 |
8 | #pragma comment( lib, "winmm.lib" )
9 | #pragma comment( lib, "comctl32.lib" )
10 |
--------------------------------------------------------------------------------
/DuiLib/StdAfx.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/DuiLib/StdAfx.h
--------------------------------------------------------------------------------
/DuiLib/UIlib.cpp:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2010-2011, duilib develop team(www.duilib.com).
2 | // All rights reserved.
3 | //
4 | // Redistribution and use in source and binary forms, with or
5 | // without modification, are permitted provided that the
6 | // following conditions are met.
7 | //
8 | // Redistributions of source code must retain the above copyright
9 | // notice, this list of conditions and the following disclaimer.
10 | //
11 | // Redistributions in binary form must reproduce the above
12 | // copyright notice, this list of conditions and the following
13 | // disclaimer in the documentation and/or other materials
14 | // provided with the distribution.
15 | //
16 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
17 | // CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
18 | // INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
19 | // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 | // DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
21 | // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
23 | // BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24 | // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
26 | // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
27 | // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28 | // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 | //
30 | //
31 | // DirectUI - UI Library
32 | //
33 | // Written by Bjarke Viksoe (bjarke@viksoe.dk)
34 | // Copyright (c) 2006-2007 Bjarke Viksoe.
35 | //
36 | // This code may be used in compiled form in any way you desire. These
37 | // source files may be redistributed by any means PROVIDING it is
38 | // not sold for profit without the authors written consent, and
39 | // providing that this notice and the authors name is included.
40 | //
41 | // This file is provided "as is" with no expressed or implied warranty.
42 | // The author accepts no liability if it causes any damage to you or your
43 | // computer whatsoever. It's free, so don't hassle me about it.
44 | //
45 | // Beware of bugs.
46 | //
47 | //
48 |
49 |
50 | #include "stdafx.h"
51 | #include "UIlib.h"
52 |
53 |
54 | BOOL APIENTRY DllMain(HANDLE hModule, DWORD dwReason, LPVOID /*lpReserved*/)
55 | {
56 | switch( dwReason ) {
57 | case DLL_PROCESS_ATTACH:
58 | case DLL_THREAD_ATTACH:
59 | case DLL_THREAD_DETACH:
60 | case DLL_PROCESS_DETACH:
61 | ::DisableThreadLibraryCalls((HMODULE)hModule);
62 | break;
63 | }
64 | return TRUE;
65 | }
66 |
67 |
--------------------------------------------------------------------------------
/DuiLib/UIlib.h:
--------------------------------------------------------------------------------
1 | #if defined(UILIB_EXPORTS)
2 | # if defined(_MSC_VER)
3 | # define UILIB_API __declspec(dllexport)
4 | # else
5 | # define UILIB_API
6 | # endif
7 | #else
8 | # if defined(_MSC_VER)
9 | # define UILIB_API __declspec(dllimport)
10 | # else
11 | # define UILIB_API
12 | # endif
13 | #endif
14 |
15 | #pragma comment(lib,"gdiplus.lib")
16 |
17 | #define UILIB_COMDAT __declspec(selectany)
18 |
19 | #if defined _M_IX86
20 | #pragma comment(linker, "/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"")
21 | #elif defined _M_IA64
22 | #pragma comment(linker, "/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='ia64' publicKeyToken='6595b64144ccf1df' language='*'\"")
23 | #elif defined _M_X64
24 | #pragma comment(linker, "/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"")
25 | #else
26 | #pragma comment(linker, "/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
27 | #endif
28 |
29 | #include
30 | #include
31 | #include
32 | #include
33 | #include
34 | #include
35 | #include
36 | #include
37 | #include
38 | #include
39 | #include
40 |
41 | #include "Utils/Utils.h"
42 | #include "Utils/UIShadow.h"
43 | #include "Utils/UIDelegate.h"
44 | #include "Core/UIDefine.h"
45 | #include "Core/UIManager.h"
46 | #include "Core/UIBase.h"
47 | #include "Core/UIImageAttribute.h"
48 | #include "Core/UIControl.h"
49 | #include "Core/UIContainer.h"
50 | #include "Core/UIMarkup.h"
51 | #include "Core/UIDlgBuilder.h"
52 | #include "Core/UIRender.h"
53 | #include "Utils/WinImplBase.h"
54 |
55 |
56 | #include "Layout/UIVerticalLayout.h"
57 | #include "Layout/UIHorizontalLayout.h"
58 | #include "Layout/UITileLayout.h"
59 | #include "Layout/UITabLayout.h"
60 | #include "Layout/UIChildLayout.h"
61 |
62 | #include "Control/UIList.h"
63 | #include "Control/UICombo.h"
64 | #include "Control/UIScrollBar.h"
65 | #include "Control/UITreeView.h"
66 |
67 | #include "Control/UILabel.h"
68 | #include "Control/UIText.h"
69 | #include "Control/UIEdit.h"
70 | #include "Control/UIGifAnim.h"
71 |
72 | #include "Control/UIButton.h"
73 | #include "Control/UIOption.h"
74 | #include "Control/UICheckBox.h"
75 |
76 | #include "Control/UIProgress.h"
77 | #include "Control/UISlider.h"
78 |
79 | #include "Control/UIRichEdit.h"
80 | #include "Control/UIDateTime.h"
81 |
82 | #include "Control/UIActiveX.h"
83 | #include "Control/UIWebBrowser.h"
84 | #include "Control/UIFlash.h"
85 |
86 | #include "Control/UIMenu.h"
87 |
88 | #include "Control/UIHead.h"
89 | #include "Control/UIListEx.h"
90 | #include "Control/UIListExItem.h"
--------------------------------------------------------------------------------
/DuiLib/Utils/Flash11.tlb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/DuiLib/Utils/Flash11.tlb
--------------------------------------------------------------------------------
/DuiLib/Utils/FlashEventHandler.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/DuiLib/Utils/FlashEventHandler.h
--------------------------------------------------------------------------------
/DuiLib/Utils/ThirdParty.cpp:
--------------------------------------------------------------------------------
1 | #include "stdafx.h"
2 | #include "stb_image.h"
3 | #include "ThirdParty.h"
4 |
5 | DECLARE_HANDLE(HZIP); // An HZIP identifies a zip file that has been opened
6 | typedef DWORD ZRESULT;
7 | typedef struct
8 | {
9 | int index; // index of this file within the zip
10 | char name[MAX_PATH]; // filename within the zip
11 | DWORD attr; // attributes, as in GetFileAttributes.
12 | FILETIME atime, ctime, mtime;// access, create, modify filetimes
13 | long comp_size; // sizes of item, compressed and uncompressed. These
14 | long unc_size; // may be -1 if not yet known (e.g. being streamed in)
15 | } ZIPENTRY;
16 | typedef struct
17 | {
18 | int index; // index of this file within the zip
19 | TCHAR name[MAX_PATH]; // filename within the zip
20 | DWORD attr; // attributes, as in GetFileAttributes.
21 | FILETIME atime, ctime, mtime;// access, create, modify filetimes
22 | long comp_size; // sizes of item, compressed and uncompressed. These
23 | long unc_size; // may be -1 if not yet known (e.g. being streamed in)
24 | } ZIPENTRYW;
25 |
26 | extern HZIP OpenZipU(void *z, unsigned int len, DWORD flags);
27 | extern ZRESULT CloseZipU(HZIP hz);
28 |
29 | #ifdef _UNICODE
30 | #define ZIPENTRY ZIPENTRYW
31 | #define GetZipItem GetZipItemW
32 | #define FindZipItem FindZipItemW
33 | #else
34 | #define GetZipItem GetZipItemA
35 | #define FindZipItem FindZipItemA
36 | #endif
37 | extern ZRESULT GetZipItemA(HZIP hz, int index, ZIPENTRY *ze);
38 | extern ZRESULT GetZipItemW(HZIP hz, int index, ZIPENTRYW *ze);
39 | extern ZRESULT FindZipItemA(HZIP hz, const TCHAR *name, bool ic, int *index, ZIPENTRY *ze);
40 | extern ZRESULT FindZipItemW(HZIP hz, const TCHAR *name, bool ic, int *index, ZIPENTRYW *ze);
41 | extern ZRESULT UnzipItem(HZIP hz, int index, void *dst, unsigned int len, DWORD flags);
42 | ///////////////////////////////////////////////////////////////////////////////////////
43 |
44 | extern "C"
45 | {
46 | extern unsigned char *stbi_load_from_memory(unsigned char const *buffer, int len, int *x, int *y, \
47 | int *comp, int req_comp);
48 | extern void stbi_image_free(void *retval_from_stbi_load);
49 |
50 | };
51 |
52 | namespace DuiLib
53 | {
54 | namespace ThirdParty
55 | {
56 | BYTE* ThirdParty::ParseImage(BYTE const *buffer, int len, OUT int &width, OUT int &height)
57 | {
58 | int n;
59 | return stbi_load_from_memory(buffer, len, &width, &height, &n, STBI_rgb_alpha);
60 | }
61 |
62 | void FreeImage(void *pImage)
63 | {
64 | stbi_image_free(pImage);
65 | }
66 |
67 | HANDLE OpenZip(void *buffer, unsigned int len, DWORD flags)
68 | {
69 | return (HANDLE)OpenZipU(buffer, len, flags);
70 | }
71 |
72 | void CloseZip(HANDLE hz)
73 | {
74 | CloseZipU((HZIP)hz);
75 | }
76 |
77 | BYTE* LoadFromFile(LPCTSTR strFilePath, OUT DWORD &dwFileSize)
78 | {
79 | CDuiString sFile = CPaintManagerUI::GetResourcePath();
80 | sFile += strFilePath;
81 |
82 | HANDLE hFile = ::CreateFile(sFile.GetData(), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, \
83 | FILE_ATTRIBUTE_NORMAL, NULL);
84 | if (hFile == INVALID_HANDLE_VALUE)
85 | return NULL;
86 |
87 | dwFileSize = ::GetFileSize(hFile, NULL);
88 | if (dwFileSize == 0)
89 | return NULL;
90 |
91 | DWORD dwRead = 0;
92 | LPBYTE pData = new BYTE[dwFileSize];
93 | ::ReadFile(hFile, pData, dwFileSize, &dwRead, NULL);
94 | ::CloseHandle(hFile);
95 |
96 | if (dwRead != dwFileSize)
97 | {
98 | delete[] pData;
99 | return NULL;
100 | }
101 |
102 | return pData;
103 | }
104 |
105 | BYTE* LoadFromZip(LPCTSTR strFilePath, OUT DWORD &dwFileSize)
106 | {
107 | CDuiString sFile = CPaintManagerUI::GetResourcePath();
108 | sFile += CPaintManagerUI::GetResourceZip();
109 |
110 | HZIP hz = NULL;
111 | if (CPaintManagerUI::IsCachedResourceZip())
112 | hz = (HZIP)CPaintManagerUI::GetResourceZipHandle();
113 | else
114 | hz = OpenZipU((void*)sFile.GetData(), 0, 2);
115 | if (hz == NULL)
116 | return NULL;
117 |
118 | ZIPENTRY ze;
119 | int i;
120 | if (FindZipItem(hz, strFilePath, true, &i, &ze) != 0)
121 | return NULL;
122 |
123 | dwFileSize = ze.unc_size;
124 | if (dwFileSize == 0)
125 | return NULL;
126 |
127 | LPBYTE pData = new BYTE[dwFileSize];
128 | int res = UnzipItem(hz, i, pData, dwFileSize, 3);
129 | if (res != 0x00000000 && res != 0x00000600)
130 | {
131 | delete[] pData;
132 | pData = NULL;
133 | if (!CPaintManagerUI::IsCachedResourceZip())
134 | CloseZipU(hz);
135 |
136 | return NULL;
137 | }
138 | if (!CPaintManagerUI::IsCachedResourceZip())
139 | CloseZipU(hz);
140 |
141 | return pData;
142 | }
143 |
144 | BYTE* LoadFromResource(LPCTSTR strResName, LPCTSTR resType, OUT DWORD &dwFileSize)
145 | {
146 | HRSRC hResource = ::FindResource(CPaintManagerUI::GetResourceDll(), strResName, resType);
147 | if (hResource == NULL)
148 | return NULL;
149 | HGLOBAL hGlobal = ::LoadResource(CPaintManagerUI::GetResourceDll(), hResource);
150 | if (hGlobal == NULL)
151 | {
152 | FreeResource(hResource);
153 | return NULL;
154 | }
155 |
156 | dwFileSize = ::SizeofResource(CPaintManagerUI::GetResourceDll(), hResource);
157 | if (dwFileSize == 0)
158 | return NULL;
159 | LPBYTE pData = new BYTE[dwFileSize];
160 | ::CopyMemory(pData, (LPBYTE)::LockResource(hGlobal), dwFileSize);
161 | ::FreeResource(hResource);
162 |
163 | return pData;
164 | }
165 |
166 | BYTE* LoadFromAbsoluteFile(LPCTSTR strFilePath, OUT DWORD &dwFileSize)
167 | {
168 | HANDLE hFile = ::CreateFile(strFilePath, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, \
169 | FILE_ATTRIBUTE_NORMAL, NULL);
170 | if (hFile == INVALID_HANDLE_VALUE)
171 | return NULL;
172 | dwFileSize = ::GetFileSize(hFile, NULL);
173 | if (dwFileSize == 0)
174 | return NULL;
175 |
176 | DWORD dwRead = 0;
177 | LPBYTE pData = new BYTE[dwFileSize];
178 | ::ReadFile(hFile, pData, dwFileSize, &dwRead, NULL);
179 | ::CloseHandle(hFile);
180 |
181 | if (dwRead != dwFileSize)
182 | {
183 | delete[] pData;
184 | pData = NULL;
185 | }
186 |
187 | return pData;
188 | }
189 | }
190 | } // namespace DuiLib
--------------------------------------------------------------------------------
/DuiLib/Utils/ThirdParty.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/DuiLib/Utils/ThirdParty.h
--------------------------------------------------------------------------------
/DuiLib/Utils/UIDelegate.cpp:
--------------------------------------------------------------------------------
1 | #include "StdAfx.h"
2 |
3 | namespace DuiLib {
4 |
5 | CDelegateBase::CDelegateBase(void* pObject, void* pFn)
6 | {
7 | m_pObject = pObject;
8 | m_pFn = pFn;
9 | }
10 |
11 | CDelegateBase::CDelegateBase(const CDelegateBase& rhs)
12 | {
13 | m_pObject = rhs.m_pObject;
14 | m_pFn = rhs.m_pFn;
15 | }
16 |
17 | CDelegateBase::~CDelegateBase()
18 | {
19 |
20 | }
21 |
22 | bool CDelegateBase::Equals(const CDelegateBase& rhs) const
23 | {
24 | return m_pObject == rhs.m_pObject && m_pFn == rhs.m_pFn;
25 | }
26 |
27 | bool CDelegateBase::operator() (void* param)
28 | {
29 | return Invoke(param);
30 | }
31 |
32 | void* CDelegateBase::GetFn()
33 | {
34 | return m_pFn;
35 | }
36 |
37 | void* CDelegateBase::GetObject()
38 | {
39 | return m_pObject;
40 | }
41 |
42 | CEventSource::~CEventSource()
43 | {
44 | for( int i = 0; i < m_aDelegates.GetSize(); i++ ) {
45 | CDelegateBase* pObject = static_cast(m_aDelegates[i]);
46 | if( pObject) delete pObject;
47 | }
48 | }
49 |
50 | CEventSource::operator bool()
51 | {
52 | return m_aDelegates.GetSize() > 0;
53 | }
54 |
55 | void CEventSource::operator+= (const CDelegateBase& d)
56 | {
57 | for( int i = 0; i < m_aDelegates.GetSize(); i++ ) {
58 | CDelegateBase* pObject = static_cast(m_aDelegates[i]);
59 | if( pObject && pObject->Equals(d) ) return;
60 | }
61 |
62 | m_aDelegates.Add(d.Copy());
63 | }
64 |
65 | void CEventSource::operator+= (FnType pFn)
66 | {
67 | (*this) += MakeDelegate(pFn);
68 | }
69 |
70 | void CEventSource::operator-= (const CDelegateBase& d)
71 | {
72 | for( int i = 0; i < m_aDelegates.GetSize(); i++ ) {
73 | CDelegateBase* pObject = static_cast(m_aDelegates[i]);
74 | if( pObject && pObject->Equals(d) ) {
75 | delete pObject;
76 | m_aDelegates.Remove(i);
77 | return;
78 | }
79 | }
80 | }
81 | void CEventSource::operator-= (FnType pFn)
82 | {
83 | (*this) -= MakeDelegate(pFn);
84 | }
85 |
86 | bool CEventSource::operator() (void* param)
87 | {
88 | for( int i = 0; i < m_aDelegates.GetSize(); i++ ) {
89 | CDelegateBase* pObject = static_cast(m_aDelegates[i]);
90 | if( pObject && !(*pObject)(param) ) return false;
91 | }
92 | return true;
93 | }
94 |
95 | } // namespace DuiLib
96 |
--------------------------------------------------------------------------------
/DuiLib/Utils/UIDelegate.h:
--------------------------------------------------------------------------------
1 | #ifndef __UIDELEGATE_H__
2 | #define __UIDELEGATE_H__
3 |
4 | #pragma once
5 |
6 | namespace DuiLib {
7 |
8 | class UILIB_API CDelegateBase
9 | {
10 | public:
11 | CDelegateBase(void* pObject, void* pFn);
12 | CDelegateBase(const CDelegateBase& rhs);
13 | virtual ~CDelegateBase();
14 | bool Equals(const CDelegateBase& rhs) const;
15 | bool operator() (void* param);
16 | virtual CDelegateBase* Copy() const = 0; // add const for gcc
17 |
18 | protected:
19 | void* GetFn();
20 | void* GetObject();
21 | virtual bool Invoke(void* param) = 0;
22 |
23 | private:
24 | void* m_pObject;
25 | void* m_pFn;
26 | };
27 |
28 | class CDelegateStatic: public CDelegateBase
29 | {
30 | typedef bool (*Fn)(void*);
31 | public:
32 | CDelegateStatic(Fn pFn) : CDelegateBase(NULL, pFn) { }
33 | CDelegateStatic(const CDelegateStatic& rhs) : CDelegateBase(rhs) { }
34 | virtual CDelegateBase* Copy() const { return new CDelegateStatic(*this); }
35 |
36 | protected:
37 | virtual bool Invoke(void* param)
38 | {
39 | Fn pFn = (Fn)GetFn();
40 | return (*pFn)(param);
41 | }
42 | };
43 |
44 | template
45 | class CDelegate : public CDelegateBase
46 | {
47 | typedef bool (T::* Fn)(void*);
48 | public:
49 | CDelegate(O* pObj, Fn pFn) : CDelegateBase(pObj, &pFn), m_pFn(pFn) { }
50 | CDelegate(const CDelegate& rhs) : CDelegateBase(rhs) { m_pFn = rhs.m_pFn; }
51 | virtual CDelegateBase* Copy() const { return new CDelegate(*this); }
52 |
53 | protected:
54 | virtual bool Invoke(void* param)
55 | {
56 | O* pObject = (O*) GetObject();
57 | return (pObject->*m_pFn)(param);
58 | }
59 |
60 | private:
61 | Fn m_pFn;
62 | };
63 |
64 | template
65 | CDelegate MakeDelegate(O* pObject, bool (T::* pFn)(void*))
66 | {
67 | return CDelegate(pObject, pFn);
68 | }
69 |
70 | inline CDelegateStatic MakeDelegate(bool (*pFn)(void*))
71 | {
72 | return CDelegateStatic(pFn);
73 | }
74 |
75 | class UILIB_API CEventSource
76 | {
77 | typedef bool (*FnType)(void*);
78 | public:
79 | ~CEventSource();
80 | operator bool();
81 | void operator+= (const CDelegateBase& d); // add const for gcc
82 | void operator+= (FnType pFn);
83 | void operator-= (const CDelegateBase& d);
84 | void operator-= (FnType pFn);
85 | bool operator() (void* param);
86 |
87 | protected:
88 | CStdPtrArray m_aDelegates;
89 | };
90 |
91 | } // namespace DuiLib
92 |
93 | #endif // __UIDELEGATE_H__
--------------------------------------------------------------------------------
/DuiLib/Utils/UIShadow.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/DuiLib/Utils/UIShadow.h
--------------------------------------------------------------------------------
/DuiLib/Utils/Utils.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/DuiLib/Utils/Utils.cpp
--------------------------------------------------------------------------------
/DuiLib/Utils/Utils.h:
--------------------------------------------------------------------------------
1 | #ifndef __UTILS_H__
2 | #define __UTILS_H__
3 |
4 | #pragma once
5 | #include "OAIdl.h"
6 | namespace DuiLib
7 | {
8 | /////////////////////////////////////////////////////////////////////////////////////
9 | //
10 |
11 | class UILIB_API STRINGorID
12 | {
13 | public:
14 | STRINGorID(LPCTSTR lpString) : m_lpstr(lpString)
15 | { }
16 | STRINGorID(UINT nID) : m_lpstr(MAKEINTRESOURCE(nID))
17 | { }
18 | LPCTSTR m_lpstr;
19 | };
20 |
21 | /////////////////////////////////////////////////////////////////////////////////////
22 | //
23 |
24 | class UILIB_API CPoint : public tagPOINT
25 | {
26 | public:
27 | CPoint();
28 | CPoint(const POINT& src);
29 | CPoint(int x, int y);
30 | CPoint(LPARAM lParam);
31 | };
32 |
33 |
34 | /////////////////////////////////////////////////////////////////////////////////////
35 | //
36 |
37 | class UILIB_API CSize : public tagSIZE
38 | {
39 | public:
40 | CSize();
41 | CSize(const SIZE& src);
42 | CSize(const RECT rc);
43 | CSize(int cx, int cy);
44 | };
45 |
46 |
47 | /////////////////////////////////////////////////////////////////////////////////////
48 | //
49 |
50 | class UILIB_API CDuiRect : public tagRECT
51 | {
52 | public:
53 | CDuiRect();
54 | CDuiRect(const RECT& src);
55 | CDuiRect(int iLeft, int iTop, int iRight, int iBottom);
56 |
57 | int GetWidth() const;
58 | int GetHeight() const;
59 | void Empty();
60 | bool IsNull() const;
61 | void Join(const RECT& rc);
62 | void ResetOffset();
63 | void Normalize();
64 | bool Offset(int cx, int cy);
65 | bool Inflate(int cx, int cy);
66 | bool Deflate(int cx, int cy);
67 | bool Union(const CDuiRect& rc);
68 | bool Intersect(const CDuiRect& rc);
69 | };
70 |
71 | /////////////////////////////////////////////////////////////////////////////////////
72 | //
73 |
74 | class UILIB_API CStdPtrArray
75 | {
76 | public:
77 | CStdPtrArray(int iPreallocSize = 0);
78 | CStdPtrArray(const CStdPtrArray& src);
79 | ~CStdPtrArray();
80 |
81 | void Empty();
82 | void Resize(int iSize);
83 | bool IsEmpty() const;
84 | int Find(LPVOID iIndex) const;
85 | bool Add(LPVOID pData);
86 | bool SetAt(int iIndex, LPVOID pData);
87 | bool InsertAt(int iIndex, LPVOID pData);
88 | bool Remove(int iIndex);
89 | int GetSize() const;
90 | LPVOID* GetData();
91 |
92 | LPVOID GetAt(int iIndex) const;
93 | LPVOID operator[] (int nIndex) const;
94 |
95 | protected:
96 | LPVOID* m_ppVoid;
97 | int m_nCount;
98 | int m_nAllocated;
99 | };
100 |
101 |
102 | /////////////////////////////////////////////////////////////////////////////////////
103 | //
104 |
105 | class UILIB_API CStdValArray
106 | {
107 | public:
108 | CStdValArray(int iElementSize, int iPreallocSize = 0);
109 | ~CStdValArray();
110 |
111 | void Empty();
112 | bool IsEmpty() const;
113 | bool Add(LPCVOID pData);
114 | bool Remove(int iIndex);
115 | int GetSize() const;
116 | LPVOID GetData();
117 |
118 | LPVOID GetAt(int iIndex) const;
119 | LPVOID operator[] (int nIndex) const;
120 |
121 | protected:
122 | LPBYTE m_pVoid;
123 | int m_iElementSize;
124 | int m_nCount;
125 | int m_nAllocated;
126 | };
127 |
128 |
129 | /////////////////////////////////////////////////////////////////////////////////////
130 | //
131 |
132 | class UILIB_API CDuiString
133 | {
134 | public:
135 | enum { MAX_LOCAL_STRING_LEN = 63 };
136 |
137 | CDuiString();
138 | CDuiString(const TCHAR ch);
139 | CDuiString(const CDuiString& src);
140 | CDuiString(LPCTSTR lpsz, int nLen = -1);
141 | ~CDuiString();
142 |
143 | void Empty();
144 | int GetLength() const;
145 | bool IsEmpty() const;
146 | TCHAR GetAt(int nIndex) const;
147 | void Append(LPCTSTR pstr);
148 | void Assign(LPCTSTR pstr, int nLength = -1);
149 | LPCTSTR GetData() const;
150 |
151 | void SetAt(int nIndex, TCHAR ch);
152 | operator LPCTSTR() const;
153 |
154 | TCHAR operator[] (int nIndex) const;
155 | const CDuiString& operator=(const CDuiString& src);
156 | const CDuiString& operator=(const TCHAR ch);
157 | const CDuiString& operator=(LPCTSTR pstr);
158 | #ifdef _UNICODE
159 | const CDuiString& CDuiString::operator=(LPCSTR lpStr);
160 | const CDuiString& CDuiString::operator+=(LPCSTR lpStr);
161 | #else
162 | const CDuiString& CDuiString::operator=(LPCWSTR lpwStr);
163 | const CDuiString& CDuiString::operator+=(LPCWSTR lpwStr);
164 | #endif
165 | CDuiString operator+(const CDuiString& src) const;
166 | CDuiString operator+(LPCTSTR pstr) const;
167 | const CDuiString& operator+=(const CDuiString& src);
168 | const CDuiString& operator+=(LPCTSTR pstr);
169 | const CDuiString& operator+=(const TCHAR ch);
170 |
171 | bool operator == (LPCTSTR str) const;
172 | bool operator != (LPCTSTR str) const;
173 | bool operator <= (LPCTSTR str) const;
174 | bool operator < (LPCTSTR str) const;
175 | bool operator >= (LPCTSTR str) const;
176 | bool operator > (LPCTSTR str) const;
177 |
178 | int Compare(LPCTSTR pstr) const;
179 | int CompareNoCase(LPCTSTR pstr) const;
180 |
181 | void MakeUpper();
182 | void MakeLower();
183 |
184 | CDuiString Left(int nLength) const;
185 | CDuiString Mid(int iPos, int nLength = -1) const;
186 | CDuiString Right(int nLength) const;
187 |
188 | int Find(TCHAR ch, int iPos = 0) const;
189 | int Find(LPCTSTR pstr, int iPos = 0) const;
190 | int ReverseFind(TCHAR ch) const;
191 | int Replace(LPCTSTR pstrFrom, LPCTSTR pstrTo);
192 |
193 | int __cdecl Format(LPCTSTR pstrFormat, ...);
194 | int __cdecl Format(LPCTSTR pstrFormat, va_list Args);
195 | int __cdecl SmallFormat(LPCTSTR pstrFormat, ...);
196 |
197 | protected:
198 | LPTSTR m_pstr;
199 | TCHAR m_szBuffer[MAX_LOCAL_STRING_LEN + 1];
200 | };
201 |
202 |
203 | /////////////////////////////////////////////////////////////////////////////////////
204 | //
205 |
206 | struct TITEM
207 | {
208 | CDuiString Key;
209 | LPVOID Data;
210 | struct TITEM* pPrev;
211 | struct TITEM* pNext;
212 | };
213 |
214 | class UILIB_API CStdStringPtrMap
215 | {
216 | public:
217 | CStdStringPtrMap(int nSize = 83);
218 | ~CStdStringPtrMap();
219 |
220 | void Resize(int nSize = 83);
221 | LPVOID Find(LPCTSTR key, bool optimize = true) const;
222 | bool Insert(LPCTSTR key, LPVOID pData);
223 | LPVOID Set(LPCTSTR key, LPVOID pData);
224 | bool Remove(LPCTSTR key);
225 | void RemoveAll();
226 | int GetSize() const;
227 | LPCTSTR GetAt(int iIndex) const;
228 | LPCTSTR operator[] (int nIndex) const;
229 |
230 | protected:
231 | TITEM** m_aT;
232 | int m_nBuckets;
233 | int m_nCount;
234 | };
235 |
236 | /////////////////////////////////////////////////////////////////////////////////////
237 | //
238 |
239 | class UILIB_API CWaitCursor
240 | {
241 | public:
242 | CWaitCursor();
243 | ~CWaitCursor();
244 |
245 | protected:
246 | HCURSOR m_hOrigCursor;
247 | };
248 |
249 | /////////////////////////////////////////////////////////////////////////////////////
250 | //
251 |
252 | class CVariant : public VARIANT
253 | {
254 | public:
255 | CVariant()
256 | {
257 | VariantInit(this);
258 | }
259 | CVariant(int i)
260 | {
261 | VariantInit(this);
262 | this->vt = VT_I4;
263 | this->intVal = i;
264 | }
265 | CVariant(float f)
266 | {
267 | VariantInit(this);
268 | this->vt = VT_R4;
269 | this->fltVal = f;
270 | }
271 | CVariant(LPOLESTR s)
272 | {
273 | VariantInit(this);
274 | this->vt = VT_BSTR;
275 | this->bstrVal = s;
276 | }
277 | CVariant(IDispatch *disp)
278 | {
279 | VariantInit(this);
280 | this->vt = VT_DISPATCH;
281 | this->pdispVal = disp;
282 | }
283 |
284 | ~CVariant()
285 | {
286 | VariantClear(this);
287 | }
288 | };
289 |
290 | }// namespace DuiLib
291 |
292 | #endif // __UTILS_H__
--------------------------------------------------------------------------------
/DuiLib/Utils/WebBrowserEventHandler.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/DuiLib/Utils/WebBrowserEventHandler.h
--------------------------------------------------------------------------------
/DuiLib/Utils/WinImplBase.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/DuiLib/Utils/WinImplBase.cpp
--------------------------------------------------------------------------------
/DuiLib/Utils/WinImplBase.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/DuiLib/Utils/WinImplBase.h
--------------------------------------------------------------------------------
/DuiLib/Utils/downloadmgr.h:
--------------------------------------------------------------------------------
1 |
2 | #pragma warning( disable: 4049 ) /* more than 64k source lines */
3 |
4 | /* this ALWAYS GENERATED file contains the definitions for the interfaces */
5 |
6 |
7 | /* File created by MIDL compiler version 5.03.0279 */
8 | /* at Mon Jul 23 17:42:46 2001
9 | */
10 | /* Compiler settings for downloadmgr.idl:
11 | Oicf (OptLev=i2), W1, Zp8, env=Win32 (32b run), ms_ext, c_ext
12 | error checks: allocation ref bounds_check enum stub_data
13 | VC __declspec() decoration level:
14 | __declspec(uuid()), __declspec(selectany), __declspec(novtable)
15 | DECLSPEC_UUID(), MIDL_INTERFACE()
16 | */
17 | //@@MIDL_FILE_HEADING( )
18 |
19 |
20 | /* verify that the version is high enough to compile this file*/
21 | #ifndef __REQUIRED_RPCNDR_H_VERSION__
22 | #define __REQUIRED_RPCNDR_H_VERSION__ 440
23 | #endif
24 |
25 | #include "rpc.h"
26 | #include "rpcndr.h"
27 |
28 | #ifndef __RPCNDR_H_VERSION__
29 | #error this stub requires an updated version of
30 | #endif // __RPCNDR_H_VERSION__
31 |
32 | #ifndef COM_NO_WINDOWS_H
33 | #include "windows.h"
34 | #include "ole2.h"
35 | #endif /*COM_NO_WINDOWS_H*/
36 |
37 | #ifndef __downloadmgr_h__
38 | #define __downloadmgr_h__
39 |
40 | /* Forward Declarations */
41 |
42 | #ifndef __IDownloadManager_FWD_DEFINED__
43 | #define __IDownloadManager_FWD_DEFINED__
44 | typedef interface IDownloadManager IDownloadManager;
45 | #endif /* __IDownloadManager_FWD_DEFINED__ */
46 |
47 |
48 | /* header files for imported files */
49 | #include "unknwn.h"
50 | #include "ocidl.h"
51 |
52 | #ifdef __cplusplus
53 | extern "C"{
54 | #endif
55 |
56 | void __RPC_FAR * __RPC_USER MIDL_user_allocate(size_t);
57 | void __RPC_USER MIDL_user_free( void __RPC_FAR * );
58 |
59 | /* interface __MIDL_itf_downloadmgr_0000 */
60 | /* [local] */
61 |
62 | //=--------------------------------------------------------------------------=
63 | // downloadmgr.h
64 | //=--------------------------------------------------------------------------=
65 | // (C) Copyright 2000 Microsoft Corporation. All Rights Reserved.
66 | //
67 | // THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
68 | // ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
69 | // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
70 | // PARTICULAR PURPOSE.
71 | //=--------------------------------------------------------------------------=
72 |
73 | #pragma comment(lib,"uuid.lib")
74 |
75 | //---------------------------------------------------------------------------=
76 | // Internet Explorer Download Manager Interfaces
77 |
78 | // --------------------------------------------------------------------------------
79 | // GUIDS
80 | // --------------------------------------------------------------------------------
81 | // {988934A4-064B-11D3-BB80-00104B35E7F9}
82 | DEFINE_GUID(IID_IDownloadManager, 0x988934a4, 0x064b, 0x11d3, 0xbb, 0x80, 0x0, 0x10, 0x4b, 0x35, 0xe7, 0xf9);
83 | #define SID_SDownloadManager IID_IDownloadManager
84 |
85 |
86 |
87 | extern RPC_IF_HANDLE __MIDL_itf_downloadmgr_0000_v0_0_c_ifspec;
88 | extern RPC_IF_HANDLE __MIDL_itf_downloadmgr_0000_v0_0_s_ifspec;
89 |
90 | #ifndef __IDownloadManager_INTERFACE_DEFINED__
91 | #define __IDownloadManager_INTERFACE_DEFINED__
92 |
93 | /* interface IDownloadManager */
94 | /* [local][unique][uuid][object][helpstring] */
95 |
96 |
97 | EXTERN_C const IID IID_IDownloadManager;
98 |
99 | #if defined(__cplusplus) && !defined(CINTERFACE)
100 |
101 | MIDL_INTERFACE("988934A4-064B-11D3-BB80-00104B35E7F9")
102 | IDownloadManager : public IUnknown
103 | {
104 | public:
105 | virtual HRESULT STDMETHODCALLTYPE Download(
106 | /* [in] */ IMoniker __RPC_FAR *pmk,
107 | /* [in] */ IBindCtx __RPC_FAR *pbc,
108 | /* [in] */ DWORD dwBindVerb,
109 | /* [in] */ LONG grfBINDF,
110 | /* [in] */ BINDINFO __RPC_FAR *pBindInfo,
111 | /* [in] */ LPCOLESTR pszHeaders,
112 | /* [in] */ LPCOLESTR pszRedir,
113 | /* [in] */ UINT uiCP) = 0;
114 |
115 | };
116 |
117 | #else /* C style interface */
118 |
119 | typedef struct IDownloadManagerVtbl
120 | {
121 | BEGIN_INTERFACE
122 |
123 | HRESULT ( STDMETHODCALLTYPE __RPC_FAR *QueryInterface )(
124 | IDownloadManager __RPC_FAR * This,
125 | /* [in] */ REFIID riid,
126 | /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject);
127 |
128 | ULONG ( STDMETHODCALLTYPE __RPC_FAR *AddRef )(
129 | IDownloadManager __RPC_FAR * This);
130 |
131 | ULONG ( STDMETHODCALLTYPE __RPC_FAR *Release )(
132 | IDownloadManager __RPC_FAR * This);
133 |
134 | HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Download )(
135 | IDownloadManager __RPC_FAR * This,
136 | /* [in] */ IMoniker __RPC_FAR *pmk,
137 | /* [in] */ IBindCtx __RPC_FAR *pbc,
138 | /* [in] */ DWORD dwBindVerb,
139 | /* [in] */ LONG grfBINDF,
140 | /* [in] */ BINDINFO __RPC_FAR *pBindInfo,
141 | /* [in] */ LPCOLESTR pszHeaders,
142 | /* [in] */ LPCOLESTR pszRedir,
143 | /* [in] */ UINT uiCP);
144 |
145 | END_INTERFACE
146 | } IDownloadManagerVtbl;
147 |
148 | interface IDownloadManager
149 | {
150 | CONST_VTBL struct IDownloadManagerVtbl __RPC_FAR *lpVtbl;
151 | };
152 |
153 |
154 |
155 | #ifdef COBJMACROS
156 |
157 |
158 | #define IDownloadManager_QueryInterface(This,riid,ppvObject) \
159 | (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
160 |
161 | #define IDownloadManager_AddRef(This) \
162 | (This)->lpVtbl -> AddRef(This)
163 |
164 | #define IDownloadManager_Release(This) \
165 | (This)->lpVtbl -> Release(This)
166 |
167 |
168 | #define IDownloadManager_Download(This,pmk,pbc,dwBindVerb,grfBINDF,pBindInfo,pszHeaders,pszRedir,uiCP) \
169 | (This)->lpVtbl -> Download(This,pmk,pbc,dwBindVerb,grfBINDF,pBindInfo,pszHeaders,pszRedir,uiCP)
170 |
171 | #endif /* COBJMACROS */
172 |
173 |
174 | #endif /* C style interface */
175 |
176 |
177 |
178 | HRESULT STDMETHODCALLTYPE IDownloadManager_Download_Proxy(
179 | IDownloadManager __RPC_FAR * This,
180 | /* [in] */ IMoniker __RPC_FAR *pmk,
181 | /* [in] */ IBindCtx __RPC_FAR *pbc,
182 | /* [in] */ DWORD dwBindVerb,
183 | /* [in] */ LONG grfBINDF,
184 | /* [in] */ BINDINFO __RPC_FAR *pBindInfo,
185 | /* [in] */ LPCOLESTR pszHeaders,
186 | /* [in] */ LPCOLESTR pszRedir,
187 | /* [in] */ UINT uiCP);
188 |
189 |
190 | void __RPC_STUB IDownloadManager_Download_Stub(
191 | IRpcStubBuffer *This,
192 | IRpcChannelBuffer *_pRpcChannelBuffer,
193 | PRPC_MESSAGE _pRpcMessage,
194 | DWORD *_pdwStubPhase);
195 |
196 |
197 |
198 | #endif /* __IDownloadManager_INTERFACE_DEFINED__ */
199 |
200 |
201 | /* Additional Prototypes for ALL interfaces */
202 |
203 | /* end of Additional Prototypes */
204 |
205 | #ifdef __cplusplus
206 | }
207 | #endif
208 |
209 | #endif
210 |
211 |
212 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # TIM 用duilib开发的仿腾讯TIM界面
2 |
3 | 做了登录和主界面(无具体功能)
4 |
5 | ###### 更多信息请访问 [cnygf.net](http://www.cnygf.net).
6 |
7 | ## 快速开始
8 | #### 下载和编译
9 | git clone https://github.com/cn-ygf/TIM.git
10 | 使用vs2013或其它版本打开sln 编译
11 |
12 |
13 | ### 感谢 [duilib](http://github.com/duilib/duilib).
14 | ### 感谢 [DuiLib_Redrain](https://github.com/redrains/DuiLib_Redrain).
15 |
16 | 
17 | 
18 | 
19 | 
--------------------------------------------------------------------------------
/TIM.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 2013
4 | VisualStudioVersion = 12.0.21005.1
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TIM", "TIM\TIM.vcxproj", "{5148408E-37CB-4E0B-870E-0439FD20AA02}"
7 | EndProject
8 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DuiLib", "DuiLib\DuiLib.vcxproj", "{E106ACD7-4E53-4AEE-942B-D0DD426DB34E}"
9 | EndProject
10 | Global
11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
12 | Debug|Win32 = Debug|Win32
13 | Release|Win32 = Release|Win32
14 | EndGlobalSection
15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
16 | {5148408E-37CB-4E0B-870E-0439FD20AA02}.Debug|Win32.ActiveCfg = Debug|Win32
17 | {5148408E-37CB-4E0B-870E-0439FD20AA02}.Debug|Win32.Build.0 = Debug|Win32
18 | {5148408E-37CB-4E0B-870E-0439FD20AA02}.Release|Win32.ActiveCfg = Release|Win32
19 | {5148408E-37CB-4E0B-870E-0439FD20AA02}.Release|Win32.Build.0 = Release|Win32
20 | {E106ACD7-4E53-4AEE-942B-D0DD426DB34E}.Debug|Win32.ActiveCfg = Debug|Win32
21 | {E106ACD7-4E53-4AEE-942B-D0DD426DB34E}.Debug|Win32.Build.0 = Debug|Win32
22 | {E106ACD7-4E53-4AEE-942B-D0DD426DB34E}.Release|Win32.ActiveCfg = Release|Win32
23 | {E106ACD7-4E53-4AEE-942B-D0DD426DB34E}.Release|Win32.Build.0 = Release|Win32
24 | EndGlobalSection
25 | GlobalSection(SolutionProperties) = preSolution
26 | HideSolutionNode = FALSE
27 | EndGlobalSection
28 | EndGlobal
29 |
--------------------------------------------------------------------------------
/TIM/ChatListItem.cpp:
--------------------------------------------------------------------------------
1 | #include "stdafx.h"
2 | #include "ChatListItem.h"
3 |
4 |
5 | CChatListItem::CChatListItem(CPaintManagerUI& paint_manager) :CListExItem(paint_manager, _T("chatlistitem.xml"))
6 | {
7 | }
8 |
9 |
10 | CChatListItem::~CChatListItem()
11 | {
12 | }
13 |
14 | void CChatListItem::UpdateData(BOOL b)
15 | {
16 | CListContainerElementUI *pListElement = GetListContainerElementUI();
17 | CHeadUI *pHead = (CHeadUI *)paint_manager_.FindSubControlByName(pListElement, _T("headbtn"));
18 | CLabelUI *pNickName = (CLabelUI *)paint_manager_.FindSubControlByName(pListElement, _T("nicktext"));
19 | CLabelUI *pTimeStr = (CLabelUI *)paint_manager_.FindSubControlByName(pListElement, _T("timetext"));
20 | CLabelUI *pMsg = (CLabelUI *)paint_manager_.FindSubControlByName(pListElement, _T("msgtext"));
21 | if (b)
22 | {
23 | pHead->SetBkImage(m_HeadPath);
24 | pNickName->SetText(m_NickName);
25 | pTimeStr->SetText(m_TimeStr);
26 | pMsg->SetText(m_Msg);
27 | }
28 | else
29 | {
30 | m_HeadPath = pHead->GetBkImage();
31 | m_NickName = pNickName->GetText();
32 | m_TimeStr = pTimeStr->GetText();
33 | m_Msg = pMsg->GetText();
34 | }
35 | }
36 |
37 | void CChatListItem::SetHeadPath(CDuiString str)
38 | {
39 | this->m_HeadPath = str;
40 | }
41 | void CChatListItem::SetNickName(CDuiString str)
42 | {
43 | this->m_NickName = str;
44 | }
45 | void CChatListItem::SetTimeStr(CDuiString str)
46 | {
47 | this->m_TimeStr = str;
48 | }
49 | void CChatListItem::SetMsg(CDuiString str)
50 | {
51 | this->m_Msg = str;
52 | }
53 | CDuiString CChatListItem::GetHeadPath()
54 | {
55 | return m_HeadPath;
56 | }
57 | CDuiString CChatListItem::GetNickName()
58 | {
59 | return m_NickName;
60 | }
61 | CDuiString CChatListItem::GetTimeStr()
62 | {
63 | return m_TimeStr;
64 | }
65 | CDuiString CChatListItem::GetMsg()
66 | {
67 | return m_Msg;
68 | }
--------------------------------------------------------------------------------
/TIM/ChatListItem.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | class CChatListItem :
4 | public CListExItem
5 | {
6 | public:
7 | CChatListItem(CPaintManagerUI& paint_manager);
8 | ~CChatListItem();
9 | private:
10 | CDuiString m_HeadPath;
11 | CDuiString m_NickName;
12 | CDuiString m_TimeStr;
13 | CDuiString m_Msg;
14 | public:
15 | void SetHeadPath(CDuiString str);
16 | void SetNickName(CDuiString str);
17 | void SetTimeStr(CDuiString str);
18 | void SetMsg(CDuiString str);
19 | CDuiString GetHeadPath();
20 | CDuiString GetNickName();
21 | CDuiString GetTimeStr();
22 | CDuiString GetMsg();
23 | virtual void UpdateData(BOOL b = TRUE);
24 | };
25 |
26 |
--------------------------------------------------------------------------------
/TIM/DuiLib.exp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/TIM/DuiLib.exp
--------------------------------------------------------------------------------
/TIM/DuiLib.lib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/TIM/DuiLib.lib
--------------------------------------------------------------------------------
/TIM/DuiLib_d.exp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/TIM/DuiLib_d.exp
--------------------------------------------------------------------------------
/TIM/DuiLib_d.lib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/TIM/DuiLib_d.lib
--------------------------------------------------------------------------------
/TIM/LoginFrame.cpp:
--------------------------------------------------------------------------------
1 | #include "stdafx.h"
2 | #include "LoginFrame.h"
3 | #include "MainFrame.h"
4 |
5 | CLoginFrame *m_pThis = NULL;
6 |
7 | CLoginFrame::CLoginFrame()
8 | {
9 | m_pThis = this;
10 | }
11 |
12 |
13 | CLoginFrame::~CLoginFrame()
14 | {
15 | }
16 |
17 |
18 | DUI_BEGIN_MESSAGE_MAP(CLoginFrame, WindowImplBase)
19 | DUI_ON_MSGTYPE(DUI_MSGTYPE_CLICK, OnClick)
20 | DUI_END_MESSAGE_MAP()
21 |
22 |
23 | CDuiString CLoginFrame::GetSkinFolder()
24 | {
25 | return _T("");
26 | }
27 |
28 | CDuiString CLoginFrame::GetSkinFile()
29 | {
30 | return _T("loginframe.xml");
31 | }
32 |
33 | LPCTSTR CLoginFrame::GetWindowClassName() const
34 | {
35 | return _T("DUILoginFrame");
36 | }
37 |
38 | UINT CLoginFrame::GetClassStyle() const
39 | {
40 | return CS_DBLCLKS;
41 | }
42 |
43 | LRESULT CLoginFrame::MessageHandler(UINT uMsg, WPARAM wParam, LPARAM lParam, bool& bHandled)
44 | {
45 | return WindowImplBase::MessageHandler(uMsg, wParam, lParam, bHandled);
46 | }
47 |
48 | CControlUI* CLoginFrame::CreateControl(LPCTSTR pstrClass)
49 | {
50 | return NULL;
51 | }
52 |
53 | void CLoginFrame::Notify(TNotifyUI& msg)
54 | {
55 | CDuiString SenderName = msg.pSender->GetName();
56 | if (msg.sType == _T("windowinit"))
57 | {
58 | CEditUI *pPasswordEdit = (CEditUI *)m_PaintManager.FindControl(_T("passwordedit"));
59 | pPasswordEdit->SetPasswordChar('*');
60 | }
61 | else if (msg.sType == _T("itemclick"))
62 | {
63 | }
64 | __super::Notify(msg);
65 | }
66 |
67 |
68 |
69 | void CLoginFrame::OnClick(TNotifyUI& msg)
70 | {
71 | CDuiString pSenderName = msg.pSender->GetName();
72 | if (pSenderName == _T("closebtn"))
73 | {
74 | PostQuitMessage(0);
75 | }
76 | else if (pSenderName == _T("minbtn"))
77 | {
78 | SendMessage(WM_SYSCOMMAND, SC_MINIMIZE, NULL);
79 | }
80 | else if (pSenderName == _T("maxbtn"))
81 | {
82 | SendMessage(WM_SYSCOMMAND, SC_MAXIMIZE, NULL);
83 | }
84 | else if (pSenderName == _T("restorebtn"))
85 | {
86 | SendMessage(WM_SYSCOMMAND, SC_RESTORE, NULL);
87 | }
88 | else if (pSenderName == _T("loginbtn"))
89 | {
90 | CEditUI *pUsernameEdit = (CEditUI *)m_PaintManager.FindControl(_T("usernameedit"));
91 | CEditUI *pPasswordEdit = (CEditUI *)m_PaintManager.FindControl(_T("passwordedit"));
92 | pMainFrame = new CMainFrame;
93 | pMainFrame->Create(NULL, _T("TIM"), UI_WNDSTYLE_FRAME, WS_EX_STATICEDGE | WS_EX_APPWINDOW);
94 | pMainFrame->CenterWindow();
95 | pMainFrame->ShowWindow();
96 | this->ShowWindow(SW_HIDE);
97 | }
98 | else if (pSenderName == _T("cancelbtn......"))
99 | {
100 | CTabLayoutUI *pTabLayout = (CTabLayoutUI *)m_PaintManager.FindControl(_T("tab_bar"));
101 | CHorizontalLayoutUI *pTitleLayout = (CHorizontalLayoutUI *)m_PaintManager.FindControl(_T("title_layout"));
102 | pTabLayout->SelectItem(0);
103 | pTitleLayout->SetFixedHeight(pTitleLayout->GetHeight() + 45);
104 | this->m_bIsInput = FALSE;
105 |
106 | }
107 | else if (pSenderName == _T("close2btn"))
108 | {
109 | CVerticalLayoutUI *pLoginResultLayout = (CVerticalLayoutUI *)m_PaintManager.FindControl(_T("loginresult_layout"));
110 | pLoginResultLayout->SetVisible(false);
111 |
112 | }
113 |
114 | }
--------------------------------------------------------------------------------
/TIM/LoginFrame.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | class CMainFrame;
4 |
5 | class CLoginFrame:
6 | public WindowImplBase
7 | {
8 | private:
9 | BOOL m_bIsInput = FALSE;
10 | public:
11 | CLoginFrame();
12 | ~CLoginFrame();
13 | virtual LPCTSTR GetWindowClassName() const;
14 | virtual UINT GetClassStyle() const;
15 | virtual CDuiString GetSkinFolder();
16 | virtual CDuiString GetSkinFile();
17 | virtual CControlUI* CreateControl(LPCTSTR pstrClass);
18 | virtual LRESULT MessageHandler(UINT uMsg, WPARAM wParam, LPARAM lParam, bool& bHandled);
19 | virtual void Notify(TNotifyUI& msg);
20 | DUI_DECLARE_MESSAGE_MAP()
21 | virtual void OnClick(TNotifyUI& msg);
22 | CMainFrame *pMainFrame;
23 | };
24 |
25 |
--------------------------------------------------------------------------------
/TIM/MainFrame.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/TIM/MainFrame.cpp
--------------------------------------------------------------------------------
/TIM/MainFrame.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | class CMainFrame :
4 | public WindowImplBase
5 | {
6 |
7 | public:
8 | CMainFrame();
9 | ~CMainFrame();
10 | virtual LPCTSTR GetWindowClassName() const;
11 | virtual UINT GetClassStyle() const;
12 | virtual CDuiString GetSkinFolder();
13 | virtual CDuiString GetSkinFile();
14 | virtual CControlUI* CreateControl(LPCTSTR pstrClass);
15 | virtual LRESULT MessageHandler(UINT uMsg, WPARAM wParam, LPARAM lParam, bool& bHandled);
16 | virtual void Notify(TNotifyUI& msg);
17 | DUI_DECLARE_MESSAGE_MAP()
18 | virtual void OnClick(TNotifyUI& msg);
19 | std::map m_MenuCheckInfo;
20 | void InitTestData();
21 |
22 | };
23 |
24 |
--------------------------------------------------------------------------------
/TIM/ReadMe.txt:
--------------------------------------------------------------------------------
1 | ========================================================================
2 | WIN32 应用程序:TIM 项目概述
3 | ========================================================================
4 |
5 | 应用程序向导已为您创建了此 TIM 应用程序。
6 |
7 | 本文件概要介绍组成 TIM 应用程序的每个文件的内容。
8 |
9 |
10 | TIM.vcxproj
11 | 这是使用应用程序向导生成的 VC++ 项目的主项目文件,其中包含生成该文件的 Visual C++ 的版本信息,以及有关使用应用程序向导选择的平台、配置和项目功能的信息。
12 |
13 | TIM.vcxproj.filters
14 | 这是使用“应用程序向导”生成的 VC++ 项目筛选器文件。它包含有关项目文件与筛选器之间的关联信息。在 IDE 中,通过这种关联,在特定节点下以分组形式显示具有相似扩展名的文件。例如,“.cpp”文件与“源文件”筛选器关联。
15 |
16 | TIM.cpp
17 | 这是主应用程序源文件。
18 |
19 | /////////////////////////////////////////////////////////////////////////////
20 | 应用程序向导创建了下列资源:
21 |
22 | TIM.rc
23 | 这是程序使用的所有 Microsoft Windows 资源的列表。它包括 RES 子目录中存储的图标、位图和光标。此文件可以直接在 Microsoft Visual C++ 中进行编辑。
24 |
25 | Resource.h
26 | 这是标准头文件,可用于定义新的资源 ID。Microsoft Visual C++ 将读取并更新此文件。
27 |
28 | TIM.ico
29 | 这是用作应用程序图标 (32x32) 的图标文件。此图标包括在主资源文件 TIM.rc 中。
30 |
31 | small.ico
32 | 这是一个图标文件,其中包含应用程序的图标的较小版本 (16x16)。此图标包括在主资源文件 TIM.rc 中。
33 |
34 | /////////////////////////////////////////////////////////////////////////////
35 | 其他标准文件:
36 |
37 | StdAfx.h, StdAfx.cpp
38 | 这些文件用于生成名为 TIM.pch 的预编译头 (PCH) 文件和名为 StdAfx.obj 的预编译类型文件。
39 |
40 | /////////////////////////////////////////////////////////////////////////////
41 | 其他注释:
42 |
43 | 应用程序向导使用“TODO:”注释来指示应添加或自定义的源代码部分。
44 |
45 | /////////////////////////////////////////////////////////////////////////////
46 |
--------------------------------------------------------------------------------
/TIM/Resource.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/TIM/Resource.h
--------------------------------------------------------------------------------
/TIM/TIM.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/TIM/TIM.cpp
--------------------------------------------------------------------------------
/TIM/TIM.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "resource.h"
4 |
--------------------------------------------------------------------------------
/TIM/TIM.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/TIM/TIM.ico
--------------------------------------------------------------------------------
/TIM/TIM.rc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/TIM/TIM.rc
--------------------------------------------------------------------------------
/TIM/TIM.vcxproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | Win32
7 |
8 |
9 | Release
10 | Win32
11 |
12 |
13 |
14 | {5148408E-37CB-4E0B-870E-0439FD20AA02}
15 | Win32Proj
16 | TIM
17 |
18 |
19 |
20 | Application
21 | true
22 | v120
23 | Unicode
24 |
25 |
26 | Application
27 | false
28 | v120_xp
29 | true
30 | Unicode
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 | true
44 | ..\Bin
45 | $(ProjectName)_d
46 |
47 |
48 | false
49 | ..\Bin
50 |
51 |
52 |
53 | Use
54 | Level3
55 | Disabled
56 | WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)
57 | true
58 |
59 |
60 | Windows
61 | true
62 | DuiLib_d.lib;%(AdditionalDependencies)
63 |
64 |
65 |
66 |
67 | Level3
68 | Use
69 | MaxSpeed
70 | true
71 | true
72 | WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)
73 | true
74 |
75 |
76 | Windows
77 | true
78 | true
79 | true
80 | DuiLib.lib;%(AdditionalDependencies)
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 | Create
101 | Create
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
--------------------------------------------------------------------------------
/TIM/TIM.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
7 |
8 |
9 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
10 | h;hh;hpp;hxx;hm;inl;inc;xsd
11 |
12 |
13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 | 头文件
23 |
24 |
25 | 头文件
26 |
27 |
28 | 头文件
29 |
30 |
31 | 头文件
32 |
33 |
34 | 头文件
35 |
36 |
37 | 头文件
38 |
39 |
40 | 头文件
41 |
42 |
43 |
44 |
45 | 源文件
46 |
47 |
48 | 源文件
49 |
50 |
51 | 源文件
52 |
53 |
54 | 源文件
55 |
56 |
57 | 源文件
58 |
59 |
60 |
61 |
62 | 资源文件
63 |
64 |
65 |
66 |
67 | 资源文件
68 |
69 |
70 | 资源文件
71 |
72 |
73 |
--------------------------------------------------------------------------------
/TIM/TIM.vcxproj.user:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | ..\Bin
5 | WindowsLocalDebugger
6 |
7 |
--------------------------------------------------------------------------------
/TIM/small.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/TIM/small.ico
--------------------------------------------------------------------------------
/TIM/stdafx.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/TIM/stdafx.cpp
--------------------------------------------------------------------------------
/TIM/stdafx.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/TIM/stdafx.h
--------------------------------------------------------------------------------
/TIM/targetver.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cn-ygf/TIM/7fe90cf525f76dca7ed7cbd96bc2a17fc58d83b7/TIM/targetver.h
--------------------------------------------------------------------------------
/directui license.txt:
--------------------------------------------------------------------------------
1 | DirectUI - UI Library
2 |
3 | Written by Bjarke Viksoe (bjarke@viksoe.dk)
4 | Copyright (c) 2006-2007 Bjarke Viksoe.
5 |
6 | This code may be used in compiled form in any way you desire. These
7 | source files may be redistributed by any means PROVIDING it is
8 | not sold for profit without the authors written consent, and
9 | providing that this notice and the authors name is included.
10 |
11 | This file is provided "as is" with no expressed or implied warranty.
12 | The author accepts no liability if it causes any damage to you or your
13 | computer whatsoever. It's free, so don't hassle me about it.
14 | Beware of bugs.
--------------------------------------------------------------------------------
/duilib license.txt:
--------------------------------------------------------------------------------
1 | Copyright (c) 2010-2011, duilib develop team(www.duilib.com).All rights reserved.
2 |
3 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met.
4 |
5 | Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
6 |
7 | Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
8 |
9 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
10 |
--------------------------------------------------------------------------------