├── qyplayer
├── main.cpp
├── qyplayer.layout
└── qyplayer.cbp
├── snapshots
├── 1.png
├── 2.jpg
└── 3.jpg
├── gtkduilib
├── UIList.h
├── UIControl.h
├── UIDefine.h
├── UIList.cpp
├── UIRender.cpp
├── UIWindow.cpp
├── UIWindow.h
├── NotifyPump.cpp
├── ResourceMgr.h
├── UIContainer.h
├── UITabLayout.h
├── UITileLayout.h
├── DialogBuilder.cpp
├── UIChildLayout.h
├── UIContainer.cpp
├── UIScrollBar.cpp
├── UITileLayout.cpp
├── WindowImpBase.cpp
├── WindowImpBase.h
├── UIVerticalLayout.h
├── UIHorizontalLayout.cpp
├── UIHorizontalLayout.h
├── UIVerticalLayout.cpp
├── UIEvent.cpp
├── stdafx.cpp
├── stdafx.h
├── NotifyPump.h
├── UIText.h
├── DialogBuilder.h
├── UIFont.h
├── UIProgress.h
├── UILib.h
├── UILabel.h
├── ReadMe.txt
├── UISlider.h
├── UIEvent.h
├── UIOption.h
├── UIChildLayout.cpp
├── UIButton.h
├── UIRef.h
├── UIRender.h
├── UIFont.cpp
├── UIUtils.h
├── pugiconfig.hpp
├── UIString.h
├── UIText.cpp
├── UIProgress.cpp
├── gtkduilib.cbp
├── UIScrollBar.h
├── compat.h
├── UITabLayout.cpp
├── UILabel.cpp
├── ResourceMgr.cpp
├── gtkduilib.layout
├── UIOption.cpp
├── UISlider.cpp
└── gtkduilib.vcproj
├── skin
├── qyplayer
│ ├── logo.png
│ ├── scroll.png
│ ├── theme.jpg
│ ├── SliderBg.png
│ ├── btn_close.png
│ ├── btn_mini.png
│ ├── btn_play.png
│ ├── btn_skin.png
│ ├── logo_text.png
│ ├── slider_bg.png
│ ├── btn_setting.png
│ ├── btn_volume.png
│ ├── main_title.png
│ ├── thumb_down.png
│ ├── thumb_over.png
│ ├── HSliderChannel.png
│ ├── album_frame_bg.png
│ ├── btn_minimize.png
│ ├── btn_play_next.png
│ ├── btn_play_prev.png
│ ├── play_slider_bg.png
│ ├── slider_value.png
│ ├── thumb_normal.png
│ ├── list_header_sep.png
│ ├── btn_play_mode_next.png
│ ├── btn_play_mode_rand.png
│ ├── play_slider_bg_fix.png
│ ├── play_slider_cache.png
│ ├── play_slider_thumb.png
│ ├── play_slider_thumb_1.png
│ ├── play_slider_value.png
│ ├── play_slider_value2.png
│ ├── song_list_title_bg.png
│ ├── btn_play_mode_circle.png
│ ├── btn_play_mode_single.png
│ ├── common_scroll_thumb_mask.png
│ ├── play_slider_value2_fix.png
│ ├── song_list_title_btn_bg.png
│ ├── volume_slider_thumb_mini.png
│ ├── play_slider_thumb_animate.png
│ ├── btn_play_mode_single_circle.png
│ ├── play_slider_thumb_animate_1.png
│ ├── 7CA3EE8F40384DC0C6FB2ACF69EE9AD9.jpg
│ ├── qyplayer.uiproj
│ ├── music_list.xml
│ ├── test1.xml
│ ├── PlayerMain1.xml
│ ├── PlayerMain.xml
│ └── PlayerMain2.xml
└── 360SafeRes
│ ├── icon.ico
│ ├── icon.png
│ ├── logo.png
│ ├── cloud.png
│ ├── commmon.png
│ ├── start.png
│ ├── antivirus.png
│ ├── firewall.png
│ ├── scrollbar.bmp
│ ├── button_hover.png
│ ├── firewall_ok.png
│ ├── scanbutton.png
│ ├── sys_dlg_max.png
│ ├── sys_dlg_menu.png
│ ├── sys_dlg_min.png
│ ├── tabbar_hover.png
│ ├── button_normal.png
│ ├── button_pushed.png
│ ├── navigationbar.bmp
│ ├── networkshield.png
│ ├── preventnumber.png
│ ├── sys_dlg_close.png
│ ├── tabbar_normal.png
│ ├── tabbar_pushed.png
│ ├── toolbar_hover.png
│ ├── toolbar_normal.png
│ ├── toolbar_pushed.png
│ ├── horizontal_border.bmp
│ ├── softwaremanager.png
│ ├── sys_dlg_restore.png
│ ├── vertical_border.bmp
│ ├── examine_background.bmp
│ ├── ComputerExamine.xml
│ └── ComputerExamine2.xml
├── gtkduilib_test
├── stdafx.cpp
├── stdafx.h
├── targetver.h
├── gtkduilib_test.layout
├── ReadMe.txt
├── gtkduilib_test.cbp
├── gtkduilib_test.vcproj
└── gtkduilib_test.cpp
├── gtkduilib.workspace
├── 360Demo
├── 360Demo.layout
├── 360Demo.cbp
└── main.cpp
├── README.md
├── gtkduilib.workspace.layout
├── gtkduilib.sln
└── .gitignore
/qyplayer/main.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/progmboy/gtkduilib/HEAD/qyplayer/main.cpp
--------------------------------------------------------------------------------
/snapshots/1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/progmboy/gtkduilib/HEAD/snapshots/1.png
--------------------------------------------------------------------------------
/snapshots/2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/progmboy/gtkduilib/HEAD/snapshots/2.jpg
--------------------------------------------------------------------------------
/snapshots/3.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/progmboy/gtkduilib/HEAD/snapshots/3.jpg
--------------------------------------------------------------------------------
/gtkduilib/UIList.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/progmboy/gtkduilib/HEAD/gtkduilib/UIList.h
--------------------------------------------------------------------------------
/gtkduilib/UIControl.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/progmboy/gtkduilib/HEAD/gtkduilib/UIControl.h
--------------------------------------------------------------------------------
/gtkduilib/UIDefine.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/progmboy/gtkduilib/HEAD/gtkduilib/UIDefine.h
--------------------------------------------------------------------------------
/gtkduilib/UIList.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/progmboy/gtkduilib/HEAD/gtkduilib/UIList.cpp
--------------------------------------------------------------------------------
/gtkduilib/UIRender.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/progmboy/gtkduilib/HEAD/gtkduilib/UIRender.cpp
--------------------------------------------------------------------------------
/gtkduilib/UIWindow.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/progmboy/gtkduilib/HEAD/gtkduilib/UIWindow.cpp
--------------------------------------------------------------------------------
/gtkduilib/UIWindow.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/progmboy/gtkduilib/HEAD/gtkduilib/UIWindow.h
--------------------------------------------------------------------------------
/skin/qyplayer/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/progmboy/gtkduilib/HEAD/skin/qyplayer/logo.png
--------------------------------------------------------------------------------
/gtkduilib/NotifyPump.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/progmboy/gtkduilib/HEAD/gtkduilib/NotifyPump.cpp
--------------------------------------------------------------------------------
/gtkduilib/ResourceMgr.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/progmboy/gtkduilib/HEAD/gtkduilib/ResourceMgr.h
--------------------------------------------------------------------------------
/gtkduilib/UIContainer.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/progmboy/gtkduilib/HEAD/gtkduilib/UIContainer.h
--------------------------------------------------------------------------------
/gtkduilib/UITabLayout.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/progmboy/gtkduilib/HEAD/gtkduilib/UITabLayout.h
--------------------------------------------------------------------------------
/gtkduilib/UITileLayout.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/progmboy/gtkduilib/HEAD/gtkduilib/UITileLayout.h
--------------------------------------------------------------------------------
/skin/360SafeRes/icon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/progmboy/gtkduilib/HEAD/skin/360SafeRes/icon.ico
--------------------------------------------------------------------------------
/skin/360SafeRes/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/progmboy/gtkduilib/HEAD/skin/360SafeRes/icon.png
--------------------------------------------------------------------------------
/skin/360SafeRes/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/progmboy/gtkduilib/HEAD/skin/360SafeRes/logo.png
--------------------------------------------------------------------------------
/skin/qyplayer/scroll.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/progmboy/gtkduilib/HEAD/skin/qyplayer/scroll.png
--------------------------------------------------------------------------------
/skin/qyplayer/theme.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/progmboy/gtkduilib/HEAD/skin/qyplayer/theme.jpg
--------------------------------------------------------------------------------
/gtkduilib/DialogBuilder.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/progmboy/gtkduilib/HEAD/gtkduilib/DialogBuilder.cpp
--------------------------------------------------------------------------------
/gtkduilib/UIChildLayout.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/progmboy/gtkduilib/HEAD/gtkduilib/UIChildLayout.h
--------------------------------------------------------------------------------
/gtkduilib/UIContainer.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/progmboy/gtkduilib/HEAD/gtkduilib/UIContainer.cpp
--------------------------------------------------------------------------------
/gtkduilib/UIScrollBar.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/progmboy/gtkduilib/HEAD/gtkduilib/UIScrollBar.cpp
--------------------------------------------------------------------------------
/gtkduilib/UITileLayout.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/progmboy/gtkduilib/HEAD/gtkduilib/UITileLayout.cpp
--------------------------------------------------------------------------------
/gtkduilib/WindowImpBase.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/progmboy/gtkduilib/HEAD/gtkduilib/WindowImpBase.cpp
--------------------------------------------------------------------------------
/gtkduilib/WindowImpBase.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/progmboy/gtkduilib/HEAD/gtkduilib/WindowImpBase.h
--------------------------------------------------------------------------------
/skin/360SafeRes/cloud.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/progmboy/gtkduilib/HEAD/skin/360SafeRes/cloud.png
--------------------------------------------------------------------------------
/skin/360SafeRes/commmon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/progmboy/gtkduilib/HEAD/skin/360SafeRes/commmon.png
--------------------------------------------------------------------------------
/skin/360SafeRes/start.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/progmboy/gtkduilib/HEAD/skin/360SafeRes/start.png
--------------------------------------------------------------------------------
/skin/qyplayer/SliderBg.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/progmboy/gtkduilib/HEAD/skin/qyplayer/SliderBg.png
--------------------------------------------------------------------------------
/skin/qyplayer/btn_close.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/progmboy/gtkduilib/HEAD/skin/qyplayer/btn_close.png
--------------------------------------------------------------------------------
/skin/qyplayer/btn_mini.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/progmboy/gtkduilib/HEAD/skin/qyplayer/btn_mini.png
--------------------------------------------------------------------------------
/skin/qyplayer/btn_play.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/progmboy/gtkduilib/HEAD/skin/qyplayer/btn_play.png
--------------------------------------------------------------------------------
/skin/qyplayer/btn_skin.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/progmboy/gtkduilib/HEAD/skin/qyplayer/btn_skin.png
--------------------------------------------------------------------------------
/skin/qyplayer/logo_text.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/progmboy/gtkduilib/HEAD/skin/qyplayer/logo_text.png
--------------------------------------------------------------------------------
/skin/qyplayer/slider_bg.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/progmboy/gtkduilib/HEAD/skin/qyplayer/slider_bg.png
--------------------------------------------------------------------------------
/gtkduilib/UIVerticalLayout.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/progmboy/gtkduilib/HEAD/gtkduilib/UIVerticalLayout.h
--------------------------------------------------------------------------------
/skin/360SafeRes/antivirus.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/progmboy/gtkduilib/HEAD/skin/360SafeRes/antivirus.png
--------------------------------------------------------------------------------
/skin/360SafeRes/firewall.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/progmboy/gtkduilib/HEAD/skin/360SafeRes/firewall.png
--------------------------------------------------------------------------------
/skin/360SafeRes/scrollbar.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/progmboy/gtkduilib/HEAD/skin/360SafeRes/scrollbar.bmp
--------------------------------------------------------------------------------
/skin/qyplayer/btn_setting.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/progmboy/gtkduilib/HEAD/skin/qyplayer/btn_setting.png
--------------------------------------------------------------------------------
/skin/qyplayer/btn_volume.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/progmboy/gtkduilib/HEAD/skin/qyplayer/btn_volume.png
--------------------------------------------------------------------------------
/skin/qyplayer/main_title.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/progmboy/gtkduilib/HEAD/skin/qyplayer/main_title.png
--------------------------------------------------------------------------------
/skin/qyplayer/thumb_down.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/progmboy/gtkduilib/HEAD/skin/qyplayer/thumb_down.png
--------------------------------------------------------------------------------
/skin/qyplayer/thumb_over.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/progmboy/gtkduilib/HEAD/skin/qyplayer/thumb_over.png
--------------------------------------------------------------------------------
/gtkduilib/UIHorizontalLayout.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/progmboy/gtkduilib/HEAD/gtkduilib/UIHorizontalLayout.cpp
--------------------------------------------------------------------------------
/gtkduilib/UIHorizontalLayout.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/progmboy/gtkduilib/HEAD/gtkduilib/UIHorizontalLayout.h
--------------------------------------------------------------------------------
/gtkduilib/UIVerticalLayout.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/progmboy/gtkduilib/HEAD/gtkduilib/UIVerticalLayout.cpp
--------------------------------------------------------------------------------
/skin/360SafeRes/button_hover.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/progmboy/gtkduilib/HEAD/skin/360SafeRes/button_hover.png
--------------------------------------------------------------------------------
/skin/360SafeRes/firewall_ok.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/progmboy/gtkduilib/HEAD/skin/360SafeRes/firewall_ok.png
--------------------------------------------------------------------------------
/skin/360SafeRes/scanbutton.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/progmboy/gtkduilib/HEAD/skin/360SafeRes/scanbutton.png
--------------------------------------------------------------------------------
/skin/360SafeRes/sys_dlg_max.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/progmboy/gtkduilib/HEAD/skin/360SafeRes/sys_dlg_max.png
--------------------------------------------------------------------------------
/skin/360SafeRes/sys_dlg_menu.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/progmboy/gtkduilib/HEAD/skin/360SafeRes/sys_dlg_menu.png
--------------------------------------------------------------------------------
/skin/360SafeRes/sys_dlg_min.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/progmboy/gtkduilib/HEAD/skin/360SafeRes/sys_dlg_min.png
--------------------------------------------------------------------------------
/skin/360SafeRes/tabbar_hover.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/progmboy/gtkduilib/HEAD/skin/360SafeRes/tabbar_hover.png
--------------------------------------------------------------------------------
/skin/qyplayer/HSliderChannel.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/progmboy/gtkduilib/HEAD/skin/qyplayer/HSliderChannel.png
--------------------------------------------------------------------------------
/skin/qyplayer/album_frame_bg.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/progmboy/gtkduilib/HEAD/skin/qyplayer/album_frame_bg.png
--------------------------------------------------------------------------------
/skin/qyplayer/btn_minimize.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/progmboy/gtkduilib/HEAD/skin/qyplayer/btn_minimize.png
--------------------------------------------------------------------------------
/skin/qyplayer/btn_play_next.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/progmboy/gtkduilib/HEAD/skin/qyplayer/btn_play_next.png
--------------------------------------------------------------------------------
/skin/qyplayer/btn_play_prev.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/progmboy/gtkduilib/HEAD/skin/qyplayer/btn_play_prev.png
--------------------------------------------------------------------------------
/skin/qyplayer/play_slider_bg.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/progmboy/gtkduilib/HEAD/skin/qyplayer/play_slider_bg.png
--------------------------------------------------------------------------------
/skin/qyplayer/slider_value.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/progmboy/gtkduilib/HEAD/skin/qyplayer/slider_value.png
--------------------------------------------------------------------------------
/skin/qyplayer/thumb_normal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/progmboy/gtkduilib/HEAD/skin/qyplayer/thumb_normal.png
--------------------------------------------------------------------------------
/skin/360SafeRes/button_normal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/progmboy/gtkduilib/HEAD/skin/360SafeRes/button_normal.png
--------------------------------------------------------------------------------
/skin/360SafeRes/button_pushed.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/progmboy/gtkduilib/HEAD/skin/360SafeRes/button_pushed.png
--------------------------------------------------------------------------------
/skin/360SafeRes/navigationbar.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/progmboy/gtkduilib/HEAD/skin/360SafeRes/navigationbar.bmp
--------------------------------------------------------------------------------
/skin/360SafeRes/networkshield.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/progmboy/gtkduilib/HEAD/skin/360SafeRes/networkshield.png
--------------------------------------------------------------------------------
/skin/360SafeRes/preventnumber.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/progmboy/gtkduilib/HEAD/skin/360SafeRes/preventnumber.png
--------------------------------------------------------------------------------
/skin/360SafeRes/sys_dlg_close.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/progmboy/gtkduilib/HEAD/skin/360SafeRes/sys_dlg_close.png
--------------------------------------------------------------------------------
/skin/360SafeRes/tabbar_normal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/progmboy/gtkduilib/HEAD/skin/360SafeRes/tabbar_normal.png
--------------------------------------------------------------------------------
/skin/360SafeRes/tabbar_pushed.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/progmboy/gtkduilib/HEAD/skin/360SafeRes/tabbar_pushed.png
--------------------------------------------------------------------------------
/skin/360SafeRes/toolbar_hover.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/progmboy/gtkduilib/HEAD/skin/360SafeRes/toolbar_hover.png
--------------------------------------------------------------------------------
/skin/360SafeRes/toolbar_normal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/progmboy/gtkduilib/HEAD/skin/360SafeRes/toolbar_normal.png
--------------------------------------------------------------------------------
/skin/360SafeRes/toolbar_pushed.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/progmboy/gtkduilib/HEAD/skin/360SafeRes/toolbar_pushed.png
--------------------------------------------------------------------------------
/skin/qyplayer/list_header_sep.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/progmboy/gtkduilib/HEAD/skin/qyplayer/list_header_sep.png
--------------------------------------------------------------------------------
/skin/360SafeRes/horizontal_border.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/progmboy/gtkduilib/HEAD/skin/360SafeRes/horizontal_border.bmp
--------------------------------------------------------------------------------
/skin/360SafeRes/softwaremanager.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/progmboy/gtkduilib/HEAD/skin/360SafeRes/softwaremanager.png
--------------------------------------------------------------------------------
/skin/360SafeRes/sys_dlg_restore.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/progmboy/gtkduilib/HEAD/skin/360SafeRes/sys_dlg_restore.png
--------------------------------------------------------------------------------
/skin/360SafeRes/vertical_border.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/progmboy/gtkduilib/HEAD/skin/360SafeRes/vertical_border.bmp
--------------------------------------------------------------------------------
/skin/qyplayer/btn_play_mode_next.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/progmboy/gtkduilib/HEAD/skin/qyplayer/btn_play_mode_next.png
--------------------------------------------------------------------------------
/skin/qyplayer/btn_play_mode_rand.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/progmboy/gtkduilib/HEAD/skin/qyplayer/btn_play_mode_rand.png
--------------------------------------------------------------------------------
/skin/qyplayer/play_slider_bg_fix.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/progmboy/gtkduilib/HEAD/skin/qyplayer/play_slider_bg_fix.png
--------------------------------------------------------------------------------
/skin/qyplayer/play_slider_cache.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/progmboy/gtkduilib/HEAD/skin/qyplayer/play_slider_cache.png
--------------------------------------------------------------------------------
/skin/qyplayer/play_slider_thumb.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/progmboy/gtkduilib/HEAD/skin/qyplayer/play_slider_thumb.png
--------------------------------------------------------------------------------
/skin/qyplayer/play_slider_thumb_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/progmboy/gtkduilib/HEAD/skin/qyplayer/play_slider_thumb_1.png
--------------------------------------------------------------------------------
/skin/qyplayer/play_slider_value.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/progmboy/gtkduilib/HEAD/skin/qyplayer/play_slider_value.png
--------------------------------------------------------------------------------
/skin/qyplayer/play_slider_value2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/progmboy/gtkduilib/HEAD/skin/qyplayer/play_slider_value2.png
--------------------------------------------------------------------------------
/skin/qyplayer/song_list_title_bg.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/progmboy/gtkduilib/HEAD/skin/qyplayer/song_list_title_bg.png
--------------------------------------------------------------------------------
/skin/360SafeRes/examine_background.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/progmboy/gtkduilib/HEAD/skin/360SafeRes/examine_background.bmp
--------------------------------------------------------------------------------
/skin/qyplayer/btn_play_mode_circle.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/progmboy/gtkduilib/HEAD/skin/qyplayer/btn_play_mode_circle.png
--------------------------------------------------------------------------------
/skin/qyplayer/btn_play_mode_single.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/progmboy/gtkduilib/HEAD/skin/qyplayer/btn_play_mode_single.png
--------------------------------------------------------------------------------
/skin/qyplayer/common_scroll_thumb_mask.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/progmboy/gtkduilib/HEAD/skin/qyplayer/common_scroll_thumb_mask.png
--------------------------------------------------------------------------------
/skin/qyplayer/play_slider_value2_fix.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/progmboy/gtkduilib/HEAD/skin/qyplayer/play_slider_value2_fix.png
--------------------------------------------------------------------------------
/skin/qyplayer/song_list_title_btn_bg.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/progmboy/gtkduilib/HEAD/skin/qyplayer/song_list_title_btn_bg.png
--------------------------------------------------------------------------------
/skin/qyplayer/volume_slider_thumb_mini.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/progmboy/gtkduilib/HEAD/skin/qyplayer/volume_slider_thumb_mini.png
--------------------------------------------------------------------------------
/skin/qyplayer/play_slider_thumb_animate.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/progmboy/gtkduilib/HEAD/skin/qyplayer/play_slider_thumb_animate.png
--------------------------------------------------------------------------------
/skin/qyplayer/btn_play_mode_single_circle.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/progmboy/gtkduilib/HEAD/skin/qyplayer/btn_play_mode_single_circle.png
--------------------------------------------------------------------------------
/skin/qyplayer/play_slider_thumb_animate_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/progmboy/gtkduilib/HEAD/skin/qyplayer/play_slider_thumb_animate_1.png
--------------------------------------------------------------------------------
/skin/qyplayer/7CA3EE8F40384DC0C6FB2ACF69EE9AD9.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/progmboy/gtkduilib/HEAD/skin/qyplayer/7CA3EE8F40384DC0C6FB2ACF69EE9AD9.jpg
--------------------------------------------------------------------------------
/gtkduilib/UIEvent.cpp:
--------------------------------------------------------------------------------
1 | #include "stdafx.h"
2 | #include "UIEvent.h"
3 |
4 | CUIEvent::CUIEvent(void)
5 | {
6 | }
7 |
8 | CUIEvent::~CUIEvent(void)
9 | {
10 | }
11 |
--------------------------------------------------------------------------------
/skin/qyplayer/qyplayer.uiproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/gtkduilib/stdafx.cpp:
--------------------------------------------------------------------------------
1 | // stdafx.cpp : source file that includes just the standard includes
2 | // gtkduilib.pch will be the pre-compiled header
3 | // stdafx.obj will contain the pre-compiled type information
4 |
5 | #include "stdafx.h"
6 |
7 | // TODO: reference any additional headers you need in STDAFX.H
8 | // and not in this file
9 |
--------------------------------------------------------------------------------
/gtkduilib_test/stdafx.cpp:
--------------------------------------------------------------------------------
1 | // stdafx.cpp : source file that includes just the standard includes
2 | // gtkduilib_test.pch will be the pre-compiled header
3 | // stdafx.obj will contain the pre-compiled type information
4 |
5 | #include "stdafx.h"
6 |
7 | // TODO: reference any additional headers you need in STDAFX.H
8 | // and not in this file
9 |
--------------------------------------------------------------------------------
/gtkduilib/stdafx.h:
--------------------------------------------------------------------------------
1 | // stdafx.h : include file for standard system include files,
2 | // or project specific include files that are used frequently, but
3 | // are changed infrequently
4 | //
5 |
6 | #ifndef __STDAFX__H__
7 | #define __STDAFX__H__
8 |
9 | #define WIN32_LEAN_AND_MEAN
10 |
11 | #define NOTHING
12 |
13 | #include "UILib.h"
14 |
15 | #endif
16 |
17 |
--------------------------------------------------------------------------------
/gtkduilib_test/stdafx.h:
--------------------------------------------------------------------------------
1 | // stdafx.h : include file for standard system include files,
2 | // or project specific include files that are used frequently, but
3 | // are changed infrequently
4 | //
5 |
6 | #pragma once
7 |
8 | //#include "targetver.h"
9 |
10 | #include
11 |
12 |
13 |
14 | // TODO: reference additional headers your program requires here
15 |
--------------------------------------------------------------------------------
/gtkduilib.workspace:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/gtkduilib/NotifyPump.h:
--------------------------------------------------------------------------------
1 | #ifndef __NOTIFYPUMP__H__
2 | #define __NOTIFYPUMP__H__
3 |
4 | class CNotifyPump
5 | {
6 | public:
7 | CNotifyPump(void);
8 | virtual ~CNotifyPump(void);
9 | public:
10 | bool AddVirtualWnd(CUIString strName, CNotifyPump* pObject);
11 | bool RemoveVirtualWnd(CUIString strName);
12 | void NotifyPump(TNotifyUI& msg);
13 | bool LoopDispatch(TNotifyUI& msg);
14 | DUI_DECLARE_MESSAGE_MAP()
15 | private:
16 | CStdStringPtrMap m_VirtualWndMap;
17 | };
18 |
19 | #endif
20 |
21 |
--------------------------------------------------------------------------------
/skin/qyplayer/music_list.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/gtkduilib/UIText.h:
--------------------------------------------------------------------------------
1 | #ifndef __UITEXT_H__
2 | #define __UITEXT_H__
3 |
4 | class CUIText : public CUILabel
5 | {
6 | public:
7 | CUIText();
8 | ~CUIText();
9 |
10 | CUIString GetClass() const;
11 | UINT GetControlFlags() const;
12 | LPVOID GetInterface(const CUIString& strName);
13 |
14 | CUIString* GetLinkContent(int iIndex);
15 |
16 | void DoEvent(TEventUI& event);
17 | SIZE EstimateSize(SIZE szAvailable);
18 |
19 | void PaintText(cairo_t *cr);
20 |
21 | protected:
22 | enum { MAX_LINK = 8 };
23 | int m_nLinks;
24 | CUIRect m_rcLinks[MAX_LINK];
25 | CUIString m_sLinks[MAX_LINK];
26 | int m_nHoverLink;
27 | };
28 |
29 |
30 | #endif //__UITEXT_H__
--------------------------------------------------------------------------------
/gtkduilib_test/targetver.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | // The following macros define the minimum required platform. The minimum required platform
4 | // is the earliest version of Windows, Internet Explorer etc. that has the necessary features to run
5 | // your application. The macros work by enabling all features available on platform versions up to and
6 | // including the version specified.
7 |
8 | // Modify the following defines if you have to target a platform prior to the ones specified below.
9 | // Refer to MSDN for the latest info on corresponding values for different platforms.
10 | #ifndef _WIN32_WINNT // Specifies that the minimum required platform is Windows Vista.
11 | #define _WIN32_WINNT 0x0600 // Change this to the appropriate value to target other versions of Windows.
12 | #endif
13 |
14 |
--------------------------------------------------------------------------------
/360Demo/360Demo.layout:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/qyplayer/qyplayer.layout:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/gtkduilib_test/gtkduilib_test.layout:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/gtkduilib/DialogBuilder.h:
--------------------------------------------------------------------------------
1 | #ifndef __DIALOGBUILDER__H__
2 | #define __DIALOGBUILDER__H__
3 |
4 | #include "pugixml.hpp"
5 |
6 | class IDialogBuilderCallback
7 | {
8 | public:
9 | virtual CUIControl* CreateControl(const CUIString& strClass) = 0;
10 | };
11 |
12 | class CDialogBuilder
13 | {
14 | public:
15 | CDialogBuilder(void);
16 | CDialogBuilder(IDialogBuilderCallback *callback);
17 | virtual ~CDialogBuilder(void);
18 |
19 | public:
20 |
21 | CUIControl* Create(const CUIString& strXmlPath, CUIWindow* pRootDialog = NULL, CUIControl* pParent = NULL);
22 | void SetCallback(IDialogBuilderCallback* callback);
23 |
24 | private:
25 | CUIControl* Create(CUIWindow* pRootDialog = NULL, CUIControl* pParent = NULL);
26 | CUIControl* ParseControl(pugi::xml_node node, CUIWindow* pRootDialog, CUIControl* pParent);
27 |
28 | private:
29 | IDialogBuilderCallback *m_callBack;
30 | pugi::xml_document m_doc;
31 | };
32 |
33 | #endif
--------------------------------------------------------------------------------
/gtkduilib/UIFont.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "UIRef.h"
4 | #include "UIString.h"
5 | #include "UIUtils.h"
6 |
7 |
8 | class CUIFont: public CRefBase
9 | {
10 | public:
11 | CUIFont(void);
12 | CUIFont(const CUIString& strName, const CUIString& strFaceName, int nSize = 0, BOOL bBold = FALSE,
13 | BOOL bUnderline = FALSE, BOOL bItalic = FALSE);
14 | virtual ~CUIFont(void);
15 | VOID SetItalic(BOOL bItalic);
16 | VOID SetBold(BOOL bBold);
17 | PangoFontDescription* GetHandle();
18 | PangoFontDescription* Create();
19 | VOID SetUnderLine(BOOL bUnderline);
20 | VOID SetSize(int nSize);
21 | VOID SetName(const CUIString& strName);
22 | VOID SetFaceName(const CUIString& strFaceName);
23 | VOID ReleaseFont();
24 | UINT GetFontHeight();
25 |
26 | private:
27 |
28 | CUIString m_strName;
29 | CUIString m_strFaceName;
30 | int m_nSize;
31 | BOOL m_bBold;
32 | BOOL m_bUnderLine;
33 | BOOL m_bItalic;
34 | PangoFontDescription * m_hFont;
35 | };
36 |
--------------------------------------------------------------------------------
/gtkduilib/UIProgress.h:
--------------------------------------------------------------------------------
1 | #ifndef __UIPROGRESS_H__
2 | #define __UIPROGRESS_H__
3 |
4 | class CUIProgress : public CUILabel
5 | {
6 | public:
7 | CUIProgress();
8 |
9 | CUIString GetClass() const;
10 | LPVOID GetInterface(const CUIString& strName);
11 |
12 | bool IsHorizontal();
13 | void SetHorizontal(bool bHorizontal = true);
14 | bool IsStretchForeImage();
15 | void SetStretchForeImage(bool bStretchForeImage = true);
16 | int GetMinValue() const;
17 | void SetMinValue(int nMin);
18 | int GetMaxValue() const;
19 | void SetMaxValue(int nMax);
20 | int GetValue() const;
21 | void SetValue(int nValue);
22 | CUIString GetForeImage() const;
23 | void SetForeImage(const CUIString& strImage);
24 | void SetForePadding(int nPadding);
25 |
26 | void SetAttribute(LPCWSTR pstrName, LPCWSTR pstrValue);
27 | void PaintStatusImage(cairo_t *cr);
28 | int GetForePadding();
29 |
30 |
31 | protected:
32 | bool m_bHorizontal;
33 | bool m_bStretchForeImage;
34 | int m_nMax;
35 | int m_nMin;
36 | int m_nValue;
37 | int m_nPadding;
38 |
39 | CUIString m_strForeImage;
40 | //CUIString m_sForeImageModify;
41 | };
42 |
43 |
44 | #endif // __UIPROGRESS_H__
45 |
--------------------------------------------------------------------------------
/gtkduilib/UILib.h:
--------------------------------------------------------------------------------
1 | #ifndef __UILIB__H__
2 | #define __UILIB__H__
3 |
4 | #include
5 | #include
6 | #include
7 | #include
8 |
9 | #ifdef WIN32
10 | #include
11 | #else
12 | #include "compat.h"
13 | #endif
14 |
15 | #include
16 | //#include
17 | //#include
18 | //#include
19 |
20 |
21 | #include "UIUtils.h"
22 | #include "UIString.h"
23 | #include "UIDefine.h"
24 | #include "NotifyPump.h"
25 | #include "UIFont.h"
26 | #include "UIEvent.h"
27 | #include "UIRender.h"
28 | #include "ResourceMgr.h"
29 | #include "UIControl.h"
30 | #include "UILabel.h"
31 | #include "UIButton.h"
32 | #include "UIText.h"
33 | #include "UIOption.h"
34 | #include "UIProgress.h"
35 | #include "UISlider.h"
36 | #include "UIScrollBar.h"
37 | #include "UIWindow.h"
38 |
39 | #include "UIContainer.h"
40 | #include "UIHorizontalLayout.h"
41 | #include "UIVerticalLayout.h"
42 | #include "UITabLayout.h"
43 | #include "UITileLayout.h"
44 | #include "DialogBuilder.h"
45 | #include "UIChildLayout.h"
46 |
47 | #include "UIList.h"
48 |
49 | #include "WindowImpBase.h"
50 |
51 | #endif
--------------------------------------------------------------------------------
/gtkduilib/UILabel.h:
--------------------------------------------------------------------------------
1 | #ifndef __UILABEL_H__
2 | #define __UILABEL_H__
3 |
4 | //#pragma once
5 |
6 | class CUILabel : public CUIControl
7 | {
8 | public:
9 | CUILabel();
10 |
11 | CUIString GetClass() const;
12 | LPVOID GetInterface(const CUIString& strName);
13 |
14 | void SetTextStyle(UINT uStyle);
15 | UINT GetTextStyle() const;
16 | void SetTextColor(DWORD dwTextColor);
17 | DWORD GetTextColor() const;
18 | void SetDisabledTextColor(DWORD dwTextColor);
19 | DWORD GetDisabledTextColor() const;
20 | void SetFont(const CUIString &strFontName);
21 | CUIString GetFont() const;
22 | CUIRect GetTextPadding() const;
23 | void SetTextPadding(const CUIRect& rc);
24 | bool IsShowHtml();
25 | void SetShowHtml(bool bShowHtml = true);
26 |
27 | SIZE EstimateSize(SIZE szAvailable);
28 | void DoEvent(TEventUI& event);
29 | void SetAttribute(LPCWSTR pstrName, LPCWSTR pstrValue);
30 |
31 | void PaintText(cairo_t *cr);
32 |
33 | protected:
34 | DWORD m_dwTextColor;
35 | DWORD m_dwDisabledTextColor;
36 | CUIString m_strFontName;
37 | UINT m_uTextStyle;
38 | CUIRect m_rcTextPadding;
39 | bool m_bShowHtml;
40 | };
41 |
42 | #endif // __UILABEL_H__
--------------------------------------------------------------------------------
/gtkduilib/ReadMe.txt:
--------------------------------------------------------------------------------
1 | ========================================================================
2 | STATIC LIBRARY : gtkduilib Project Overview
3 | ========================================================================
4 |
5 | AppWizard has created this gtkduilib library project for you.
6 |
7 | This file contains a summary of what you will find in each of the files that
8 | make up your gtkduilib application.
9 |
10 |
11 | gtkduilib.vcproj
12 | This is the main project file for VC++ projects generated using an Application Wizard.
13 | It contains information about the version of Visual C++ that generated the file, and
14 | information about the platforms, configurations, and project features selected with the
15 | Application Wizard.
16 |
17 |
18 | /////////////////////////////////////////////////////////////////////////////
19 |
20 | StdAfx.h, StdAfx.cpp
21 | These files are used to build a precompiled header (PCH) file
22 | named gtkduilib.pch and a precompiled types file named StdAfx.obj.
23 |
24 | /////////////////////////////////////////////////////////////////////////////
25 | Other notes:
26 |
27 | AppWizard uses "TODO:" comments to indicate parts of the source code you
28 | should add to or customize.
29 |
30 | /////////////////////////////////////////////////////////////////////////////
31 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # gtkduilib
2 |
3 | duilib向gtk的移植
4 |
5 | ## 编译
6 |
7 | windows:
8 | ```
9 | install [msys2](https://msys2.github.io/)
10 | then install gtk3.0.x from msys2 shell
11 | install codeblocks
12 | open the workspace and build
13 | ```
14 |
15 | linux (ubuntu):
16 | ```
17 | sudo apt-get install codebloks libgtk3.0xxxx
18 | open the workspace and build
19 | ```
20 |
21 | ## Demo
22 | 大家可以看下demo.
23 |
24 | player run in windows:
25 |
26 | 
27 |
28 | player run in ubuntu:
29 |
30 | 
31 |
32 | 360safe run in ubuntu:
33 |
34 | 
35 |
36 | ## 和原版的duilib有啥不同
37 | 基本上兼容原版duilib的格式,主要有下面几种不同.
38 |
39 | 1. 全部使用unicode, 便于移植, windows A/W很是闹心呀.
40 | 2. 绘制字体使用pango的接口,没有保留原版的绘制接口.
41 | 3. 好多LPCTSTR类型的参数使用const CUIString& 传递.
42 | 4. 使用pugixml作为xml解析.
43 | 5. 直接使用gdk-pixbuf加载图片
44 |
45 | ## 备注
46 | 1. 做这个的目的其实是为了学习下gtk.duilib的框架很好,把windows消息机制移植到gtk的机制,控件代码基本上都不用改。
47 | 2. gtk for windows的bug多多,建议还是在linux下弄
48 | 3. gtk 在windows下是支持加载系统字体的,但是只支持english name, 大家写xml的时候注意下。
49 | 4. 不喜勿喷, 谢谢 ^_^
50 | 5. 欢迎pull request
51 |
52 | ## TODO:
53 | 太多了。
54 | - [ ] 上传demo
55 | - [ ] 键盘事件
56 | - [ ] EDIT控件,树控件, webview
57 | - [ ] 移植原版demo
58 | - [ ] ...
59 |
--------------------------------------------------------------------------------
/gtkduilib/UISlider.h:
--------------------------------------------------------------------------------
1 |
2 | #ifndef __UISLIDER_H__
3 | #define __UISLIDER_H__
4 |
5 | class CUISlider : public CUIProgress
6 | {
7 | public:
8 | CUISlider();
9 | CUIString GetClass() const;
10 | UINT GetControlFlags() const;
11 | LPVOID GetInterface(const CUIString& strName);
12 |
13 | void SetEnabled(bool bEnable = true);
14 |
15 | int GetChangeStep();
16 | void SetChangeStep(int step);
17 | void SetThumbSize(SIZE szXY);
18 | CUIRect GetThumbRect() const;
19 | CUIString GetThumbImage() const;
20 | void SetThumbImage(const CUIString& strImage);
21 | CUIString GetThumbHotImage() const;
22 | void SetThumbHotImage(const CUIString& strImage);
23 | CUIString GetThumbPushedImage() const;
24 | void SetThumbPushedImage(const CUIString& strImage);
25 |
26 | void SetValue(int nValue);
27 | void DoEvent(TEventUI& event);
28 | void SetAttribute(LPCWSTR pstrName, LPCWSTR pstrValue);
29 | void PaintStatusImage(cairo_t *cr);
30 | void SetVisible(bool bVisible /* = true */);
31 | void SetSendMove(bool bSendMove);
32 | bool IsSendMove();
33 | protected:
34 | CUISize m_szThumb;
35 | UINT m_uButtonState;
36 | int m_nStep;
37 |
38 | CUIString m_sThumbImage;
39 | CUIString m_sThumbHotImage;
40 | CUIString m_sThumbPushedImage;
41 |
42 | CUIString m_sImageModify;
43 | bool m_bDelyInVisible;
44 | int m_nDownValue;
45 | bool m_bSendMove;
46 | };
47 |
48 | #endif // __UISLIDER_H__
--------------------------------------------------------------------------------
/gtkduilib_test/ReadMe.txt:
--------------------------------------------------------------------------------
1 | ========================================================================
2 | CONSOLE APPLICATION : gtkduilib_test Project Overview
3 | ========================================================================
4 |
5 | AppWizard has created this gtkduilib_test application for you.
6 |
7 | This file contains a summary of what you will find in each of the files that
8 | make up your gtkduilib_test application.
9 |
10 |
11 | gtkduilib_test.vcproj
12 | This is the main project file for VC++ projects generated using an Application Wizard.
13 | It contains information about the version of Visual C++ that generated the file, and
14 | information about the platforms, configurations, and project features selected with the
15 | Application Wizard.
16 |
17 | gtkduilib_test.cpp
18 | This is the main application source file.
19 |
20 | /////////////////////////////////////////////////////////////////////////////
21 | Other standard files:
22 |
23 | StdAfx.h, StdAfx.cpp
24 | These files are used to build a precompiled header (PCH) file
25 | named gtkduilib_test.pch and a precompiled types file named StdAfx.obj.
26 |
27 | /////////////////////////////////////////////////////////////////////////////
28 | Other notes:
29 |
30 | AppWizard uses "TODO:" comments to indicate parts of the source code you
31 | should add to or customize.
32 |
33 | /////////////////////////////////////////////////////////////////////////////
34 |
--------------------------------------------------------------------------------
/360Demo/360Demo.cbp:
--------------------------------------------------------------------------------
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 |
--------------------------------------------------------------------------------
/qyplayer/qyplayer.cbp:
--------------------------------------------------------------------------------
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 |
--------------------------------------------------------------------------------
/gtkduilib/UIEvent.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | enum EVENTTYPE_UI
4 | {
5 | UIEVENT__FIRST = 1,
6 | UIEVENT__KEYBEGIN,
7 | UIEVENT_KEYDOWN,
8 | UIEVENT_KEYUP,
9 | UIEVENT_CHAR,
10 | UIEVENT_SYSKEY,
11 | UIEVENT__KEYEND,
12 | UIEVENT__MOUSEBEGIN,
13 | UIEVENT_MOUSEMOVE,
14 | UIEVENT_MOUSELEAVE,
15 | UIEVENT_MOUSEENTER,
16 | UIEVENT_MOUSEHOVER,
17 | UIEVENT_BUTTONDOWN,
18 | UIEVENT_BUTTONUP,
19 | UIEVENT_RBUTTONDOWN,
20 | UIEVENT_DBLCLICK,
21 | UIEVENT_CONTEXTMENU,
22 | UIEVENT_SCROLLWHEEL,
23 | UIEVENT__MOUSEEND,
24 | UIEVENT_KILLFOCUS,
25 | UIEVENT_SETFOCUS,
26 | UIEVENT_WINDOWSIZE,
27 | UIEVENT_SETCURSOR,
28 | UIEVENT_TIMER,
29 | UIEVENT_NOTIFY,
30 | UIEVENT_COMMAND,
31 | UIEVENT__LAST,
32 | };
33 |
34 | #define IS_MOUSE_EVENT(_type) (_type > UIEVENT__MOUSEBEGIN && _type < UIEVENT__MOUSEEND)
35 |
36 | class CUIControl;
37 |
38 | typedef struct tagTEventUI
39 | {
40 | int Type;
41 | CUIControl* pSender;
42 | DWORD dwTimestamp;
43 | POINT ptMouse;
44 | WCHAR chKey;
45 | WORD wKeyState;
46 | WPARAM wParam;
47 | LPARAM lParam;
48 | } TEventUI;
49 |
50 | class CUIEvent
51 | {
52 | public:
53 | CUIEvent(void);
54 | CUIEvent(PVOID Sender, DWORD dwType, DWORD dwTime);
55 | CUIEvent(GdkEvent *Event);
56 | virtual ~CUIEvent(void);
57 |
58 | private:
59 | DWORD m_Type;
60 | PVOID m_Sender;
61 | DWORD m_Time;
62 |
63 | };
64 |
--------------------------------------------------------------------------------
/gtkduilib.workspace.layout:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/gtkduilib.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 10.00
3 | # Visual Studio 2008
4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gtkduilib", "gtkduilib\gtkduilib.vcproj", "{245726C5-62B3-4978-95BC-678DB6A8CA0D}"
5 | EndProject
6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gtkduilib_test", "gtkduilib_test\gtkduilib_test.vcproj", "{D496C7CB-54B6-4E70-AAD1-910D338840A9}"
7 | ProjectSection(ProjectDependencies) = postProject
8 | {245726C5-62B3-4978-95BC-678DB6A8CA0D} = {245726C5-62B3-4978-95BC-678DB6A8CA0D}
9 | EndProjectSection
10 | EndProject
11 | Global
12 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
13 | Debug|Win32 = Debug|Win32
14 | Release|Win32 = Release|Win32
15 | EndGlobalSection
16 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
17 | {245726C5-62B3-4978-95BC-678DB6A8CA0D}.Debug|Win32.ActiveCfg = Debug|Win32
18 | {245726C5-62B3-4978-95BC-678DB6A8CA0D}.Debug|Win32.Build.0 = Debug|Win32
19 | {245726C5-62B3-4978-95BC-678DB6A8CA0D}.Release|Win32.ActiveCfg = Release|Win32
20 | {245726C5-62B3-4978-95BC-678DB6A8CA0D}.Release|Win32.Build.0 = Release|Win32
21 | {D496C7CB-54B6-4E70-AAD1-910D338840A9}.Debug|Win32.ActiveCfg = Debug|Win32
22 | {D496C7CB-54B6-4E70-AAD1-910D338840A9}.Debug|Win32.Build.0 = Debug|Win32
23 | {D496C7CB-54B6-4E70-AAD1-910D338840A9}.Release|Win32.ActiveCfg = Release|Win32
24 | {D496C7CB-54B6-4E70-AAD1-910D338840A9}.Release|Win32.Build.0 = Release|Win32
25 | EndGlobalSection
26 | GlobalSection(SolutionProperties) = preSolution
27 | HideSolutionNode = FALSE
28 | EndGlobalSection
29 | EndGlobal
30 |
--------------------------------------------------------------------------------
/gtkduilib/UIOption.h:
--------------------------------------------------------------------------------
1 | #ifndef __UIOPTION_H__
2 | #define __UIOPTION_H__
3 |
4 | class CUIOption : public CUIButton
5 | {
6 | public:
7 | CUIOption();
8 | ~CUIOption();
9 |
10 | CUIString GetClass() const;
11 | LPVOID GetInterface(const CUIString& strName);
12 |
13 | //void SetManager(CPaintManagerUI* pManager, CControlUI* pParent, bool bInit = true);
14 |
15 | bool Activate();
16 | void SetEnabled(bool bEnable = true);
17 |
18 | CUIString GetSelectedImage();
19 | void SetSelectedImage(const CUIString& strImage);
20 |
21 | CUIString GetSelectedHotImage();
22 | void SetSelectedHotImage(const CUIString& strImage);
23 |
24 | void SetSelectedTextColor(DWORD dwTextColor);
25 | DWORD GetSelectedTextColor();
26 |
27 | void SetSelectedBkColor(DWORD dwBkColor);
28 | DWORD GetSelectBkColor();
29 |
30 | CUIString GetForeImage();
31 | void SetForeImage(const CUIString& strImage);
32 |
33 | CUIString GetGroup() const;
34 | void SetGroup(const CUIString& strImage);
35 | bool IsSelected() const;
36 | virtual void Selected(bool bSelected);
37 |
38 | SIZE EstimateSize(SIZE szAvailable);
39 | void SetAttribute(LPCWSTR pstrName, LPCWSTR pstrValue);
40 |
41 | void PaintStatusImage(cairo_t *cr);
42 | void PaintText(cairo_t *cr);
43 | void SetOwnWindow(CUIWindow* pWindow, CUIControl* pParent, bool bInit);
44 |
45 | protected:
46 | bool m_bSelected;
47 | CUIString m_sGroupName;
48 |
49 | DWORD m_dwSelectedBkColor;
50 | DWORD m_dwSelectedTextColor;
51 |
52 | CUIString m_sSelectedImage;
53 | CUIString m_sSelectedHotImage;
54 | CUIString m_sForeImage;
55 | };
56 |
57 |
58 | #endif // __UIOPTION_H__
--------------------------------------------------------------------------------
/gtkduilib/UIChildLayout.cpp:
--------------------------------------------------------------------------------
1 | #include "stdafx.h"
2 | #include "UIChildLayout.h"
3 |
4 | CUIChildLayout::CUIChildLayout():m_Callback(NULL)
5 | {
6 |
7 | }
8 |
9 | void CUIChildLayout::Init()
10 | {
11 | if (!m_pstrXMLFile.IsEmpty()){
12 |
13 | //
14 | // TODO CDialogBuilder
15 | //
16 |
17 | CDialogBuilder builder;
18 | CUIContainer* pChildWindow = static_cast(builder.Create(m_pstrXMLFile.GetData(), m_Window, NULL));
19 | if (pChildWindow){
20 | this->Add(pChildWindow);
21 | }else{
22 | this->RemoveAll();
23 | }
24 |
25 | //
26 | // set callback to NULL
27 | //
28 |
29 | if (!m_Callback){
30 | m_Callback = NULL;
31 | }
32 | }
33 | }
34 |
35 | void CUIChildLayout::SetAttribute( LPCWSTR pstrName, LPCWSTR pstrValue )
36 | {
37 | if(wcscmp(pstrName, L"xmlfile") == 0)
38 | SetChildLayoutXML(pstrValue);
39 | else
40 | CUIContainer::SetAttribute(pstrName,pstrValue);
41 | }
42 |
43 | void CUIChildLayout::SetChildLayoutXML(const CUIString& strXML)
44 | {
45 | m_pstrXMLFile = strXML;
46 | }
47 |
48 | CUIString CUIChildLayout::GetChildLayoutXML()
49 | {
50 | return m_pstrXMLFile;
51 | }
52 |
53 | LPVOID CUIChildLayout::GetInterface(const CUIString& strName)
54 | {
55 | if(strName == DUI_CTR_CHILDLAYOUT)
56 | return static_cast(this);
57 | return CUIControl::GetInterface(strName);
58 | }
59 |
60 | CUIString CUIChildLayout::GetClass() const
61 | {
62 | return L"ChildLayoutUI";
63 | }
64 |
65 |
66 | VOID CUIChildLayout::SetBuilderCallback(IDialogBuilderCallback* pCallback)
67 | {
68 | m_Callback = pCallback;
69 | }
70 |
71 |
--------------------------------------------------------------------------------
/gtkduilib_test/gtkduilib_test.cbp:
--------------------------------------------------------------------------------
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 |
--------------------------------------------------------------------------------
/gtkduilib/UIButton.h:
--------------------------------------------------------------------------------
1 | #ifndef __UIBUTTON_H__
2 | #define __UIBUTTON_H__
3 |
4 | class CUIButton : public CUILabel
5 | {
6 | public:
7 | CUIButton();
8 |
9 | CUIString GetClass() const;
10 | LPVOID GetInterface(const CUIString& strName);
11 | UINT GetControlFlags() const;
12 |
13 | bool Activate();
14 | void SetEnabled(bool bEnable = true);
15 | void DoEvent(TEventUI& event);
16 |
17 | LPCWSTR GetNormalImage();
18 | void SetNormalImage(LPCWSTR pStrImage);
19 | LPCWSTR GetHotImage();
20 | void SetHotImage(LPCWSTR pStrImage);
21 | LPCWSTR GetPushedImage();
22 | void SetPushedImage(LPCWSTR pStrImage);
23 | LPCWSTR GetFocusedImage();
24 | void SetFocusedImage(LPCWSTR pStrImage);
25 | LPCWSTR GetDisabledImage();
26 | void SetDisabledImage(LPCWSTR pStrImage);
27 | LPCWSTR GetForeImage();
28 | void SetForeImage(LPCWSTR pStrImage);
29 | LPCWSTR GetHotForeImage();
30 | void SetHotForeImage(LPCWSTR pStrImage);
31 |
32 | void SetHotBkColor(DWORD dwColor);
33 | DWORD GetHotBkColor() const;
34 | void SetHotTextColor(DWORD dwColor);
35 | DWORD GetHotTextColor() const;
36 | void SetPushedTextColor(DWORD dwColor);
37 | DWORD GetPushedTextColor() const;
38 | void SetFocusedTextColor(DWORD dwColor);
39 | DWORD GetFocusedTextColor() const;
40 | SIZE EstimateSize(SIZE szAvailable);
41 | void SetAttribute(LPCWSTR pstrName, LPCWSTR pstrValue);
42 |
43 | void PaintText(cairo_t *cr);
44 | void PaintStatusImage(cairo_t *cr);
45 |
46 | protected:
47 | UINT m_uButtonState;
48 |
49 | DWORD m_dwHotBkColor;
50 | DWORD m_dwHotTextColor;
51 | DWORD m_dwPushedTextColor;
52 | DWORD m_dwFocusedTextColor;
53 |
54 | CUIString m_sNormalImage;
55 | CUIString m_sHotImage;
56 | CUIString m_sHotForeImage;
57 | CUIString m_sPushedImage;
58 | CUIString m_sPushedForeImage;
59 | CUIString m_sFocusedImage;
60 | CUIString m_sDisabledImage;
61 | CUIString m_sForeImage;
62 | };
63 |
64 |
65 | #endif // __UIBUTTON_H__
--------------------------------------------------------------------------------
/gtkduilib/UIRef.h:
--------------------------------------------------------------------------------
1 | #ifndef __DUI_REF_H__
2 | #define __DUI_REF_H__
3 |
4 | //#include "DUIDef.h"
5 |
6 | //T's base class for CRefPtr
7 | class CRefBase
8 | {
9 | public:
10 | CRefBase()
11 | {
12 | m_nRefCount = 0;
13 | }
14 |
15 | int GetRef() const
16 | {
17 | return m_nRefCount;
18 | }
19 |
20 | int AddRef()
21 | {
22 | return ++m_nRefCount;
23 | }
24 |
25 | int Release()
26 | {
27 | if(!--m_nRefCount){
28 | delete this;
29 | }
30 | return m_nRefCount;
31 | }
32 |
33 | VOID Reset()
34 | {
35 | m_nRefCount = 0;
36 | }
37 |
38 |
39 | private:
40 | int m_nRefCount;
41 | };
42 |
43 | template
44 | class CRefPtr
45 | {
46 | public:
47 | T* operator->() const
48 | {
49 | return m_pRawObj;
50 | }
51 |
52 | T& operator()() const
53 | {
54 | return *m_pRawObj;
55 | }
56 |
57 | T& operator*() const
58 | {
59 | return *m_pRawObj;
60 | }
61 |
62 | T* GetPtr() const
63 | {
64 | return m_pRawObj;
65 | }
66 |
67 | bool IsNull() const
68 | {
69 | return m_pRawObj == NULL;
70 | }
71 |
72 | CRefPtr()
73 | {
74 | m_pRawObj = NULL;
75 | }
76 |
77 | CRefPtr(T* p)
78 | {
79 | m_pRawObj = p;
80 | if(p != NULL)
81 | {
82 | p->AddRef();
83 | }
84 | }
85 |
86 | CRefPtr(const CRefPtr& ref)
87 | {
88 | m_pRawObj = ref.m_pRawObj;
89 | if(m_pRawObj != NULL)
90 | {
91 | m_pRawObj->AddRef();
92 | }
93 | }
94 |
95 | ~CRefPtr()
96 | {
97 | if(m_pRawObj != NULL){
98 | m_pRawObj->Release();
99 | }
100 | }
101 |
102 | CRefPtr& operator = (const CRefPtr& ref)
103 | {
104 | if(this != &ref)
105 | {
106 | if(m_pRawObj != NULL){
107 | m_pRawObj->Release();
108 | }
109 |
110 | m_pRawObj = ref.m_pRawObj;
111 |
112 | if(m_pRawObj != NULL){
113 | m_pRawObj->AddRef();
114 | }
115 | }
116 |
117 | return *this;
118 | }
119 |
120 | bool operator == (const CRefPtr& ref) const
121 | {
122 | return m_pRawObj == ref.m_pRawObj;
123 | }
124 |
125 | bool operator != (const CRefPtr& ref) const
126 | {
127 | return m_pRawObj != ref.m_pRawObj;
128 | }
129 |
130 | private:
131 | T* m_pRawObj;
132 | };
133 |
134 | #endif //__DUI_REF_H__
135 |
--------------------------------------------------------------------------------
/gtkduilib/UIRender.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #define UIGetAValue(rgb) (LOBYTE((rgb)>>24))
4 | #define UIGetBValue(rgb) (LOBYTE(rgb))
5 | #define UIGetGValue(rgb) (LOBYTE(((WORD)(rgb)) >> 8))
6 | #define UIGetRValue(rgb) (LOBYTE((rgb)>>16))
7 |
8 | class CUIRender
9 | {
10 | public:
11 | CUIRender(void);
12 | virtual ~CUIRender(void);
13 | public:
14 | static void DrawLinerGradient(cairo_t * cr, int x, int y, int nWidth,
15 | int nHeight, DWORD dwFirst, DWORD dwSecond,
16 | BOOL bVertial, int nSteps );
17 | static void DrawLinerGradient( cairo_t * cr, const CUIRect &rc, DWORD dwFirst,
18 | DWORD dwSecond, BOOL bVertial, int nSteps );
19 | static void DrawColor(cairo_t *cr, int x, int y, int nWidth, int nHeight, DWORD dwColor);
20 | static void DrawColor(cairo_t *cr, const CUIRect& rc, DWORD dwColor);
21 | static void DrawRect(cairo_t* cr, const CUIRect& rc, int nSize, DWORD dwColor);
22 | static bool DrawImage( cairo_t* cr, GdkPixbuf* Pixbuf, const CUIRect& rc,
23 | const CUIRect& rcPaint, const CUIRect& rcImage, const CUIRect& rcCorners,
24 | int alpha, BOOL hole, BOOL xtiled, BOOL ytiled);
25 | static bool DrawImage(cairo_t* cr, /*CUIManager* pManager,*/ const CUIString& strImage,
26 | const CUIRect& rcControl, const CUIRect& rcPaint, const CUIRect& rcDest,
27 | CUIRect& rcImage, const CUIRect& rcCorners,
28 | int alpha, BOOL hole, BOOL xtiled, BOOL ytiled);
29 | static bool AlphaBlend(cairo_t* cr, GdkPixbuf *sPixbuf, int dx, int dy, int dWidth,
30 | int dHeight, int sx, int sy, int sWidth, int sHeight, int alpha);
31 | static bool DrawImageString(cairo_t *cr, /*CUIManager* pManager,*/ const CUIRect& rcControl,
32 | const CUIRect& rcPaint, LPCWSTR lpStrImage, LPCWSTR lpStrModify);
33 | static void DrawText(cairo_t * cr, int x, int y, int nWidth, int nHeight,
34 | LPCWSTR lpszText, DWORD dwStyle, LPCWSTR lpszFontName, DWORD dwColor, bool bShowHtml = false,
35 | CUIRect *rcOut = NULL);
36 | static void DrawText(cairo_t * cr, const CUIRect& rc, const CUIString& strText,
37 | DWORD dwStyle, const CUIString& strFontName, DWORD dwColor,
38 | bool bShowHtml = false, CUIRect *rcOut = NULL);
39 | static void DrawLine(cairo_t *cr, const CUIRect& rc, int nSize, DWORD dwPenColor,int nStyle /*= PS_SOLID*/);
40 | };
--------------------------------------------------------------------------------
/gtkduilib/UIFont.cpp:
--------------------------------------------------------------------------------
1 | #include "stdafx.h"
2 |
3 | #include "UIFont.h"
4 |
5 | CUIFont::CUIFont(void):m_bBold(FALSE),
6 | m_bUnderLine(FALSE), m_bItalic(FALSE), m_hFont(NULL), m_nSize(8)
7 | {
8 |
9 | }
10 |
11 |
12 | CUIFont::CUIFont(const CUIString& strName, const CUIString& strFaceName,
13 | int nSize, BOOL bBold, BOOL bUnderline, BOOL bItalic)
14 | {
15 | m_nSize = nSize * PANGO_SCALE;
16 | m_strName = strName;
17 | m_strFaceName = strFaceName;
18 | m_bBold = bBold;
19 | m_bUnderLine = bUnderline;
20 | m_bItalic = bItalic;
21 | m_hFont = NULL;
22 | }
23 |
24 | CUIFont::~CUIFont(void)
25 | {
26 | ReleaseFont();
27 | }
28 |
29 |
30 | PangoFontDescription* CUIFont::Create()
31 | {
32 |
33 | //
34 | // create a new desc
35 | //
36 |
37 | PangoFontDescription *desc = pango_font_description_new();
38 |
39 | //
40 | // set font attribute
41 | //
42 |
43 | if (!m_strFaceName.IsEmpty()){
44 | pango_font_description_set_family(desc, (LPCSTR)CW2U8(m_strFaceName.GetData()));
45 | }
46 |
47 | //
48 | // set font size
49 | //
50 |
51 | if (m_nSize){
52 | pango_font_description_set_size(desc, m_nSize);
53 | }
54 |
55 | //
56 | // set Italic
57 | //
58 |
59 | if (m_bItalic){
60 | pango_font_description_set_style(desc, PANGO_STYLE_ITALIC);
61 | }else{
62 | pango_font_description_set_style(desc, PANGO_STYLE_NORMAL);
63 | }
64 |
65 | //
66 | // set bold
67 | //
68 |
69 | if (m_bBold){
70 | pango_font_description_set_weight(desc, PANGO_WEIGHT_BOLD);
71 | }else{
72 | pango_font_description_set_weight(desc, PANGO_WEIGHT_NORMAL);
73 | }
74 |
75 | m_hFont = desc;
76 |
77 | return m_hFont;
78 |
79 | }
80 |
81 | VOID CUIFont::SetItalic(BOOL bItalic)
82 | {
83 | m_bItalic = bItalic;
84 | }
85 |
86 | VOID CUIFont::SetBold(BOOL bBold)
87 | {
88 | m_bBold = bBold;
89 | }
90 |
91 | VOID CUIFont::SetUnderLine(BOOL bUnderline)
92 | {
93 | m_bUnderLine = bUnderline;
94 | }
95 |
96 | VOID CUIFont::SetSize(int nSize)
97 | {
98 | m_nSize = nSize;
99 | }
100 |
101 | VOID CUIFont::SetName(const CUIString& strName)
102 | {
103 | m_strName = strName;
104 | }
105 |
106 | VOID CUIFont::SetFaceName(const CUIString& strFaceName)
107 | {
108 | m_strFaceName = strFaceName;
109 | }
110 |
111 | PangoFontDescription * CUIFont::GetHandle()
112 | {
113 | return m_hFont;
114 | }
115 |
116 | VOID CUIFont::ReleaseFont()
117 | {
118 | if (m_hFont){
119 | pango_font_description_free(m_hFont);
120 | m_hFont = NULL;
121 | }
122 | }
123 |
124 | UINT CUIFont::GetFontHeight()
125 | {
126 | if (m_hFont){
127 | return pango_font_description_get_size(m_hFont) / PANGO_SCALE;
128 | }
129 | return 0;
130 | }
131 |
--------------------------------------------------------------------------------
/gtkduilib/UIUtils.h:
--------------------------------------------------------------------------------
1 | #ifndef __INCLUDE_UIUTILS__H__
2 | #define __INCLUDE_UIUTILS__H__
3 |
4 | #include
5 | #include "UIString.h"
6 |
7 | BOOL UIIntersectRect(
8 | LPRECT prcDst,
9 | CONST RECT *prcSrc1,
10 | CONST RECT *prcSrc2);
11 | ULONG UIGetTickCount();
12 |
13 |
14 | class CUIRect : public tagRECT
15 | {
16 | public:
17 | CUIRect();
18 | CUIRect(const RECT& src);
19 | CUIRect(int iLeft, int iTop, int iRight, int iBottom);
20 | CUIRect(const GdkRectangle& src);
21 | int GetWidth() const;
22 | int GetHeight() const;
23 | void Empty();
24 | bool IsEmpty();
25 | bool IsNull() const;
26 | void Join(const RECT& rc);
27 | void ResetOffset();
28 | void Normalize();
29 | void Offset(int cx, int cy);
30 | void Inflate(int cx, int cy);
31 | void Deflate(int cx, int cy);
32 | void Union(CUIRect& rc);
33 | bool IsPtIn(POINT pt);
34 | };
35 |
36 | class CUISize : public tagSIZE
37 | {
38 | public:
39 | CUISize();
40 | CUISize(const SIZE& src);
41 | CUISize(const RECT rc);
42 | CUISize(int cx, int cy);
43 | bool IsNull() const;
44 | };
45 |
46 | struct TITEM
47 | {
48 | CUIString Key;
49 | LPVOID Data;
50 | struct TITEM* pPrev;
51 | struct TITEM* pNext;
52 | };
53 |
54 | class CStdStringPtrMap
55 | {
56 | public:
57 | CStdStringPtrMap(int nSize = 100);
58 | ~CStdStringPtrMap();
59 |
60 | void Resize(int nSize = 100);
61 | LPVOID Find(LPCWSTR key, bool optimize = true) const;
62 | bool Insert(LPCWSTR key, LPVOID pData);
63 | LPVOID Set(LPCWSTR key, LPVOID pData);
64 | bool Remove(LPCWSTR key);
65 | void RemoveAll();
66 | int GetSize() const;
67 | LPCWSTR GetAt(int iIndex) const;
68 | LPCWSTR operator[] (int nIndex) const;
69 |
70 | protected:
71 | TITEM** m_aT;
72 | int m_nBuckets;
73 | int m_nCount;
74 | };
75 |
76 | class CStdPtrArray
77 | {
78 | public:
79 | CStdPtrArray(int iPreallocSize = 0);
80 | CStdPtrArray(const CStdPtrArray& src);
81 | ~CStdPtrArray();
82 |
83 | void Empty();
84 | void Resize(int iSize);
85 | bool IsEmpty() const;
86 | int Find(LPVOID iIndex) const;
87 | bool Add(LPVOID pData);
88 | bool SetAt(int iIndex, LPVOID pData);
89 | bool InsertAt(int iIndex, LPVOID pData);
90 | bool Remove(int iIndex);
91 | int GetSize() const;
92 | LPVOID* GetData();
93 |
94 | LPVOID GetAt(int iIndex) const;
95 | LPVOID operator[] (int nIndex) const;
96 |
97 | protected:
98 | LPVOID* m_ppVoid;
99 | int m_nCount;
100 | int m_nAllocated;
101 | };
102 | bool ParseRectString(LPCWSTR lpszRect, CUIRect& rc);
103 | bool ParseColorString(LPCWSTR lpszClolor, DWORD &dwColor);
104 | bool ParseBoolString(LPCWSTR lpszBool, bool& bValue);
105 | bool ParseSizeString(LPCWSTR lpszSize, CUISize& Size);
106 | #endif
--------------------------------------------------------------------------------
/gtkduilib/pugiconfig.hpp:
--------------------------------------------------------------------------------
1 | /**
2 | * pugixml parser - version 1.6
3 | * --------------------------------------------------------
4 | * Copyright (C) 2006-2015, by Arseny Kapoulkine (arseny.kapoulkine@gmail.com)
5 | * Report bugs and download new versions at http://pugixml.org/
6 | *
7 | * This library is distributed under the MIT License. See notice at the end
8 | * of this file.
9 | *
10 | * This work is based on the pugxml parser, which is:
11 | * Copyright (C) 2003, by Kristen Wegner (kristen@tima.net)
12 | */
13 |
14 | #ifndef HEADER_PUGICONFIG_HPP
15 | #define HEADER_PUGICONFIG_HPP
16 |
17 | // Uncomment this to enable wchar_t mode
18 | #define PUGIXML_WCHAR_MODE
19 |
20 | // Uncomment this to disable XPath
21 | // #define PUGIXML_NO_XPATH
22 |
23 | // Uncomment this to disable STL
24 | // #define PUGIXML_NO_STL
25 |
26 | // Uncomment this to disable exceptions
27 | // #define PUGIXML_NO_EXCEPTIONS
28 |
29 | // Set this to control attributes for public classes/functions, i.e.:
30 | // #define PUGIXML_API __declspec(dllexport) // to export all public symbols from DLL
31 | // #define PUGIXML_CLASS __declspec(dllimport) // to import all classes from DLL
32 | // #define PUGIXML_FUNCTION __fastcall // to set calling conventions to all public functions to fastcall
33 | // In absence of PUGIXML_CLASS/PUGIXML_FUNCTION definitions PUGIXML_API is used instead
34 |
35 | // Tune these constants to adjust memory-related behavior
36 | // #define PUGIXML_MEMORY_PAGE_SIZE 32768
37 | // #define PUGIXML_MEMORY_OUTPUT_STACK 10240
38 | // #define PUGIXML_MEMORY_XPATH_PAGE_SIZE 4096
39 |
40 | // Uncomment this to switch to header-only version
41 | // #define PUGIXML_HEADER_ONLY
42 |
43 | // Uncomment this to enable long long support
44 | // #define PUGIXML_HAS_LONG_LONG
45 |
46 | #endif
47 |
48 | /**
49 | * Copyright (c) 2006-2015 Arseny Kapoulkine
50 | *
51 | * Permission is hereby granted, free of charge, to any person
52 | * obtaining a copy of this software and associated documentation
53 | * files (the "Software"), to deal in the Software without
54 | * restriction, including without limitation the rights to use,
55 | * copy, modify, merge, publish, distribute, sublicense, and/or sell
56 | * copies of the Software, and to permit persons to whom the
57 | * Software is furnished to do so, subject to the following
58 | * conditions:
59 | *
60 | * The above copyright notice and this permission notice shall be
61 | * included in all copies or substantial portions of the Software.
62 | *
63 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
64 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
65 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
66 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
67 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
68 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
69 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
70 | * OTHER DEALINGS IN THE SOFTWARE.
71 | */
72 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | ## Ignore Visual Studio temporary files, build results, and
2 | ## files generated by popular Visual Studio add-ons.
3 |
4 | # User-specific files
5 | *.suo
6 | *.user
7 | *.userosscache
8 | *.sln.docstates
9 |
10 | # User-specific files (MonoDevelop/Xamarin Studio)
11 | *.userprefs
12 |
13 | # Build results
14 | [Dd]ebug/
15 | [Dd]ebugPublic/
16 | [Rr]elease/
17 | [Rr]eleases/
18 | x64/
19 | x86/
20 | build/
21 | bld/
22 | [Bb]in/
23 | [Oo]bj/
24 |
25 | # Visual Studo 2015 cache/options directory
26 | .vs/
27 |
28 | # MSTest test Results
29 | [Tt]est[Rr]esult*/
30 | [Bb]uild[Ll]og.*
31 |
32 | # NUNIT
33 | *.VisualState.xml
34 | TestResult.xml
35 |
36 | # Build Results of an ATL Project
37 | [Dd]ebugPS/
38 | [Rr]eleasePS/
39 | dlldata.c
40 |
41 | *_i.c
42 | *_p.c
43 | *_i.h
44 | *.ilk
45 | *.meta
46 | *.obj
47 | *.pch
48 | *.pdb
49 | *.pgc
50 | *.pgd
51 | *.rsp
52 | *.sbr
53 | *.tlb
54 | *.tli
55 | *.tlh
56 | *.tmp
57 | *.tmp_proj
58 | *.log
59 | *.vspscc
60 | *.vssscc
61 | .builds
62 | *.pidb
63 | *.svclog
64 | *.scc
65 |
66 | # Chutzpah Test files
67 | _Chutzpah*
68 |
69 | # Visual C++ cache files
70 | ipch/
71 | *.aps
72 | *.ncb
73 | *.opensdf
74 | *.sdf
75 | *.cachefile
76 |
77 | # Visual Studio profiler
78 | *.psess
79 | *.vsp
80 | *.vspx
81 |
82 | # TFS 2012 Local Workspace
83 | $tf/
84 |
85 | # Guidance Automation Toolkit
86 | *.gpState
87 |
88 | # ReSharper is a .NET coding add-in
89 | _ReSharper*/
90 | *.[Rr]e[Ss]harper
91 | *.DotSettings.user
92 |
93 | # JustCode is a .NET coding addin-in
94 | .JustCode
95 |
96 | # TeamCity is a build add-in
97 | _TeamCity*
98 |
99 | # DotCover is a Code Coverage Tool
100 | *.dotCover
101 |
102 | # NCrunch
103 | _NCrunch_*
104 | .*crunch*.local.xml
105 |
106 | # MightyMoose
107 | *.mm.*
108 | AutoTest.Net/
109 |
110 | # Web workbench (sass)
111 | .sass-cache/
112 |
113 | # Installshield output folder
114 | [Ee]xpress/
115 |
116 | # DocProject is a documentation generator add-in
117 | DocProject/buildhelp/
118 | DocProject/Help/*.HxT
119 | DocProject/Help/*.HxC
120 | DocProject/Help/*.hhc
121 | DocProject/Help/*.hhk
122 | DocProject/Help/*.hhp
123 | DocProject/Help/Html2
124 | DocProject/Help/html
125 |
126 | # Click-Once directory
127 | publish/
128 |
129 | # Publish Web Output
130 | *.[Pp]ublish.xml
131 | *.azurePubxml
132 | # TODO: Comment the next line if you want to checkin your web deploy settings
133 | # but database connection strings (with potential passwords) will be unencrypted
134 | *.pubxml
135 | *.publishproj
136 |
137 | # NuGet Packages
138 | *.nupkg
139 | # The packages folder can be ignored because of Package Restore
140 | **/packages/*
141 | # except build/, which is used as an MSBuild target.
142 | !**/packages/build/
143 | # Uncomment if necessary however generally it will be regenerated when needed
144 | #!**/packages/repositories.config
145 |
146 | # Windows Azure Build Output
147 | csx/
148 | *.build.csdef
149 |
150 | # Windows Store app package directory
151 | AppPackages/
152 |
153 | # Others
154 | *.[Cc]ache
155 | ClientBin/
156 | [Ss]tyle[Cc]op.*
157 | ~$*
158 | *~
159 | *.dbmdl
160 | *.dbproj.schemaview
161 | *.pfx
162 | *.publishsettings
163 | node_modules/
164 | bower_components/
165 |
166 | # RIA/Silverlight projects
167 | Generated_Code/
168 |
169 | # Backup & report files from converting an old project file
170 | # to a newer Visual Studio version. Backup files are not needed,
171 | # because we have git ;-)
172 | _UpgradeReport_Files/
173 | Backup*/
174 | UpgradeLog*.XML
175 | UpgradeLog*.htm
176 |
177 | # SQL Server files
178 | *.mdf
179 | *.ldf
180 |
181 | # Business Intelligence projects
182 | *.rdl.data
183 | *.bim.layout
184 | *.bim_*.settings
185 |
186 | # Microsoft Fakes
187 | FakesAssemblies/
188 |
189 | # Node.js Tools for Visual Studio
190 | .ntvs_analysis.dat
191 |
192 | # Visual Studio 6 build log
193 | *.plg
194 |
195 | # Visual Studio 6 workspace options file
196 | *.opt
197 |
--------------------------------------------------------------------------------
/skin/360SafeRes/ComputerExamine.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 |
--------------------------------------------------------------------------------
/skin/360SafeRes/ComputerExamine2.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 |
--------------------------------------------------------------------------------
/gtkduilib/UIString.h:
--------------------------------------------------------------------------------
1 |
2 | #ifndef __INDCLUDE_UISTRING__H__
3 | #define __INDCLUDE_UISTRING__H__
4 |
5 | #include
6 |
7 | #define MAX_LOCAL_STRING_LEN 63
8 |
9 | class CUIString
10 | {
11 | public:
12 | CUIString();
13 | CUIString(const WCHAR ch);
14 | CUIString(const CUIString& src);
15 | CUIString(LPCWSTR lpsz, int nLen = -1);
16 | ~CUIString();
17 |
18 | void Empty();
19 | int GetLength() const;
20 | bool IsEmpty() const;
21 | WCHAR GetAt(int nIndex) const;
22 | void Append(LPCWSTR pstr);
23 | void Assign(LPCWSTR pstr, int nLength = -1);
24 | LPCWSTR GetData() const;
25 |
26 | void SetAt(int nIndex, WCHAR ch);
27 | operator LPWSTR() const;
28 |
29 | WCHAR operator[] (int nIndex) const;
30 | const CUIString& operator=(const CUIString& src);
31 | const CUIString& operator=(const WCHAR ch);
32 | const CUIString& operator=(LPCWSTR pstr);
33 | CUIString operator+(const CUIString& src) const;
34 | CUIString operator+(LPCWSTR pstr) const;
35 | const CUIString& operator+=(const CUIString& src);
36 | const CUIString& operator+=(LPCWSTR pstr);
37 | const CUIString& operator+=(const WCHAR ch);
38 |
39 | bool operator == (const CUIString& str) const;
40 | bool operator == (LPCWSTR str) const;
41 | bool operator != (const CUIString& str) const;
42 | bool operator != (LPCWSTR str) const;
43 | bool operator <= (LPCWSTR str) const;
44 | bool operator < (LPCWSTR str) const;
45 | bool operator >= (LPCWSTR str) const;
46 | bool operator > (LPCWSTR str) const;
47 |
48 | int Compare(LPCWSTR pstr) const;
49 | int CompareNoCase(LPCWSTR pstr) const;
50 |
51 | void MakeUpper();
52 | void MakeLower();
53 |
54 | CUIString Left(int nLength) const;
55 | CUIString Mid(int iPos, int nLength = -1) const;
56 | CUIString Right(int nLength) const;
57 |
58 | int Find(WCHAR ch, int iPos = 0) const;
59 | int Find(LPCWSTR pstr, int iPos = 0) const;
60 | int ReverseFind(WCHAR ch) const;
61 | int Replace(LPCWSTR pstrFrom, LPCWSTR pstrTo);
62 |
63 | int __cdecl Format(LPCWSTR pstrFormat, ...);
64 | int __cdecl FormatV(LPCWSTR lpFormat, va_list Args);
65 | LONG toLong(int Radix = 10);
66 | ULONG toULong(int Radix = 10);
67 | protected:
68 | LPWSTR m_pstr;
69 | WCHAR m_szBuffer[MAX_LOCAL_STRING_LEN + 1];
70 | };
71 |
72 | class CU82W
73 | {
74 | public:
75 | CU82W(IN LPCSTR psz) : m_psz(NULL)
76 | {
77 | Init(psz);
78 | }
79 |
80 | ~CU82W()
81 | {
82 | if (m_psz){
83 | g_free(m_psz);
84 | }
85 | }
86 |
87 | operator LPWSTR() const
88 | {
89 | return (m_psz);
90 | }
91 |
92 | private:
93 | void Init(IN LPCSTR psz)
94 | {
95 | GError* Error;
96 |
97 | if (psz == NULL){
98 | m_psz = NULL;
99 | return;
100 | }
101 |
102 | if(sizeof(wchar_t) == 4){
103 | m_psz = (LPWSTR)g_utf8_to_ucs4(psz, -1, NULL, NULL, &Error);
104 | }else if(sizeof(wchar_t) == 2){
105 | m_psz = (LPWSTR)g_utf8_to_utf16(psz, -1, NULL, NULL, &Error);
106 | }
107 |
108 |
109 | if (m_psz == NULL){
110 | throw Error->code;
111 | }
112 | }
113 |
114 | public:
115 | LPWSTR m_psz;
116 | };
117 |
118 | class CW2U8
119 | {
120 | public:
121 | CW2U8(IN LPCWSTR psz) : m_psz(NULL)
122 | {
123 | Init(psz);
124 | }
125 |
126 | ~CW2U8() throw()
127 | {
128 |
129 | //
130 | // free the buffer.
131 | //
132 |
133 | if (m_psz){
134 | g_free(m_psz);
135 | }
136 | }
137 |
138 | operator LPSTR() const
139 | {
140 | return(m_psz);
141 | }
142 |
143 | private:
144 | void Init(IN LPCWSTR psz)
145 | {
146 | GError* Error;
147 | if (psz == NULL){
148 | m_psz = NULL;
149 | return;
150 | }
151 |
152 | if(sizeof(wchar_t) == 4){
153 | m_psz = (LPSTR)g_ucs4_to_utf8 ((const gunichar *)psz, -1, NULL, NULL, &Error);
154 | }else if(sizeof(wchar_t) == 2){
155 | m_psz = (LPSTR)g_utf16_to_utf8((const gunichar2 *)psz, -1, NULL, NULL, &Error);
156 | }
157 |
158 | if (m_psz == NULL){
159 | throw Error->code;
160 | }
161 | }
162 |
163 | private:
164 | LPSTR m_psz;
165 | };
166 |
167 | #endif
168 |
--------------------------------------------------------------------------------
/gtkduilib/UIText.cpp:
--------------------------------------------------------------------------------
1 | #include "stdafx.h"
2 | #include "UIText.h"
3 |
4 | CUIText::CUIText() : m_nLinks(0), m_nHoverLink(-1)
5 | {
6 | m_uTextStyle = DT_WORDBREAK;
7 | m_rcTextPadding.left = 2;
8 | m_rcTextPadding.right = 2;
9 | ::ZeroMemory(m_rcLinks, sizeof(m_rcLinks));
10 | }
11 |
12 | CUIText::~CUIText()
13 | {
14 | }
15 |
16 | CUIString CUIText::GetClass() const
17 | {
18 | return L"TextUI";
19 | }
20 |
21 | LPVOID CUIText::GetInterface(const CUIString& strName)
22 | {
23 | if(strName == DUI_CTR_TEXT)
24 | return static_cast(this);
25 | return
26 | CUILabel::GetInterface(strName);
27 | }
28 |
29 | UINT CUIText::GetControlFlags() const
30 | {
31 | if( IsEnabled() && m_nLinks > 0 )
32 | return UIFLAG_SETCURSOR;
33 | else
34 | return 0;
35 | }
36 |
37 | CUIString* CUIText::GetLinkContent(int iIndex)
38 | {
39 | if(iIndex >= 0 && iIndex < m_nLinks)
40 | return &m_sLinks[iIndex];
41 | return NULL;
42 | }
43 |
44 | void CUIText::DoEvent(TEventUI& event)
45 | {
46 | if( !IsMouseEnabled() && event.Type > UIEVENT__MOUSEBEGIN && event.Type < UIEVENT__MOUSEEND ) {
47 | if( m_Parent != NULL )
48 | m_Parent->DoEvent(event);
49 | else
50 | CUILabel::DoEvent(event);
51 | return;
52 | }
53 |
54 | if( event.Type == UIEVENT_SETCURSOR ) {
55 | for( int i = 0; i < m_nLinks; i++ ) {
56 | if(/* ::PtInRect(&m_rcLinks[i], event.ptMouse) */m_rcLinks[i].IsPtIn(event.ptMouse)) {
57 | //::SetCursor(::LoadCursor(NULL, MAKEINTRESOURCE(IDC_HAND)));
58 | return;
59 | }
60 | }
61 | }
62 | if( event.Type == UIEVENT_BUTTONDOWN || event.Type == UIEVENT_DBLCLICK && IsEnabled() ) {
63 | for( int i = 0; i < m_nLinks; i++ ) {
64 | if( /*::PtInRect(&m_rcLinks[i], event.ptMouse)*/ m_rcLinks[i].IsPtIn(event.ptMouse)) {
65 | Invalidate();
66 | return;
67 | }
68 | }
69 | }
70 | if( event.Type == UIEVENT_BUTTONUP && IsEnabled() ) {
71 | for( int i = 0; i < m_nLinks; i++ ) {
72 | if( /*::PtInRect(&m_rcLinks[i], event.ptMouse) */m_rcLinks[i].IsPtIn(event.ptMouse)) {
73 | m_Window->SendNotify(this, DUI_MSGTYPE_LINK, (WPARAM)i);
74 | return;
75 | }
76 | }
77 | }
78 | if( event.Type == UIEVENT_CONTEXTMENU )
79 | {
80 | return;
81 | }
82 | // When you move over a link
83 | if( m_nLinks > 0 && event.Type == UIEVENT_MOUSEMOVE && IsEnabled() ) {
84 | int nHoverLink = -1;
85 | for( int i = 0; i < m_nLinks; i++ ) {
86 | if( /*::PtInRect(&m_rcLinks[i], event.ptMouse)*/ m_rcLinks[i].IsPtIn(event.ptMouse)) {
87 | nHoverLink = i;
88 | break;
89 | }
90 | }
91 |
92 | if(m_nHoverLink != nHoverLink) {
93 | m_nHoverLink = nHoverLink;
94 | Invalidate();
95 | return;
96 | }
97 | }
98 | if( event.Type == UIEVENT_MOUSELEAVE ) {
99 | if( m_nLinks > 0 && IsEnabled() ) {
100 | if(m_nHoverLink != -1) {
101 | m_nHoverLink = -1;
102 | Invalidate();
103 | return;
104 | }
105 | }
106 | }
107 |
108 | CUILabel::DoEvent(event);
109 | }
110 |
111 | SIZE CUIText::EstimateSize(SIZE szAvailable)
112 | {
113 | CUIRect rcText(0, 0, MAX(szAvailable.cx, m_cxyFixed.cx), 9999);
114 | rcText.left += m_rcTextPadding.left;
115 | rcText.right -= m_rcTextPadding.right;
116 | CUIRect rcOut = rcText;
117 |
118 | CUIRender::DrawText(m_Window->GetPaintContext(), rcText, m_strText, m_uTextStyle|DT_CALCRECT,
119 | m_strFontName, m_dwTextColor, m_bShowHtml, &rcOut);
120 |
121 | SIZE cXY = {rcText.right - rcText.left + m_rcTextPadding.left + m_rcTextPadding.right,
122 | rcText.bottom - rcText.top + m_rcTextPadding.top + m_rcTextPadding.bottom};
123 |
124 | if( m_cxyFixed.cy != 0 ) cXY.cy = m_cxyFixed.cy;
125 | return cXY;
126 | }
127 |
128 | void CUIText::PaintText(cairo_t *cr)
129 | {
130 | if( m_strText.IsEmpty() ) {
131 | m_nLinks = 0;
132 | return;
133 | }
134 |
135 | if( m_dwTextColor == 0 ) m_dwTextColor = 0xFF000000/*m_pManager->GetDefaultFontColor()*/;
136 | if( m_dwDisabledTextColor == 0 ) m_dwDisabledTextColor = 0xFFA7A6AA/*m_pManager->GetDefaultDisabledColor()*/;
137 |
138 | if( m_strText.IsEmpty() ) return;
139 |
140 | m_nLinks = MAX_LINK/*lengthof(m_rcLinks)*/;
141 | CUIRect rc = m_rcItem;
142 | rc.left += m_rcTextPadding.left;
143 | rc.right -= m_rcTextPadding.right;
144 | rc.top += m_rcTextPadding.top;
145 | rc.bottom -= m_rcTextPadding.bottom;
146 | if(IsEnabled()) {
147 | CUIRender::DrawText(cr, rc, m_strText, m_uTextStyle,
148 | m_strFontName, m_dwTextColor, m_bShowHtml);
149 | }else{
150 | CUIRender::DrawText(cr, rc, m_strText, m_uTextStyle,
151 | m_strFontName, m_dwDisabledTextColor, m_bShowHtml);
152 | }
153 | }
154 |
--------------------------------------------------------------------------------
/gtkduilib/UIProgress.cpp:
--------------------------------------------------------------------------------
1 | #include "stdafx.h"
2 | #include "UIProgress.h"
3 |
4 | CUIProgress::CUIProgress() : m_bHorizontal(true), m_nMin(0), m_nMax(100),
5 | m_nValue(0), m_bStretchForeImage(true),
6 | m_nPadding(0)
7 | {
8 | m_uTextStyle = DT_SINGLELINE | DT_CENTER;
9 | SetFixedHeight(12);
10 | }
11 |
12 | CUIString CUIProgress::GetClass() const
13 | {
14 | return L"ProgressUI";
15 | }
16 |
17 | LPVOID CUIProgress::GetInterface(const CUIString& strName)
18 | {
19 | if(strName == DUI_CTR_PROGRESS)
20 | return static_cast(this);
21 | return CUILabel::GetInterface(strName);
22 | }
23 |
24 | bool CUIProgress::IsHorizontal()
25 | {
26 | return m_bHorizontal;
27 | }
28 |
29 | void CUIProgress::SetHorizontal(bool bHorizontal)
30 | {
31 | if( m_bHorizontal == bHorizontal ) return;
32 |
33 | m_bHorizontal = bHorizontal;
34 | Invalidate();
35 | }
36 |
37 | int CUIProgress::GetMinValue() const
38 | {
39 | return m_nMin;
40 | }
41 |
42 | void CUIProgress::SetMinValue(int nMin)
43 | {
44 | m_nMin = nMin;
45 | Invalidate();
46 | }
47 |
48 | int CUIProgress::GetMaxValue() const
49 | {
50 | return m_nMax;
51 | }
52 |
53 | void CUIProgress::SetMaxValue(int nMax)
54 | {
55 | m_nMax = nMax;
56 | Invalidate();
57 | }
58 |
59 | int CUIProgress::GetValue() const
60 | {
61 | return m_nValue;
62 | }
63 |
64 | void CUIProgress::SetValue(int nValue)
65 | {
66 | if(nValue == m_nValue || nValue m_nMax)
67 | {
68 | return;
69 | }
70 | m_nValue = nValue;
71 | Invalidate();
72 | }
73 |
74 |
75 | CUIString CUIProgress::GetForeImage() const
76 | {
77 | return m_strForeImage;
78 | }
79 |
80 | void CUIProgress::SetForeImage(const CUIString& strImage)
81 | {
82 | if( m_strForeImage == strImage ) return;
83 |
84 | m_strForeImage = strImage;
85 | Invalidate();
86 | }
87 |
88 |
89 | int CUIProgress::GetForePadding()
90 | {
91 | return m_nPadding;
92 | }
93 |
94 | void CUIProgress::SetForePadding(int nPadding)
95 | {
96 | m_nPadding = nPadding;
97 | }
98 |
99 | void CUIProgress::SetAttribute(LPCWSTR pstrName, LPCWSTR pstrValue)
100 | {
101 | if( wcscmp(pstrName, L"foreimage") == 0 )
102 | SetForeImage(pstrValue);
103 | else if( wcscmp(pstrName, L"hor") == 0 )
104 | SetHorizontal(wcscmp(pstrValue, L"true") == 0);
105 | else if( wcscmp(pstrName, L"min") == 0 )
106 | SetMinValue(/*_wtoi(pstrValue)*/wcstol(pstrValue, NULL, 10));
107 | else if( wcscmp(pstrName, L"max") == 0 )
108 | SetMaxValue(/*_wtoi(pstrValue)*/wcstol(pstrValue, NULL, 10));
109 | else if( wcscmp(pstrName, L"value") == 0 )
110 | SetValue(/*_wtoi(pstrValue)*/wcstol(pstrValue, NULL, 10));
111 | else if( wcscmp(pstrName, L"isstretchfore")==0)
112 | SetStretchForeImage(wcscmp(pstrValue, L"true") == 0);
113 | else
114 | CUILabel::SetAttribute(pstrName, pstrValue);
115 | }
116 |
117 |
118 | void CUIProgress::PaintStatusImage(cairo_t *cr)
119 | {
120 |
121 | CUIString strImageModify;
122 |
123 | if(m_nMax <= m_nMin)
124 | m_nMax = m_nMin + 1;
125 | if(m_nValue > m_nMax)
126 | m_nValue = m_nMax;
127 | if(m_nValue < m_nMin)
128 | m_nValue = m_nMin;
129 |
130 | CUIRect rc;
131 | if(m_bHorizontal){
132 | rc.right = (m_nValue - m_nMin) * (m_rcItem.right - m_rcItem.left - 2 * m_nPadding) / (m_nMax - m_nMin);
133 | rc.bottom = m_rcItem.bottom - m_rcItem.top;
134 | }else{
135 | rc.top = (m_rcItem.bottom - m_rcItem.top - 2 * m_nPadding) * (m_nMax - m_nValue) / (m_nMax - m_nMin);
136 | rc.right = m_rcItem.right - m_rcItem.left;
137 | rc.bottom = m_rcItem.bottom - m_rcItem.top;
138 | }
139 |
140 | if(!m_strForeImage.IsEmpty()) {
141 | if (m_bStretchForeImage){
142 | rc.left += m_nPadding;
143 | rc.right += m_nPadding;
144 | strImageModify.Format(L"dest='%d,%d,%d,%d'", rc.left, rc.top, rc.right, rc.bottom);
145 | }else{
146 | rc.right += m_nPadding;
147 | strImageModify.Format(L"dest='%d,%d,%d,%d' source='%d,%d,%d,%d'", rc.left,
148 | rc.top, rc.right, rc.bottom, rc.left, rc.top, rc.right, rc.bottom);
149 | }
150 | if(!DrawImage(cr, (LPCWSTR)m_strForeImage, (LPCWSTR)strImageModify))
151 | m_strForeImage.Empty();
152 | else
153 | return;
154 | }
155 |
156 | }
157 |
158 | bool CUIProgress::IsStretchForeImage()
159 | {
160 | return m_bStretchForeImage;
161 | }
162 |
163 | void CUIProgress::SetStretchForeImage(bool bStretchForeImage /*= true*/)
164 | {
165 | if (m_bStretchForeImage == bStretchForeImage)
166 | return;
167 |
168 | m_bStretchForeImage = bStretchForeImage;
169 | Invalidate();
170 | }
171 |
172 |
--------------------------------------------------------------------------------
/gtkduilib/gtkduilib.cbp:
--------------------------------------------------------------------------------
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 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
--------------------------------------------------------------------------------
/gtkduilib/UIScrollBar.h:
--------------------------------------------------------------------------------
1 | #ifndef __UISCROLLBAR_H__
2 | #define __UISCROLLBAR_H__
3 |
4 | #pragma once
5 |
6 | class CUIContainer;
7 |
8 | class CUIScrollBar : public CUIControl
9 | {
10 | public:
11 | CUIScrollBar();
12 |
13 | CUIString GetClass() const;
14 | LPVOID GetInterface(const CUIString& strName);
15 |
16 | CUIContainer* GetOwner() const;
17 | void SetOwner(CUIContainer* 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 | CUIString GetButton1NormalImage();
35 | void SetButton1NormalImage(const CUIString& strImage);
36 | CUIString GetButton1HotImage();
37 | void SetButton1HotImage(const CUIString& strImage);
38 | CUIString GetButton1PushedImage();
39 | void SetButton1PushedImage(const CUIString& strImage);
40 | CUIString GetButton1DisabledImage();
41 | void SetButton1DisabledImage(const CUIString& strImage);
42 |
43 | bool GetShowButton2();
44 | void SetShowButton2(bool bShow);
45 | CUIString GetButton2NormalImage();
46 | void SetButton2NormalImage(const CUIString& strImage);
47 | CUIString GetButton2HotImage();
48 | void SetButton2HotImage(const CUIString& strImage);
49 | CUIString GetButton2PushedImage();
50 | void SetButton2PushedImage(const CUIString& strImage);
51 | CUIString GetButton2DisabledImage();
52 | void SetButton2DisabledImage(const CUIString& strImage);
53 |
54 | CUIString GetThumbNormalImage();
55 | void SetThumbNormalImage(const CUIString& strImage);
56 | CUIString GetThumbHotImage();
57 | void SetThumbHotImage(const CUIString& strImage);
58 | CUIString GetThumbPushedImage();
59 | void SetThumbPushedImage(const CUIString& strImage);
60 | CUIString GetThumbDisabledImage();
61 | void SetThumbDisabledImage(const CUIString& strImage);
62 |
63 | CUIString GetRailNormalImage();
64 | void SetRailNormalImage(const CUIString& strImage);
65 | CUIString GetRailHotImage();
66 | void SetRailHotImage(const CUIString& strImage);
67 | CUIString GetRailPushedImage();
68 | void SetRailPushedImage(const CUIString& strImage);
69 | CUIString GetRailDisabledImage();
70 | void SetRailDisabledImage(const CUIString& strImage);
71 |
72 | CUIString GetBkNormalImage();
73 | void SetBkNormalImage(const CUIString& strImage);
74 | CUIString GetBkHotImage();
75 | void SetBkHotImage(const CUIString& strImage);
76 | CUIString GetBkPushedImage();
77 | void SetBkPushedImage(const CUIString& strImage);
78 | CUIString GetBkDisabledImage();
79 | void SetBkDisabledImage(const CUIString& strImage);
80 |
81 | void SetPos(const CUIRect& rc);
82 | void DoEvent(TEventUI& event);
83 | void SetAttribute(LPCWSTR pstrName, LPCWSTR pstrValue);
84 |
85 | void DoPaint(cairo_t *cr, const CUIRect& rcPaint);
86 |
87 | void PaintBk(cairo_t *cr);
88 | void PaintButton1(cairo_t *cr);
89 | void PaintButton2(cairo_t *cr);
90 | void PaintThumb(cairo_t *cr);
91 | void PaintRail(cairo_t *cr);
92 |
93 | protected:
94 |
95 | enum
96 | {
97 | DEFAULT_SCROLLBAR_SIZE = 16,
98 | DEFAULT_TIMERID = 10,
99 | };
100 |
101 | bool m_bHorizontal;
102 | int m_nRange;
103 | int m_nScrollPos;
104 | int m_nLineSize;
105 | CUIContainer* m_pOwner;
106 | POINT ptLastMouse;
107 | int m_nLastScrollPos;
108 | int m_nLastScrollOffset;
109 | int m_nScrollRepeatDelay;
110 | UINT m_TimerId;
111 |
112 | CUIString m_sBkNormalImage;
113 | CUIString m_sBkHotImage;
114 | CUIString m_sBkPushedImage;
115 | CUIString m_sBkDisabledImage;
116 |
117 | bool m_bShowButton1;
118 | CUIRect m_rcButton1;
119 | UINT m_uButton1State;
120 | CUIString m_sButton1NormalImage;
121 | CUIString m_sButton1HotImage;
122 | CUIString m_sButton1PushedImage;
123 | CUIString m_sButton1DisabledImage;
124 |
125 | bool m_bShowButton2;
126 | CUIRect m_rcButton2;
127 | UINT m_uButton2State;
128 | CUIString m_sButton2NormalImage;
129 | CUIString m_sButton2HotImage;
130 | CUIString m_sButton2PushedImage;
131 | CUIString m_sButton2DisabledImage;
132 |
133 | CUIRect m_rcThumb;
134 | UINT m_uThumbState;
135 | CUIString m_sThumbNormalImage;
136 | CUIString m_sThumbHotImage;
137 | CUIString m_sThumbPushedImage;
138 | CUIString m_sThumbDisabledImage;
139 |
140 | CUIString m_sRailNormalImage;
141 | CUIString m_sRailHotImage;
142 | CUIString m_sRailPushedImage;
143 | CUIString m_sRailDisabledImage;
144 |
145 | CUIString m_sImageModify;
146 | };
147 |
148 | #endif // __UISCROLLBAR_H__
--------------------------------------------------------------------------------
/gtkduilib/compat.h:
--------------------------------------------------------------------------------
1 | #ifndef __COMPAT__H__
2 | #define __COMPAT__H__
3 |
4 | #ifndef WIN32
5 |
6 | #define __cdecl
7 | #define PASCAL
8 | #define CALLBACK
9 |
10 | #define CONST const
11 |
12 | #define RtlZeroMemory(Destination,Length) memset((Destination),0,(Length))
13 | #define ZeroMemory RtlZeroMemory
14 |
15 | #define IN
16 | #define OUT
17 |
18 | #ifndef MAX
19 | #define MAX(a,b) (((a) > (b)) ? (a) : (b))
20 | #endif
21 |
22 | #ifndef MIN
23 | #define MIN(a,b) (((a) < (b)) ? (a) : (b))
24 | #endif
25 |
26 | #define CS_DBLCLKS 0x0008
27 |
28 | #define VK_RETURN 0x0D
29 |
30 | #define VK_SHIFT 0x10
31 | #define VK_CONTROL 0x11
32 | #define VK_MENU 0x12
33 | #define VK_PAUSE 0x13
34 | #define VK_CAPITAL 0x14
35 |
36 | #define VK_ESCAPE 0x1B
37 |
38 | #define VK_SPACE 0x20
39 | #define VK_PRIOR 0x21
40 | #define VK_NEXT 0x22
41 | #define VK_END 0x23
42 | #define VK_HOME 0x24
43 | #define VK_LEFT 0x25
44 | #define VK_UP 0x26
45 | #define VK_RIGHT 0x27
46 | #define VK_DOWN 0x28
47 | #define VK_SELECT 0x29
48 | #define VK_PRINT 0x2A
49 | #define VK_EXECUTE 0x2B
50 | #define VK_SNAPSHOT 0x2C
51 | #define VK_INSERT 0x2D
52 | #define VK_DELETE 0x2E
53 | #define VK_HELP 0x2F
54 |
55 | typedef wchar_t WCHAR;
56 | typedef const WCHAR *LPCWSTR, *PCWSTR;
57 | typedef WCHAR *LPWSTR, *PWSTR;
58 | typedef unsigned long ULONG;
59 | typedef long LONG;
60 | typedef char CHAR;
61 | typedef CHAR *LPSTR, *PSTR;
62 | typedef const CHAR *LPCSTR, PCSTR;
63 | typedef ULONG DWORD;
64 | typedef unsigned short USHORT;
65 | typedef USHORT WORD;
66 | typedef void *LPVOID, *PVOID;
67 | typedef void VOID;
68 | typedef int BOOL;
69 | typedef LPVOID WPARAM;
70 | typedef LPVOID LPARAM;
71 | typedef LONG LRESULT;
72 | typedef unsigned int UINT;
73 | typedef int INT;
74 | typedef unsigned char BYTE;
75 | typedef PVOID UINT_PTR;
76 |
77 |
78 | #define LOWORD(l) ((WORD)(((DWORD)(l)) & 0xffff))
79 | #define HIWORD(l) ((WORD)((((DWORD)(l)) >> 16) & 0xffff))
80 | #define LOBYTE(w) ((BYTE)(((DWORD)(w)) & 0xff))
81 | #define HIBYTE(w) ((BYTE)((((DWORD)(w)) >> 8) & 0xff))
82 |
83 | #ifndef FALSE
84 | #define FALSE 0
85 | #endif
86 |
87 | #ifndef TRUE
88 | #define TRUE 1
89 | #endif
90 |
91 | typedef struct tagRECT
92 | {
93 | LONG left;
94 | LONG top;
95 | LONG right;
96 | LONG bottom;
97 | } RECT, *PRECT, *LPRECT;
98 |
99 | typedef struct tagSIZE
100 | {
101 | LONG cx;
102 | LONG cy;
103 | } SIZE, *PSIZE, *LPSIZE;
104 |
105 | typedef struct tagPOINT
106 | {
107 | LONG x;
108 | LONG y;
109 | } POINT, *PPOINT,*LPPOINT;
110 |
111 | /*
112 | * DrawText() Format Flags
113 | */
114 | #define DT_TOP 0x00000000
115 | #define DT_LEFT 0x00000000
116 | #define DT_CENTER 0x00000001
117 | #define DT_RIGHT 0x00000002
118 | #define DT_VCENTER 0x00000004
119 | #define DT_BOTTOM 0x00000008
120 | #define DT_WORDBREAK 0x00000010
121 | #define DT_SINGLELINE 0x00000020
122 | #define DT_EXPANDTABS 0x00000040
123 | #define DT_TABSTOP 0x00000080
124 | #define DT_NOCLIP 0x00000100
125 | #define DT_EXTERNALLEADING 0x00000200
126 | #define DT_CALCRECT 0x00000400
127 | #define DT_NOPREFIX 0x00000800
128 |
129 | /*
130 | * Scroll Bar Commands
131 | */
132 | #define SB_LINEUP 0
133 | #define SB_LINELEFT 0
134 | #define SB_LINEDOWN 1
135 | #define SB_LINERIGHT 1
136 | #define SB_PAGEUP 2
137 | #define SB_PAGELEFT 2
138 | #define SB_PAGEDOWN 3
139 | #define SB_PAGERIGHT 3
140 | #define SB_THUMBPOSITION 4
141 | #define SB_THUMBTRACK 5
142 | #define SB_TOP 6
143 | #define SB_LEFT 6
144 | #define SB_BOTTOM 7
145 | #define SB_RIGHT 7
146 | #define SB_ENDSCROLL 8
147 |
148 | #define DT_END_ELLIPSIS 0x00008000
149 |
150 | /*
151 | * Key State Masks for Mouse Messages
152 | */
153 | #define MK_LBUTTON 0x0001
154 | #define MK_RBUTTON 0x0002
155 | #define MK_SHIFT 0x0004
156 | #define MK_CONTROL 0x0008
157 | #define MK_MBUTTON 0x0010
158 |
159 | #define MAKELONG(a, b) ((LONG)(((WORD)(((DWORD)(a)) & 0xffff)) | ((DWORD)((WORD)(((DWORD)(b)) & 0xffff))) << 16))
160 | #define MAKELPARAM(l, h) ((LPARAM)(DWORD)MAKELONG(l, h))
161 |
162 | #endif // WIN32
163 |
164 | #endif // __COMPAT__H__
165 |
--------------------------------------------------------------------------------
/gtkduilib/UITabLayout.cpp:
--------------------------------------------------------------------------------
1 | #include "stdafx.h"
2 | #include "UITabLayout.h"
3 |
4 | CUITabLayout::CUITabLayout() : m_iCurSel(-1)
5 | {
6 | }
7 |
8 | CUIString CUITabLayout::GetClass() const
9 | {
10 | return L"TabLayoutUI";
11 | }
12 |
13 | LPVOID CUITabLayout::GetInterface(const CUIString& strName)
14 | {
15 | if(strName == DUI_CTR_TABLAYOUT)
16 | return static_cast(this);
17 | return CUIContainer::GetInterface(strName);
18 | }
19 |
20 | bool CUITabLayout::Add(CUIControl* pControl)
21 | {
22 | bool ret = CUIContainer::Add(pControl);
23 | if( !ret ) return ret;
24 |
25 | if(m_iCurSel == -1 && pControl->IsVisible())
26 | {
27 | m_iCurSel = GetItemIndex(pControl);
28 | }
29 | else
30 | {
31 | pControl->SetVisible(false);
32 | }
33 |
34 | return ret;
35 | }
36 |
37 | bool CUITabLayout::AddAt(CUIControl* pControl, int iIndex)
38 | {
39 | bool ret = CUIContainer::AddAt(pControl, iIndex);
40 | if( !ret ) return ret;
41 |
42 | if(m_iCurSel == -1 && pControl->IsVisible())
43 | {
44 | m_iCurSel = GetItemIndex(pControl);
45 | }
46 | else if( m_iCurSel != -1 && iIndex <= m_iCurSel )
47 | {
48 | m_iCurSel += 1;
49 | }
50 | else
51 | {
52 | pControl->SetVisible(false);
53 | }
54 |
55 | return ret;
56 | }
57 |
58 | bool CUITabLayout::Remove(CUIControl* pControl)
59 | {
60 | if( pControl == NULL) return false;
61 |
62 | int index = GetItemIndex(pControl);
63 | bool ret = CUIContainer::Remove(pControl);
64 | if( !ret ) return false;
65 |
66 | if( m_iCurSel == index)
67 | {
68 | if( GetCount() > 0 )
69 | {
70 | m_iCurSel=0;
71 | GetItemAt(m_iCurSel)->SetVisible(true);
72 | }
73 | else
74 | m_iCurSel=-1;
75 | NeedParentUpdate();
76 | }
77 | else if( m_iCurSel > index )
78 | {
79 | m_iCurSel -= 1;
80 | }
81 |
82 | return ret;
83 | }
84 |
85 | void CUITabLayout::RemoveAll()
86 | {
87 | m_iCurSel = -1;
88 | CUIContainer::RemoveAll();
89 | NeedParentUpdate();
90 | }
91 |
92 | int CUITabLayout::GetCurSel() const
93 | {
94 | return m_iCurSel;
95 | }
96 |
97 | bool CUITabLayout::SelectItem(int iIndex)
98 | {
99 | if(iIndex < 0 || iIndex >= m_items.GetSize())
100 | return false;
101 | if(iIndex == m_iCurSel)
102 | return true;
103 |
104 | int iOldSel = m_iCurSel;
105 | m_iCurSel = iIndex;
106 | for(int it = 0; it < m_items.GetSize(); it++){
107 | if(it == iIndex){
108 | GetItemAt(it)->SetVisible(true);
109 |
110 | //
111 | // TODO SetFocus
112 | //
113 |
114 | //GetItemAt(it)->SetFocus();
115 | SetPos(m_rcItem);
116 | }else
117 | GetItemAt(it)->SetVisible(false);
118 | }
119 | NeedParentUpdate();
120 |
121 | if(m_Window){
122 |
123 | //
124 | // TODO: SetNextTabControl
125 | //
126 |
127 | //m_Window->SetNextTabControl();
128 | m_Window->SendNotify(this, DUI_MSGTYPE_TABSELECT, (WPARAM)m_iCurSel, (LPARAM)iOldSel);
129 | }
130 | return true;
131 | }
132 |
133 | bool CUITabLayout::SelectItem(CUIControl* pControl)
134 | {
135 | int iIndex=GetItemIndex(pControl);
136 | if (iIndex==-1)
137 | return false;
138 | else
139 | return SelectItem(iIndex);
140 | }
141 |
142 | void CUITabLayout::SetAttribute(LPCWSTR pstrName, LPCWSTR pstrValue)
143 | {
144 | if(wcscmp(pstrName, L"selectedid") == 0)
145 | SelectItem(/*_wtoi(pstrValue)*/ wcstol(pstrValue, NULL, 10));
146 | return
147 | CUIContainer::SetAttribute(pstrName, pstrValue);
148 | }
149 |
150 | void CUITabLayout::SetPos(const CUIRect& rc)
151 | {
152 | CUIRect rcTemp = rc;
153 | CUIControl::SetPos(rc);
154 | rcTemp = m_rcItem;
155 |
156 | //
157 | // Adjust for inset
158 | //
159 |
160 | rcTemp.left += m_rcInset.left;
161 | rcTemp.top += m_rcInset.top;
162 | rcTemp.right -= m_rcInset.right;
163 | rcTemp.bottom -= m_rcInset.bottom;
164 |
165 | for( int it = 0; it < m_items.GetSize(); it++ ) {
166 | CUIControl* pControl = static_cast(m_items[it]);
167 | if( !pControl->IsVisible() ) continue;
168 | if( pControl->IsFloat() ) {
169 | SetFloatPos(it);
170 | continue;
171 | }
172 |
173 | if( it != m_iCurSel )
174 | continue;
175 |
176 | RECT rcPadding = pControl->GetPadding();
177 | rcTemp.left += rcPadding.left;
178 | rcTemp.top += rcPadding.top;
179 | rcTemp.right -= rcPadding.right;
180 | rcTemp.bottom -= rcPadding.bottom;
181 |
182 | SIZE szAvailable = {rcTemp.GetWidth(), rcTemp.GetHeight()};
183 |
184 | SIZE sz = pControl->EstimateSize(szAvailable);
185 | if( sz.cx == 0 ) {
186 | sz.cx = MAX(0, szAvailable.cx);
187 | }
188 | if( sz.cx < pControl->GetMinWidth() )
189 | sz.cx = pControl->GetMinWidth();
190 | if( sz.cx > pControl->GetMaxWidth() )
191 | sz.cx = pControl->GetMaxWidth();
192 |
193 | if(sz.cy == 0) {
194 | sz.cy = MAX(0, szAvailable.cy);
195 | }
196 | if( sz.cy < pControl->GetMinHeight() )
197 | sz.cy = pControl->GetMinHeight();
198 | if( sz.cy > pControl->GetMaxHeight() )
199 | sz.cy = pControl->GetMaxHeight();
200 |
201 | CUIRect rcCtrl(rcTemp.left, rcTemp.top, rcTemp.left + sz.cx, rcTemp.top + sz.cy);
202 | pControl->SetPos(rcCtrl);
203 | }
204 | }
205 |
--------------------------------------------------------------------------------
/360Demo/main.cpp:
--------------------------------------------------------------------------------
1 | // gtkduilib_test.cpp : Defines the entry point for the console application.
2 | //
3 |
4 |
5 | #include
6 | #include "../gtkduilib/UILib.h"
7 |
8 | const wchar_t * gszMsg[] = {
9 | L"DUI_MSGTYPE_MENU",
10 | L"DUI_MSGTYPE_LINK",
11 | L"DUI_MSGTYPE_TIMER",
12 | L"DUI_MSGTYPE_CLICK",
13 | L"DUI_MSGTYPE_RETURN",
14 | L"DUI_MSGTYPE_SCROLL",
15 | L"DUI_MSGTYPE_DROPDOWN",
16 | L"DUI_MSGTYPE_SETFOCUS",
17 | L"DUI_MSGTYPE_KILLFOCUS",
18 | L"DUI_MSGTYPE_ITEMCLICK",
19 | L"DUI_MSGTYPE_TABSELECT",
20 | L"DUI_MSGTYPE_ITEMSELECT",
21 | L"DUI_MSGTYPE_ITEMEXPAND",
22 | L"DUI_MSGTYPE_WINDOWINIT",
23 | L"DUI_MSGTYPE_BUTTONDOWN",
24 | L"DUI_MSGTYPE_MOUSEENTER",
25 | L"DUI_MSGTYPE_MOUSELEAVE",
26 | L"DUI_MSGTYPE_TEXTCHANGED",
27 | L"DUI_MSGTYPE_HEADERCLICK",
28 | L"DUI_MSGTYPE_ITEMDBCLICK",
29 | L"DUI_MSGTYPE_SHOWACTIVEX",
30 | L"DUI_MSGTYPE_ITEMCOLLAPSE",
31 | L"DUI_MSGTYPE_ITEMACTIVATE",
32 | L"DUI_MSGTYPE_VALUECHANGED",
33 | L"DUI_MSGTYPE_SELECTCHANGED"
34 | };
35 |
36 |
37 | class ComputerExamineUI : public CUIContainer
38 | {
39 | public:
40 | ComputerExamineUI()
41 | {
42 | CDialogBuilder builder;
43 | CUIContainer* pComputerExamine = static_cast(builder.Create(L"ComputerExamine2.xml"));
44 | if( pComputerExamine ) {
45 | this->Add(pComputerExamine);
46 | }
47 | else {
48 | this->RemoveAll();
49 | return;
50 | }
51 | }
52 | };
53 |
54 | class CDialogBuilderCallbackEx : public IDialogBuilderCallback
55 | {
56 | public:
57 | CUIControl* CreateControl(const CUIString& strClass)
58 | {
59 | if(strClass == L"ComputerExamine")
60 | return new ComputerExamineUI;
61 | return NULL;
62 | }
63 | };
64 | class CSkinWnd : public CWindowImpBase
65 | {
66 | public:
67 | CSkinWnd(){};
68 | virtual ~CSkinWnd(){};
69 |
70 | public:
71 | CUIString GetWindowClassName(void) const
72 | {
73 | return L"skinwnd";
74 | }
75 | CUIString GetSkinFolder()
76 | {
77 | return L"";
78 | }
79 | CUIString GetSkinFile()
80 | {
81 | return L"";
82 | }
83 |
84 | bool OnClose(int Msg, WPARAM wParam, LPARAM lParam)
85 | {
86 | g_print("on close()");
87 | return false;
88 | }
89 |
90 | void OnDestroy(int, WPARAM, LPARAM)
91 | {
92 | gtk_main_quit();
93 | }
94 |
95 | void InitWindow()
96 | {
97 | //AddNotifier(this);
98 | CDialogBuilder builer;
99 | CDialogBuilderCallbackEx cb;
100 | builer.SetCallback(&cb);
101 | CUIControl *pRoot = builer.Create(L"skin2.xml", this, NULL);
102 | if (pRoot){
103 | AttachDlg(pRoot);
104 | AddNotifier(this);
105 | }
106 | }
107 |
108 | void Notify(TNotifyUI& msg)
109 | {
110 | if (msg.Type <= (sizeof(gszMsg) / sizeof(gszMsg[0]) + 0x40000000)){
111 | wprintf(L"msg %s sender %s\n", gszMsg[msg.Type-0x40000000], (LPCWSTR)msg.pSender->GetName());
112 | }
113 |
114 | if (msg.Type == DUI_MSGTYPE_CLICK && msg.pSender->GetName() == L"button"){
115 | Close();
116 | }
117 |
118 | else if(msg.Type == DUI_MSGTYPE_SELECTCHANGED)
119 | {
120 | CUIString name = msg.pSender->GetName();
121 | CUITabLayout* pControl = static_cast(FindControl(L"switch"));
122 | if(name==L"examine")
123 | pControl->SelectItem(0);
124 | else if(name==L"trojan")
125 | pControl->SelectItem(1);
126 | else if(name==L"plugins")
127 | pControl->SelectItem(2);
128 | else if(name==L"vulnerability")
129 | pControl->SelectItem(3);
130 | else if(name==L"rubbish")
131 | pControl->SelectItem(4);
132 | else if(name==L"cleanup")
133 | pControl->SelectItem(5);
134 | else if(name==L"fix")
135 | pControl->SelectItem(6);
136 | else if(name==L"tool")
137 | pControl->SelectItem(7);
138 | }
139 | CWindowImpBase::Notify(msg);
140 | }
141 |
142 | void OnClick(TNotifyUI& msg)
143 | {
144 | g_print("click event\n");
145 | if (msg.Type == DUI_MSGTYPE_CLICK && msg.pSender->GetName() == L"button"){
146 | Close();
147 | }
148 | }
149 |
150 | private:
151 | CUIButton button;
152 | CUIProgress Progress;
153 | CUISlider Slider;
154 | CUILabel Label;
155 | CUIContainer Container;
156 | public:
157 | DUI_DECLARE_MESSAGE_MAP()
158 | };
159 |
160 | DUI_BEGIN_MESSAGE_MAP(CSkinWnd, CNotifyPump)
161 | DUI_ON_MSGTYPE(DUI_MSGTYPE_CLICK, CSkinWnd::OnClick)
162 | DUI_END_MESSAGE_MAP()
163 |
164 | #ifdef WIN32
165 | #include
166 | int _tmain(int argc, _TCHAR* argv[])
167 | #else
168 | int main(int argc, char* argv[])
169 | #endif
170 | {
171 | //CResourceMgr ss;
172 |
173 | gtk_init(NULL, NULL);
174 |
175 | CSkinWnd Window;
176 | //CResourceMgr::GetInstance().SetResourePath(L"/home/pgboy/qyplayer");
177 | CResourceMgr::GetInstance().SetResourePath(L"../skin/360SafeRes");
178 |
179 | Window.Create(0, 0, /*400*/800, /*500*/570);
180 |
181 | Window.CenterWindow();
182 | Window.Show();
183 | Window.MainLoop();
184 |
185 | //gtk_main_quit();
186 |
187 | return 0;
188 | }
189 |
190 |
191 |
--------------------------------------------------------------------------------
/skin/qyplayer/test1.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 |
--------------------------------------------------------------------------------
/gtkduilib_test/gtkduilib_test.vcproj:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
15 |
16 |
17 |
18 |
19 |
26 |
29 |
32 |
35 |
38 |
41 |
54 |
57 |
60 |
63 |
70 |
73 |
76 |
79 |
82 |
85 |
88 |
91 |
92 |
100 |
103 |
106 |
109 |
112 |
115 |
126 |
129 |
132 |
135 |
144 |
147 |
150 |
153 |
156 |
159 |
162 |
165 |
166 |
167 |
168 |
169 |
170 |
175 |
178 |
179 |
182 |
185 |
189 |
190 |
193 |
197 |
198 |
199 |
200 |
205 |
208 |
209 |
212 |
213 |
214 |
219 |
220 |
223 |
224 |
225 |
226 |
227 |
228 |
--------------------------------------------------------------------------------
/gtkduilib/UILabel.cpp:
--------------------------------------------------------------------------------
1 | #include "stdafx.h"
2 | #include "UILabel.h"
3 |
4 | CUILabel::CUILabel() : m_uTextStyle(DT_VCENTER), m_dwTextColor(0),
5 | m_dwDisabledTextColor(0), m_bShowHtml(false), m_strFontName(L"")
6 | {
7 | }
8 |
9 | CUIString CUILabel::GetClass() const
10 | {
11 | return L"LabelUI";
12 | }
13 |
14 | LPVOID CUILabel::GetInterface(const CUIString& strName)
15 | {
16 | if(strName == DUI_CTR_LABEL)
17 | return static_cast(this);
18 | return CUIControl::GetInterface(strName);
19 | }
20 |
21 | void CUILabel::SetTextStyle(UINT uStyle)
22 | {
23 | m_uTextStyle = uStyle;
24 | Invalidate();
25 | }
26 |
27 | UINT CUILabel::GetTextStyle() const
28 | {
29 | return m_uTextStyle;
30 | }
31 |
32 | void CUILabel::SetTextColor(DWORD dwTextColor)
33 | {
34 | m_dwTextColor = dwTextColor;
35 | Invalidate();
36 | }
37 |
38 | DWORD CUILabel::GetTextColor() const
39 | {
40 | return m_dwTextColor;
41 | }
42 |
43 | void CUILabel::SetDisabledTextColor(DWORD dwTextColor)
44 | {
45 | m_dwDisabledTextColor = dwTextColor;
46 | Invalidate();
47 | }
48 |
49 | DWORD CUILabel::GetDisabledTextColor() const
50 | {
51 | return m_dwDisabledTextColor;
52 | }
53 |
54 | void CUILabel::SetFont(const CUIString &strFontName)
55 | {
56 | m_strFontName = strFontName;
57 | Invalidate();
58 | }
59 |
60 | CUIString CUILabel::GetFont() const
61 | {
62 | return m_strFontName;
63 | }
64 |
65 | CUIRect CUILabel::GetTextPadding() const
66 | {
67 | return m_rcTextPadding;
68 | }
69 |
70 | void CUILabel::SetTextPadding(const CUIRect& rc)
71 | {
72 | m_rcTextPadding = rc;
73 | Invalidate();
74 | }
75 |
76 | bool CUILabel::IsShowHtml()
77 | {
78 | return m_bShowHtml;
79 | }
80 |
81 | void CUILabel::SetShowHtml(bool bShowHtml)
82 | {
83 | if(m_bShowHtml == bShowHtml)
84 | return;
85 |
86 | m_bShowHtml = bShowHtml;
87 | Invalidate();
88 | }
89 |
90 | SIZE CUILabel::EstimateSize(SIZE szAvailable)
91 | {
92 | if(m_cxyFixed.cy == 0) {
93 | return CUISize(m_cxyFixed.cx, CResourceMgr::GetInstance().GetFontHeight(m_strFontName) + 4);
94 | }
95 | return
96 | CUIControl::EstimateSize(szAvailable);
97 | }
98 |
99 | void CUILabel::DoEvent(TEventUI& Event)
100 | {
101 | if(Event.Type == UIEVENT_SETFOCUS){
102 | m_bFocused = true;
103 | return;
104 | }
105 | if(Event.Type == UIEVENT_KILLFOCUS){
106 | m_bFocused = false;
107 | return;
108 | }
109 | if(Event.Type == UIEVENT_MOUSEENTER){
110 | // return;
111 | }
112 | if(Event.Type == UIEVENT_MOUSELEAVE){
113 | // return;
114 | }
115 | CUIControl::DoEvent(Event);
116 | }
117 |
118 | void CUILabel::SetAttribute(LPCWSTR pstrName, LPCWSTR pstrValue)
119 | {
120 | CUIString strName = pstrName;
121 | if(strName == L"align"){
122 | if(wcsstr(pstrValue, L"left") != NULL){
123 | m_uTextStyle &= ~(DT_CENTER | DT_RIGHT);
124 | m_uTextStyle |= DT_LEFT;
125 | }
126 | if(wcsstr(pstrValue, L"center") != NULL){
127 | m_uTextStyle &= ~(DT_LEFT | DT_RIGHT);
128 | m_uTextStyle |= DT_CENTER;
129 | }
130 | if(wcsstr(pstrValue, L"right") != NULL){
131 | m_uTextStyle &= ~(DT_LEFT | DT_CENTER);
132 | m_uTextStyle |= DT_RIGHT;
133 | }
134 | if(wcsstr(pstrValue, L"top") != NULL){
135 | m_uTextStyle &= ~(DT_BOTTOM | DT_VCENTER);
136 | m_uTextStyle |= DT_TOP;
137 | }
138 | if(wcsstr(pstrValue, L"vcenter") != NULL){
139 | m_uTextStyle &= ~(DT_TOP | DT_BOTTOM);
140 | m_uTextStyle |= DT_VCENTER;
141 | }
142 | if(wcsstr(pstrValue, L"bottom") != NULL){
143 | m_uTextStyle &= ~(DT_TOP | DT_VCENTER);
144 | m_uTextStyle |= DT_BOTTOM;
145 | }
146 | }else if(wcscmp(pstrName, L"endellipsis") == 0){
147 | if(wcscmp(pstrValue, L"true") == 0)
148 | m_uTextStyle |= DT_END_ELLIPSIS;
149 | else
150 | m_uTextStyle &= ~DT_END_ELLIPSIS;
151 | }else if(wcscmp(pstrName, L"font") == 0){
152 | SetFont(pstrValue);
153 | }else if(wcscmp(pstrName, L"textcolor") == 0){
154 | if(*pstrValue == L'#')
155 | pstrValue = pstrValue + 1;
156 | LPWSTR pstr = NULL;
157 | DWORD clrColor = wcstoul(pstrValue, &pstr, 16);
158 | SetTextColor(clrColor);
159 | }
160 | else if(wcscmp(pstrName, L"disabledtextcolor") == 0){
161 | if(*pstrValue == L'#')
162 | pstrValue = pstrValue + 1;
163 | LPWSTR pstr = NULL;
164 | DWORD clrColor = wcstoul(pstrValue, &pstr, 16);
165 | SetDisabledTextColor(clrColor);
166 | }else if(wcscmp(pstrName, L"textpadding") == 0){
167 | CUIRect rcTextPadding;
168 | LPWSTR pstr = NULL;
169 | rcTextPadding.left = wcstol(pstrValue, &pstr, 10); //ASSERT(pstr);
170 | rcTextPadding.top = wcstol(pstr + 1, &pstr, 10); //ASSERT(pstr);
171 | rcTextPadding.right = wcstol(pstr + 1, &pstr, 10); //ASSERT(pstr);
172 | rcTextPadding.bottom = wcstol(pstr + 1, &pstr, 10); //ASSERT(pstr);
173 | SetTextPadding(rcTextPadding);
174 | }else if(wcscmp(pstrName, L"showhtml") == 0)
175 | SetShowHtml(wcscmp(pstrValue, L"true") == 0);
176 | else
177 | CUIControl::SetAttribute(pstrName, pstrValue);
178 | }
179 |
180 | void CUILabel::PaintText(cairo_t *cr)
181 | {
182 | DWORD dwTextColor;
183 | if(m_dwTextColor == 0)
184 | m_dwTextColor = 0xFF000000/*m_pManager->GetDefaultFontColor()*/;
185 | if(m_dwDisabledTextColor == 0)
186 | m_dwDisabledTextColor = 0xFFA7A6AA/*m_pManager->GetDefaultDisabledColor()*/;
187 |
188 | if(m_strText.IsEmpty())
189 | return;
190 |
191 | int nLinks = 0;
192 | CUIRect rc = m_rcItem;
193 | rc.left += m_rcTextPadding.left;
194 | rc.right -= m_rcTextPadding.right;
195 | rc.top += m_rcTextPadding.top;
196 | rc.bottom -= m_rcTextPadding.bottom;
197 |
198 | dwTextColor = IsEnabled() ? m_dwTextColor : m_dwDisabledTextColor;
199 |
200 | CUIRender::DrawText(cr, rc, m_strText, m_uTextStyle,
201 | m_strFontName, dwTextColor, m_bShowHtml);
202 | }
--------------------------------------------------------------------------------
/gtkduilib/ResourceMgr.cpp:
--------------------------------------------------------------------------------
1 | #include "stdafx.h"
2 |
3 | #ifdef WIN32
4 | #include
5 | #endif // WIN32
6 |
7 | #include
8 | #include
9 | #include
10 |
11 | #include "UIUtils.h"
12 | #include "UIString.h"
13 | #include "UIFont.h"
14 |
15 | #include "ResourceMgr.h"
16 |
17 | #define DEFAULT_FONT_KEY L"__default__"
18 |
19 | CResourceMgr::CResourceMgr(void)
20 | {
21 | }
22 |
23 | CResourceMgr::~CResourceMgr(void)
24 | {
25 |
26 | //
27 | // release all font
28 | //
29 |
30 | ReleaseAllFont();
31 | }
32 |
33 | CResourceMgr& CResourceMgr::GetInstance()
34 | {
35 | static CResourceMgr Instance;
36 | return Instance;
37 | }
38 |
39 | bool CResourceMgr::AddImage(const CUIString& strImage)
40 | {
41 | GdkPixbuf *Pixbuf = NULL;
42 | int i = 1;
43 |
44 | //
45 | // first add the resource path
46 | //
47 |
48 | CUIString strPath = m_strResDir + strImage;
49 |
50 | while (i-- > 0){
51 |
52 | //
53 | // load by gdk-pixbuf.
54 | //
55 |
56 | Pixbuf = gdk_pixbuf_new_from_file((LPCSTR)CW2U8(strPath), NULL);
57 | if (Pixbuf){
58 | break;
59 | }
60 |
61 | //
62 | // read from user param directly
63 | // try again
64 | //
65 |
66 | strPath = strImage;
67 | }
68 |
69 | if (Pixbuf){
70 |
71 | //
72 | // add pixbuf to map
73 | //
74 |
75 | if(!m_strImageMap.Insert(strImage, Pixbuf)){
76 |
77 | //
78 | // insert error. free the pixbuf.
79 | //
80 |
81 | g_object_unref(Pixbuf);
82 | return false;
83 | }
84 | return true;
85 | }
86 |
87 |
88 | //
89 | // image load error.
90 | //
91 |
92 | return false;
93 |
94 | }
95 |
96 | bool CResourceMgr::RemoveImage(const CUIString& lpstrImage)
97 | {
98 |
99 | //
100 | // first find it.
101 | //
102 |
103 | GdkPixbuf *Pixbuf = (GdkPixbuf *)m_strImageMap.Find(lpstrImage);
104 | if (Pixbuf){
105 |
106 | //
107 | // if we find the pixbuf release it and move it from hash table
108 | //
109 |
110 | g_object_unref(Pixbuf);
111 | return m_strImageMap.Remove(lpstrImage);
112 | }
113 | return false;
114 | }
115 |
116 | GdkPixbuf* CResourceMgr::GetImage(const CUIString& lpstrImage, bool bAdd)
117 | {
118 |
119 | GdkPixbuf *Pixbuf;
120 |
121 | //
122 | // first find the pixbuf by image
123 | //
124 |
125 | Pixbuf = (GdkPixbuf*)m_strImageMap.Find(lpstrImage);
126 | if (Pixbuf == NULL){
127 |
128 | //
129 | // can not found the pixbuf. check if we should add it to map
130 | //
131 |
132 | if (bAdd && AddImage(lpstrImage)){
133 | Pixbuf = (GdkPixbuf*)m_strImageMap.Find(lpstrImage);
134 | }
135 | }
136 |
137 | return Pixbuf;
138 | }
139 |
140 | CUIFont* CResourceMgr::GetFont(const CUIString& strName, const CUIString& strFacename /*= NULL*/,
141 | BOOL bDefault /*= FALSE*/, int nSize /*= 0*/, BOOL bBold /*= FALSE*/,
142 | BOOL bUnderLine /*= FALSE*/, BOOL bItalic /*= FALSE*/)
143 | {
144 | CUIFont* font = (CUIFont*)m_FontMap.Find((LPCWSTR)strName);
145 | if (!font){
146 |
147 | //
148 | // do not found it, create new font and add it to map.
149 | //
150 |
151 | font = new CUIFont(strName, strFacename, nSize, bBold, bUnderLine, bItalic);
152 | font->Create();
153 |
154 | m_FontMap.Set(strName, (PVOID)font);
155 |
156 | if (bDefault){
157 | m_DefaultFont = font;
158 | }
159 | }
160 |
161 | return font;
162 | }
163 |
164 | bool CResourceMgr::AddFont(const CUIString& strName, const CUIString& strFacename /*= NULL*/,
165 | BOOL bDefault /*= FALSE*/, int nSize /*= 0*/, BOOL bBold /*= FALSE*/,
166 | BOOL bUnderLine /*= FALSE*/, BOOL bItalic /*= FALSE*/)
167 | {
168 | CUIFont* font = (CUIFont*)m_FontMap.Find((LPCWSTR)strName);
169 | if (!font){
170 |
171 | //
172 | // do not found it, create new font and add it to map.
173 | //
174 |
175 | font = new CUIFont(strName, strFacename, nSize, bBold, bUnderLine, bItalic);
176 | font->Create();
177 |
178 | m_FontMap.Set(strName, (PVOID)font);
179 |
180 | if (bDefault){
181 | m_DefaultFont = font;
182 | }
183 | return true;
184 | }
185 |
186 | return false;
187 | }
188 |
189 | CUIFont* CResourceMgr::GetFont(const CUIString& strName)
190 | {
191 | return (CUIFont*) m_FontMap.Find(strName);
192 | }
193 |
194 | UINT CResourceMgr::GetFontHeight(const CUIString& strName)
195 | {
196 | CUIFont* font = NULL;
197 | if (strName.IsEmpty()){
198 | font = GetDefault();
199 | }else{
200 | font = (CUIFont*)m_FontMap.Find(strName);
201 | }
202 | if (font){
203 | return font->GetFontHeight();
204 | }
205 | return 12;
206 | }
207 |
208 | BOOL CResourceMgr::SetDefault(const CUIString& strName)
209 | {
210 | CUIFont* font = (CUIFont*)m_FontMap.Find(strName);
211 | if (font){
212 | m_DefaultFont = font;
213 | return TRUE;
214 | }
215 | return FALSE;
216 | }
217 |
218 | CUIFont* CResourceMgr::GetDefault()
219 | {
220 | if (!m_DefaultFont){
221 | m_DefaultFont = new CUIFont;
222 | m_DefaultFont->Create();
223 | m_FontMap.Set(DEFAULT_FONT_KEY, m_DefaultFont);
224 | }
225 |
226 | return m_DefaultFont;
227 | }
228 |
229 | UINT CResourceMgr::GetDefaultFontHeight()
230 | {
231 | return GetDefault()->GetFontHeight();
232 | }
233 |
234 | VOID CResourceMgr::ReleaseAllFont()
235 | {
236 | CUIFont *font;
237 | for( int i = 0; i< m_FontMap.GetSize(); i++ ) {
238 | if(LPCWSTR key = m_FontMap.GetAt(i)) {
239 | font = static_cast(m_FontMap.Find(key));
240 | delete font;
241 | }
242 | }
243 |
244 | m_FontMap.RemoveAll();
245 | }
246 |
247 | void CResourceMgr::SetResourePath(const CUIString& strResPath)
248 | {
249 | if (strResPath.IsEmpty()){
250 | return;
251 | }
252 | m_strResDir = strResPath;
253 | WCHAR cEnd = m_strResDir.GetAt(m_strResDir.GetLength() - 1);
254 | if(cEnd != L'\\' && cEnd != L'/'){
255 | #ifdef WIN32
256 | m_strResDir += L'\\';
257 | #else
258 | m_strResDir += L'/';
259 | #endif // WIN32
260 | }
261 |
262 | }
263 |
264 | CUIString CResourceMgr::GetResourePath()
265 | {
266 | return m_strResDir;
267 | }
268 |
--------------------------------------------------------------------------------
/gtkduilib_test/gtkduilib_test.cpp:
--------------------------------------------------------------------------------
1 | // gtkduilib_test.cpp : Defines the entry point for the console application.
2 | //
3 |
4 | #include "stdafx.h"
5 |
6 | #include
7 | #include "../gtkduilib/UILib.h"
8 |
9 | const wchar_t * gszMsg[] = {
10 | L"DUI_MSGTYPE_MENU",
11 | L"DUI_MSGTYPE_LINK",
12 | L"DUI_MSGTYPE_TIMER",
13 | L"DUI_MSGTYPE_CLICK",
14 | L"DUI_MSGTYPE_RETURN",
15 | L"DUI_MSGTYPE_SCROLL",
16 | L"DUI_MSGTYPE_DROPDOWN",
17 | L"DUI_MSGTYPE_SETFOCUS",
18 | L"DUI_MSGTYPE_KILLFOCUS",
19 | L"DUI_MSGTYPE_ITEMCLICK",
20 | L"DUI_MSGTYPE_TABSELECT",
21 | L"DUI_MSGTYPE_ITEMSELECT",
22 | L"DUI_MSGTYPE_ITEMEXPAND",
23 | L"DUI_MSGTYPE_WINDOWINIT",
24 | L"DUI_MSGTYPE_BUTTONDOWN",
25 | L"DUI_MSGTYPE_MOUSEENTER",
26 | L"DUI_MSGTYPE_MOUSELEAVE",
27 | L"DUI_MSGTYPE_TEXTCHANGED",
28 | L"DUI_MSGTYPE_HEADERCLICK",
29 | L"DUI_MSGTYPE_ITEMDBCLICK",
30 | L"DUI_MSGTYPE_SHOWACTIVEX",
31 | L"DUI_MSGTYPE_ITEMCOLLAPSE",
32 | L"DUI_MSGTYPE_ITEMACTIVATE",
33 | L"DUI_MSGTYPE_VALUECHANGED",
34 | L"DUI_MSGTYPE_SELECTCHANGED"
35 | };
36 |
37 |
38 | class ComputerExamineUI : public CUIContainer
39 | {
40 | public:
41 | ComputerExamineUI()
42 | {
43 | CDialogBuilder builder;
44 | CUIContainer* pComputerExamine = static_cast(builder.Create(L"ComputerExamine2.xml"));
45 | if( pComputerExamine ) {
46 | this->Add(pComputerExamine);
47 | }
48 | else {
49 | this->RemoveAll();
50 | return;
51 | }
52 | }
53 | };
54 |
55 | class CDialogBuilderCallbackEx : public IDialogBuilderCallback
56 | {
57 | public:
58 | CUIControl* CreateControl(const CUIString& strClass)
59 | {
60 | if(strClass == L"ComputerExamine")
61 | return new ComputerExamineUI;
62 | return NULL;
63 | }
64 | };
65 | class CSkinWnd : public CWindowImpBase
66 | {
67 | public:
68 | CSkinWnd(){};
69 | virtual ~CSkinWnd(){};
70 |
71 | public:
72 | CUIString GetWindowClassName(void) const
73 | {
74 | return L"skinwnd";
75 | }
76 | CUIString GetSkinFolder()
77 | {
78 | return L"";
79 | }
80 | CUIString GetSkinFile()
81 | {
82 | return L"";
83 | }
84 |
85 | bool OnClose(int Msg, WPARAM wParam, LPARAM lParam)
86 | {
87 | g_print("on close()");
88 | return false;
89 | }
90 |
91 | void OnDestroy(int, WPARAM, LPARAM)
92 | {
93 | gtk_main_quit();
94 | }
95 |
96 | void InitWindow()
97 | {
98 | CDialogBuilder builer;
99 | CUIControl *pRoot = builer.Create(L"PlayerMain2.xml", this, NULL);
100 | //CDialogBuilderCallbackEx cb;
101 | //builer.SetCallback(&cb);
102 | //CUIControl *pRoot = builer.Create(L"skin2.xml", this, NULL);
103 | if (pRoot){
104 | AttachDlg(pRoot);
105 | }
106 |
107 | CDialogBuilder builer2;
108 | CUILabel *pTempLabel;
109 | CListContainerElementUI *pListElement = static_cast(builer2.Create(L"music_list.xml"));
110 | CListUI* pControl = static_cast(FindControl(L"fuck_list"));
111 |
112 | pTempLabel = static_cast(pListElement->FindSubControl(L"music_title"));
113 | assert(pTempLabel);
114 | pTempLabel->SetText(L"fuck");
115 |
116 | pTempLabel = static_cast(pListElement->FindSubControl(L"auth_name"));
117 | assert(pTempLabel);
118 | pTempLabel->SetText(L"ssss");
119 |
120 | pTempLabel = static_cast(pListElement->FindSubControl(L"song_time"));
121 | assert(pTempLabel);
122 | pTempLabel->SetText(L"--:--");
123 | pControl->Add(pListElement);
124 |
125 | CDialogBuilder builer3;
126 | pListElement = static_cast(builer3.Create(L"music_list.xml"));
127 | pControl = static_cast(FindControl(L"fuck_list"));
128 |
129 | pTempLabel = static_cast(pListElement->FindSubControl(L"music_title"));
130 | assert(pTempLabel);
131 | pTempLabel->SetText(L"fuck2");
132 |
133 | pTempLabel = static_cast(pListElement->FindSubControl(L"auth_name"));
134 | assert(pTempLabel);
135 | pTempLabel->SetText(L"aaa");
136 |
137 | pTempLabel = static_cast(pListElement->FindSubControl(L"song_time"));
138 | assert(pTempLabel);
139 | pTempLabel->SetText(L"20:20");
140 | pControl->Add(pListElement);
141 | }
142 |
143 | void Notify(TNotifyUI& msg)
144 | {
145 | if (msg.Type <= (sizeof(gszMsg) / sizeof(gszMsg[0]) + 0x40000000)){
146 | wprintf(L"msg %s sender %s\n", gszMsg[msg.Type-0x40000000], (LPCWSTR)msg.pSender->GetName());
147 | }
148 |
149 | if (msg.Type == DUI_MSGTYPE_CLICK && msg.pSender->GetName() == L"button"){
150 | Close();
151 | }
152 |
153 | else if(msg.Type == DUI_MSGTYPE_SELECTCHANGED)
154 | {
155 | CUIString name = msg.pSender->GetName();
156 | CUITabLayout* pControl = static_cast(FindControl(L"switch"));
157 | if(name==L"examine")
158 | pControl->SelectItem(0);
159 | else if(name==L"trojan")
160 | pControl->SelectItem(1);
161 | else if(name==L"plugins")
162 | pControl->SelectItem(2);
163 | else if(name==L"vulnerability")
164 | pControl->SelectItem(3);
165 | else if(name==L"rubbish")
166 | pControl->SelectItem(4);
167 | else if(name==L"cleanup")
168 | pControl->SelectItem(5);
169 | else if(name==L"fix")
170 | pControl->SelectItem(6);
171 | else if(name==L"tool")
172 | pControl->SelectItem(7);
173 | }
174 | CWindowImpBase::Notify(msg);
175 | }
176 |
177 | void OnClick(TNotifyUI& msg)
178 | {
179 | g_print("click event\n");
180 | if (msg.Type == DUI_MSGTYPE_CLICK && msg.pSender->GetName() == L"button"){
181 | Close();
182 | }
183 | }
184 |
185 | private:
186 | CUIButton button;
187 | CUIProgress Progress;
188 | CUISlider Slider;
189 | CUILabel Label;
190 | CUIContainer Container;
191 | public:
192 | DUI_DECLARE_MESSAGE_MAP()
193 | };
194 |
195 | DUI_BEGIN_MESSAGE_MAP(CSkinWnd, CNotifyPump)
196 | DUI_ON_MSGTYPE(DUI_MSGTYPE_CLICK, CSkinWnd::OnClick)
197 | DUI_END_MESSAGE_MAP()
198 |
199 | #ifdef WIN32
200 | #include
201 | int _tmain(int argc, _TCHAR* argv[])
202 | #else
203 | int main(int argc, char* argv[])
204 | #endif
205 | {
206 |
207 | //CResourceMgr ss;
208 |
209 | gtk_init(NULL, NULL);
210 |
211 | CSkinWnd Window;
212 | //CResourceMgr::GetInstance().SetResourePath(L"/home/pgboy/qyplayer");
213 | CResourceMgr::GetInstance().SetResourePath(L"../skin/qyplayer");
214 |
215 | Window.Create(0, 0, /*400*/800, /*500*/570);
216 |
217 | Window.CenterWindow();
218 | Window.Show();
219 | Window.MainLoop();
220 |
221 | //gtk_main_quit();
222 |
223 | return 0;
224 | }
225 |
226 |
--------------------------------------------------------------------------------
/gtkduilib/gtkduilib.layout:
--------------------------------------------------------------------------------
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 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
--------------------------------------------------------------------------------
/gtkduilib/UIOption.cpp:
--------------------------------------------------------------------------------
1 | #include "stdafx.h"
2 | #include "UIOption.h"
3 |
4 | CUIOption::CUIOption() : m_bSelected(false), m_dwSelectedTextColor(0)
5 | {
6 | }
7 |
8 | CUIOption::~CUIOption()
9 | {
10 | if(!m_sGroupName.IsEmpty() && m_Window)
11 | m_Window->RemoveOptionGroup(m_sGroupName, this);
12 | }
13 |
14 | CUIString CUIOption::GetClass() const
15 | {
16 | return L"OptionUI";
17 | }
18 |
19 | LPVOID CUIOption::GetInterface(const CUIString& strName)
20 | {
21 | if(strName == DUI_CTR_OPTION)
22 | return static_cast(this);
23 | return
24 | CUIButton::GetInterface(strName);
25 | }
26 |
27 | void CUIOption::SetOwnWindow(CUIWindow* pWindow, CUIControl* pParent, bool bInit)
28 | {
29 | CUIControl::SetOwnWindow(pWindow, pParent, bInit);
30 | if(bInit && !m_sGroupName.IsEmpty()){
31 | if (m_Window)
32 | m_Window->AddOptionGroup(m_sGroupName, this);
33 | }
34 | }
35 |
36 | CUIString CUIOption::GetGroup() const
37 | {
38 | return m_sGroupName;
39 | }
40 |
41 | void CUIOption::SetGroup(const CUIString& strGroupName)
42 | {
43 | if(strGroupName.IsEmpty()){
44 | if(m_sGroupName.IsEmpty())
45 | return;
46 | m_sGroupName.Empty();
47 | }else{
48 | if(m_sGroupName == strGroupName)
49 | return;
50 | if(!m_sGroupName.IsEmpty() && m_Window)
51 | m_Window->RemoveOptionGroup(m_sGroupName, this);
52 | m_sGroupName = strGroupName;
53 | }
54 |
55 | if(!m_sGroupName.IsEmpty()){
56 | if(m_Window)
57 | m_Window->AddOptionGroup(m_sGroupName, this);
58 | }else{
59 | if(m_Window)
60 | m_Window->RemoveOptionGroup(m_sGroupName, this);
61 | }
62 |
63 | Selected(m_bSelected);
64 | }
65 |
66 | bool CUIOption::IsSelected() const
67 | {
68 | return m_bSelected;
69 | }
70 |
71 | void CUIOption::Selected(bool bSelected)
72 | {
73 | if(m_bSelected == bSelected)
74 | return;
75 | m_bSelected = bSelected;
76 | if(m_bSelected)
77 | m_uButtonState |= UISTATE_SELECTED;
78 | else m_uButtonState &= ~UISTATE_SELECTED;
79 |
80 | if(m_Window != NULL){
81 | if(!m_sGroupName.IsEmpty()){
82 | if( m_bSelected ) {
83 | CStdPtrArray* aOptionGroup = m_Window->GetOptionGroup(m_sGroupName);
84 | for( int i = 0; i < aOptionGroup->GetSize(); i++ ) {
85 | CUIOption* pControl = static_cast(aOptionGroup->GetAt(i));
86 | if( pControl != this ) {
87 | pControl->Selected(false);
88 | }
89 | }
90 |
91 | if (m_Window){
92 | m_Window->SendNotify(this, DUI_MSGTYPE_SELECTCHANGED);
93 | }
94 |
95 | }
96 | }else{
97 | if (m_Window){
98 | m_Window->SendNotify(this, DUI_MSGTYPE_SELECTCHANGED);
99 | }
100 | }
101 | }
102 |
103 | Invalidate();
104 | }
105 |
106 | bool CUIOption::Activate()
107 | {
108 | if(!CUIButton::Activate())
109 | return false;
110 | if(!m_sGroupName.IsEmpty())
111 | Selected(true);
112 | else
113 | Selected(!m_bSelected);
114 |
115 | return true;
116 | }
117 |
118 | void CUIOption::SetEnabled(bool bEnable)
119 | {
120 | CUIControl::SetEnabled(bEnable);
121 | if(!IsEnabled()){
122 | if(m_bSelected) m_uButtonState = UISTATE_SELECTED;
123 | else m_uButtonState = 0;
124 | }
125 | }
126 |
127 | CUIString CUIOption::GetSelectedImage()
128 | {
129 | return m_sSelectedImage;
130 | }
131 |
132 | void CUIOption::SetSelectedImage(const CUIString& strImage)
133 | {
134 | m_sSelectedImage = strImage;
135 | Invalidate();
136 | }
137 |
138 | CUIString CUIOption::GetSelectedHotImage()
139 | {
140 | return m_sSelectedHotImage;
141 | }
142 |
143 | void CUIOption::SetSelectedHotImage(const CUIString& strImage )
144 | {
145 | m_sSelectedHotImage = strImage;
146 | Invalidate();
147 | }
148 |
149 | void CUIOption::SetSelectedTextColor(DWORD dwTextColor)
150 | {
151 | m_dwSelectedTextColor = dwTextColor;
152 | }
153 |
154 | DWORD CUIOption::GetSelectedTextColor()
155 | {
156 |
157 | //
158 | // TODO: GetDefaultFontColor
159 | //
160 |
161 | if (m_dwSelectedTextColor == 0)
162 | m_dwSelectedTextColor = 0xFF000000/*m_pManager->GetDefaultFontColor()*/;
163 | return
164 | m_dwSelectedTextColor;
165 | }
166 |
167 | void CUIOption::SetSelectedBkColor( DWORD dwBkColor )
168 | {
169 | m_dwSelectedBkColor = dwBkColor;
170 | }
171 |
172 | DWORD CUIOption::GetSelectBkColor()
173 | {
174 | return m_dwSelectedBkColor;
175 | }
176 |
177 | CUIString CUIOption::GetForeImage()
178 | {
179 | return m_sForeImage;
180 | }
181 |
182 | void CUIOption::SetForeImage(const CUIString& strImage)
183 | {
184 | m_sForeImage = strImage;
185 | Invalidate();
186 | }
187 |
188 | SIZE CUIOption::EstimateSize(SIZE szAvailable)
189 | {
190 | if(m_cxyFixed.cy == 0)
191 | return CUISize(m_cxyFixed.cx, CResourceMgr::GetInstance().GetFontHeight(m_strFontName) + 8);
192 | return
193 | CUIControl::EstimateSize(szAvailable);
194 | }
195 |
196 | void CUIOption::SetAttribute(LPCWSTR pstrName, LPCWSTR pstrValue)
197 | {
198 | if(wcscmp(pstrName, L"group") == 0)
199 | SetGroup(pstrValue);
200 | else if(wcscmp(pstrName, L"selected") == 0)
201 | Selected(wcscmp(pstrValue, L"true") == 0);
202 | else if(wcscmp(pstrName, L"selectedimage") == 0)
203 | SetSelectedImage(pstrValue);
204 | else if(wcscmp(pstrName, L"selectedhotimage") == 0)
205 | SetSelectedHotImage(pstrValue);
206 | else if(wcscmp(pstrName, L"foreimage") == 0)
207 | SetForeImage(pstrValue);
208 | else if(wcscmp(pstrName, L"selectedbkcolor") == 0){
209 | if( *pstrValue == L'#')
210 | pstrValue = pstrValue + 1/*::CharNext(pstrValue)*/;
211 | LPWSTR pstr = NULL;
212 | DWORD clrColor = wcstoul(pstrValue, &pstr, 16);
213 | SetSelectedBkColor(clrColor);
214 | }else if(wcscmp(pstrName, L"selectedtextcolor") == 0){
215 | if(*pstrValue == L'#')
216 | pstrValue = pstrValue + 1/*::CharNext(pstrValue)*/;
217 | LPWSTR pstr = NULL;
218 | DWORD clrColor = wcstoul(pstrValue, &pstr, 16);
219 | SetSelectedTextColor(clrColor);
220 | }else
221 | CUIButton::SetAttribute(pstrName, pstrValue);
222 | }
223 |
224 | void CUIOption::PaintStatusImage(cairo_t *cr)
225 | {
226 | m_uButtonState &= ~UISTATE_PUSHED;
227 |
228 | if((m_uButtonState & UISTATE_HOT) != 0 && IsSelected() && !m_sSelectedHotImage.IsEmpty()) {
229 | if(!DrawImage(cr, (LPCWSTR)m_sSelectedHotImage))
230 | m_sSelectedHotImage.Empty();
231 | else
232 | goto Label_ForeImage;
233 | }else if((m_uButtonState & UISTATE_SELECTED) != 0){
234 | if( !m_sSelectedImage.IsEmpty() ) {
235 | if(!DrawImage(cr, (LPCWSTR)m_sSelectedImage))
236 | m_sSelectedImage.Empty();
237 | else
238 | goto Label_ForeImage;
239 | }else if(m_dwSelectedBkColor != 0) {
240 |
241 | //
242 | // TODO m_dwSelectedBkColor
243 | //
244 |
245 | CUIRender::DrawColor(cr, m_rcPaint, /*GetAdjustColor(*/m_dwSelectedBkColor/*)*/);
246 | return;
247 | }
248 | }
249 |
250 | CUIButton::PaintStatusImage(cr);
251 |
252 | Label_ForeImage:
253 | if(!m_sForeImage.IsEmpty()){
254 | if(!DrawImage(cr, (LPCWSTR)m_sForeImage))
255 | m_sForeImage.Empty();
256 | }
257 | }
258 |
259 | void CUIOption::PaintText(cairo_t *cr)
260 | {
261 | if( (m_uButtonState & UISTATE_SELECTED) != 0 )
262 | {
263 | DWORD oldTextColor = m_dwTextColor;
264 | if( m_dwSelectedTextColor != 0 )
265 | m_dwTextColor = m_dwSelectedTextColor;
266 |
267 | //
268 | // TODO GetDefaultFontColor GetDefaultDisabledColor
269 | //
270 |
271 | if(m_dwTextColor == 0)
272 | m_dwTextColor = 0xFF000000/*m_pManager->GetDefaultFontColor()*/;
273 | if( m_dwDisabledTextColor == 0 ) m_dwDisabledTextColor = 0xFFA7A6AA/*m_pManager->GetDefaultDisabledColor()*/;
274 |
275 | if(m_strText.IsEmpty())
276 | return;
277 |
278 | int nLinks = 0;
279 | RECT rc = m_rcItem;
280 | rc.left += m_rcTextPadding.left;
281 | rc.right -= m_rcTextPadding.right;
282 | rc.top += m_rcTextPadding.top;
283 | rc.bottom -= m_rcTextPadding.bottom;
284 |
285 | CUIRender::DrawText(cr, rc, m_strText, m_uTextStyle, m_strFontName,
286 | IsEnabled()?m_dwTextColor:m_dwDisabledTextColor, m_bShowHtml);
287 |
288 | m_dwTextColor = oldTextColor;
289 | }else{
290 | CUIButton::PaintText(cr);
291 | }
292 | }
--------------------------------------------------------------------------------
/skin/qyplayer/PlayerMain1.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 |
--------------------------------------------------------------------------------
/gtkduilib/UISlider.cpp:
--------------------------------------------------------------------------------
1 | #include "stdafx.h"
2 | #include "UISlider.h"
3 |
4 | CUISlider::CUISlider():m_uButtonState(0), m_nStep(1), m_bDelyInVisible(false), m_nDownValue(0), m_bSendMove(false)
5 | {
6 | m_uTextStyle = DT_SINGLELINE | DT_CENTER;
7 | m_szThumb.cx = m_szThumb.cy = 10;
8 | }
9 |
10 | CUIString CUISlider::GetClass() const
11 | {
12 | return L"SliderUI";
13 | }
14 |
15 | UINT CUISlider::GetControlFlags() const
16 | {
17 | return IsEnabled() ? UIFLAG_SETCURSOR : 0;
18 | }
19 |
20 | LPVOID CUISlider::GetInterface(const CUIString& strName)
21 | {
22 | if(strName == DUI_CTR_SLIDER)
23 | return static_cast(this);
24 | return
25 | CUIProgress::GetInterface(strName);
26 | }
27 |
28 | void CUISlider::SetEnabled(bool bEnable)
29 | {
30 | CUIControl::SetEnabled(bEnable);
31 | if( !IsEnabled() ) {
32 | m_uButtonState = 0;
33 | }
34 | }
35 |
36 | int CUISlider::GetChangeStep()
37 | {
38 | return m_nStep;
39 | }
40 |
41 | void CUISlider::SetChangeStep(int step)
42 | {
43 | m_nStep = step;
44 | }
45 |
46 | void CUISlider::SetThumbSize(SIZE szXY)
47 | {
48 | m_szThumb = szXY;
49 | }
50 |
51 | CUIRect CUISlider::GetThumbRect() const
52 | {
53 | if( m_bHorizontal ) {
54 | int left = m_rcItem.left + (m_rcItem.right - m_rcItem.left - m_szThumb.cx) * (m_nValue - m_nMin) / (m_nMax - m_nMin);
55 | int top = (m_rcItem.bottom + m_rcItem.top - m_szThumb.cy) / 2;
56 | return CUIRect(left, top, left + m_szThumb.cx, top + m_szThumb.cy);
57 | }
58 | else {
59 | int left = (m_rcItem.right + m_rcItem.left - m_szThumb.cx) / 2;
60 | int top = m_rcItem.bottom - m_szThumb.cy - (m_rcItem.bottom - m_rcItem.top - m_szThumb.cy) * (m_nValue - m_nMin) / (m_nMax - m_nMin);
61 | return CUIRect(left, top, left + m_szThumb.cx, top + m_szThumb.cy);
62 | }
63 | }
64 |
65 | CUIString CUISlider::GetThumbImage() const
66 | {
67 | return m_sThumbImage;
68 | }
69 |
70 | void CUISlider::SetThumbImage(const CUIString& strImage)
71 | {
72 | m_sThumbImage = strImage;
73 | Invalidate();
74 | }
75 |
76 | CUIString CUISlider::GetThumbHotImage() const
77 | {
78 | return m_sThumbHotImage;
79 | }
80 |
81 | void CUISlider::SetThumbHotImage(const CUIString& strImage)
82 | {
83 | m_sThumbHotImage = strImage;
84 | Invalidate();
85 | }
86 |
87 | CUIString CUISlider::GetThumbPushedImage() const
88 | {
89 | return m_sThumbPushedImage;
90 | }
91 |
92 | void CUISlider::SetThumbPushedImage(const CUIString& strImage)
93 | {
94 | m_sThumbPushedImage = strImage;
95 | Invalidate();
96 | }
97 |
98 | void CUISlider::SetValue(int nValue)
99 | {
100 | if( (m_uButtonState & UISTATE_CAPTURED) != 0 ){
101 | return;
102 | }
103 | CUIProgress::SetValue(nValue);
104 | }
105 |
106 | void CUISlider::SetVisible(bool bVisible /* = true */)
107 | {
108 | if(bVisible == false && (m_uButtonState & UISTATE_CAPTURED) != 0 ){
109 | m_bDelyInVisible = true;
110 | return;
111 | }
112 | CUIProgress::SetVisible(bVisible);
113 | }
114 |
115 | void CUISlider::SetSendMove(bool bSendMove){
116 | m_bSendMove = bSendMove;
117 | }
118 |
119 | bool CUISlider::IsSendMove(){
120 | return m_bSendMove;
121 | }
122 |
123 | void CUISlider::DoEvent(TEventUI& event)
124 | {
125 | if(!IsMouseEnabled() && event.Type > UIEVENT__MOUSEBEGIN && event.Type < UIEVENT__MOUSEEND){
126 | if(m_Parent != NULL)
127 | m_Parent->DoEvent(event);
128 | else
129 | CUIProgress::DoEvent(event);
130 | return;
131 | }
132 |
133 | if(event.Type == UIEVENT_BUTTONDOWN || event.Type == UIEVENT_DBLCLICK){
134 | if(IsEnabled()){
135 | CUIRect rcThumb = GetThumbRect();
136 | if(rcThumb.IsPtIn(event.ptMouse)){
137 | m_uButtonState |= UISTATE_CAPTURED;
138 | m_nDownValue = m_nValue;
139 | }
140 | }
141 | return;
142 | }
143 | if(event.Type == UIEVENT_BUTTONUP){
144 | int nValue;
145 | if((m_uButtonState & UISTATE_CAPTURED) != 0) {
146 | m_uButtonState &= ~UISTATE_CAPTURED;
147 | if (m_bDelyInVisible){
148 | CUIProgress::SetVisible(false);
149 | m_bDelyInVisible = false;
150 | }
151 | }
152 |
153 | if(m_bHorizontal) {
154 | if(event.ptMouse.x >= m_rcItem.right - m_szThumb.cx / 2)
155 | nValue = m_nMax;
156 | else if(event.ptMouse.x <= m_rcItem.left + m_szThumb.cx / 2)
157 | nValue = m_nMin;
158 | else
159 | nValue = m_nMin + (m_nMax - m_nMin) * (event.ptMouse.x - m_rcItem.left - m_szThumb.cx / 2 ) / (m_rcItem.right - m_rcItem.left - m_szThumb.cx);
160 | }else{
161 | if(event.ptMouse.y >= m_rcItem.bottom - m_szThumb.cy / 2)
162 | nValue = m_nMin;
163 | else if(event.ptMouse.y <= m_rcItem.top + m_szThumb.cy / 2)
164 | nValue = m_nMax;
165 | else
166 | nValue = m_nMin + (m_nMax - m_nMin) * (m_rcItem.bottom - event.ptMouse.y - m_szThumb.cy / 2 ) / (m_rcItem.bottom - m_rcItem.top - m_szThumb.cy);
167 | }
168 |
169 | if(m_nDownValue != nValue && nValue >= m_nMin && nValue <= m_nMax){
170 | m_nValue = nValue;
171 | if (m_Window){
172 | m_Window->SendNotify(this, DUI_MSGTYPE_VALUECHANGED);
173 | }
174 | Invalidate();
175 | }
176 |
177 | return;
178 | }
179 |
180 | if( event.Type == UIEVENT_CONTEXTMENU ){
181 | return;
182 | }
183 |
184 | if(event.Type == UIEVENT_SCROLLWHEEL){
185 | switch(LOWORD(event.wParam)){
186 | case SB_LINEUP:
187 | {
188 | SetValue(GetValue() + GetChangeStep());
189 | if (m_Window){
190 | m_Window->SendNotify(this, DUI_MSGTYPE_VALUECHANGED);
191 | }
192 | }
193 | return;
194 | case SB_LINEDOWN:
195 | {
196 | SetValue(GetValue() - GetChangeStep());
197 | if (m_Window){
198 | m_Window->SendNotify(this, DUI_MSGTYPE_VALUECHANGED);
199 | }
200 | }
201 | return;
202 | }
203 | }
204 | if( event.Type == UIEVENT_MOUSEMOVE ){
205 | if( (m_uButtonState & UISTATE_CAPTURED) != 0 ) {
206 | int nValue;
207 | if( m_bHorizontal ) {
208 | if( event.ptMouse.x >= m_rcItem.right - m_szThumb.cx / 2 )
209 | nValue = m_nMax;
210 | else if( event.ptMouse.x <= m_rcItem.left + m_szThumb.cx / 2 )
211 | nValue = m_nMin;
212 | else
213 | nValue = m_nMin + (m_nMax - m_nMin) * (event.ptMouse.x - m_rcItem.left - m_szThumb.cx / 2 ) / (m_rcItem.right - m_rcItem.left - m_szThumb.cx);
214 | }else{
215 | if( event.ptMouse.y >= m_rcItem.bottom - m_szThumb.cy / 2 )
216 | nValue = m_nMin;
217 | else if( event.ptMouse.y <= m_rcItem.top + m_szThumb.cy / 2 )
218 | nValue = m_nMax;
219 | else
220 | nValue = m_nMin + (m_nMax - m_nMin) * (m_rcItem.bottom - event.ptMouse.y - m_szThumb.cy / 2 ) / (m_rcItem.bottom - m_rcItem.top - m_szThumb.cy);
221 | }
222 |
223 | if(m_nValue != nValue && nValue >= m_nMin && nValue <= m_nMax){
224 | m_nValue = nValue;
225 | if (m_bSendMove && m_Window){
226 | m_Window->SendNotify(this, DUI_MSGTYPE_VALUECHANGED);
227 | }
228 | }
229 |
230 | Invalidate();
231 | }
232 | return;
233 | }
234 |
235 | if(event.Type == UIEVENT_SETCURSOR){
236 | /*RECT rcThumb = GetThumbRect();
237 | if( IsEnabled() && ::PtInRect(&rcThumb, event.ptMouse) ) {
238 | ::SetCursor(::LoadCursor(NULL, MAKEINTRESOURCE(IDC_HAND)));
239 | return;
240 | }*/
241 | }
242 |
243 | if(event.Type == UIEVENT_MOUSEENTER){
244 | if( IsEnabled() ) {
245 | m_uButtonState |= UISTATE_HOT;
246 | Invalidate();
247 | }
248 | //return;
249 | }
250 |
251 | if(event.Type == UIEVENT_MOUSELEAVE){
252 | if( IsEnabled() ) {
253 | m_uButtonState &= ~UISTATE_HOT;
254 | Invalidate();
255 | }
256 | //return;
257 | }
258 | CUIControl::DoEvent(event);
259 | }
260 |
261 |
262 | void CUISlider::SetAttribute(LPCWSTR pstrName, LPCWSTR pstrValue)
263 | {
264 | if( wcscmp(pstrName, L"thumbimage") == 0 )
265 | SetThumbImage(pstrValue);
266 | else if( wcscmp(pstrName, L"thumbhotimage") == 0 )
267 | SetThumbHotImage(pstrValue);
268 | else if( wcscmp(pstrName, L"thumbpushedimage") == 0 )
269 | SetThumbPushedImage(pstrValue);
270 | else if( wcscmp(pstrName, L"thumbsize") == 0 ) {
271 | CUISize szXY;
272 | LPWSTR pstr = NULL;
273 | szXY.cx = wcstol(pstrValue, &pstr, 10); //ASSERT(pstr);
274 | szXY.cy = wcstol(pstr + 1, &pstr, 10); // ASSERT(pstr);
275 | SetThumbSize(szXY);
276 | }else if( wcscmp(pstrName, L"step") == 0 ) {
277 | SetChangeStep(/*_wtoi(pstrValue)*/wcstol(pstrValue, NULL, 10));
278 | }else if( wcscmp(pstrName, L"forepadding") == 0 )
279 | CUIProgress::SetForePadding(/*_wtoi(pstrValue)*/wcstol(pstrValue, NULL, 10));
280 | else if( wcscmp(pstrName, L"sendmove") == 0 )
281 | SetSendMove(wcscmp(pstrValue, L"true") == 0);
282 | else
283 | CUIProgress::SetAttribute(pstrName, pstrValue);
284 | }
285 |
286 | void CUISlider::PaintStatusImage(cairo_t *cr)
287 | {
288 | CUIProgress::PaintStatusImage(cr);
289 |
290 | RECT rcThumb = GetThumbRect();
291 | rcThumb.left -= m_rcItem.left;
292 | rcThumb.top -= m_rcItem.top;
293 | rcThumb.right -= m_rcItem.left;
294 | rcThumb.bottom -= m_rcItem.top;
295 | if((m_uButtonState & UISTATE_CAPTURED) != 0){
296 | if( !m_sThumbPushedImage.IsEmpty() ) {
297 | m_sImageModify.Empty();
298 | m_sImageModify.Format(L"dest='%d,%d,%d,%d'", rcThumb.left, rcThumb.top, rcThumb.right, rcThumb.bottom);
299 | if(!DrawImage(cr, (LPCWSTR)m_sThumbPushedImage, (LPCWSTR)m_sImageModify))
300 | m_sThumbPushedImage.Empty();
301 | else {
302 | //DUITRACE(TEXT("Thumb %s"), m_sImageModify);
303 | return;
304 | }
305 | }
306 | }
307 |
308 | else if( (m_uButtonState & UISTATE_HOT) != 0 ) {
309 | if( !m_sThumbHotImage.IsEmpty() ) {
310 | m_sImageModify.Empty();
311 | m_sImageModify.Format(L"dest='%d,%d,%d,%d'", rcThumb.left, rcThumb.top, rcThumb.right, rcThumb.bottom);
312 | if( !DrawImage(cr, (LPCWSTR)m_sThumbHotImage, (LPCWSTR)m_sImageModify) )
313 | m_sThumbHotImage.Empty();
314 | else{
315 | //DUITRACE(TEXT("Thumb %s"), m_sImageModify);
316 | return;
317 | }
318 | }
319 | }
320 |
321 | if( !m_sThumbImage.IsEmpty() ) {
322 | m_sImageModify.Empty();
323 | m_sImageModify.Format(L"dest='%d,%d,%d,%d'", rcThumb.left, rcThumb.top, rcThumb.right, rcThumb.bottom);
324 | if( !DrawImage(cr, (LPCWSTR)m_sThumbImage, (LPCWSTR)m_sImageModify) ) m_sThumbImage.Empty();
325 | else{
326 | //DUITRACE(TEXT("Thumb %s"), m_sImageModify);
327 | return;
328 | }
329 | }
330 | }
--------------------------------------------------------------------------------
/gtkduilib/gtkduilib.vcproj:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
15 |
16 |
17 |
18 |
19 |
26 |
29 |
32 |
35 |
38 |
41 |
54 |
57 |
60 |
63 |
68 |
71 |
74 |
77 |
80 |
83 |
84 |
92 |
95 |
98 |
101 |
104 |
107 |
118 |
121 |
124 |
127 |
130 |
133 |
136 |
139 |
142 |
145 |
146 |
147 |
148 |
149 |
150 |
155 |
158 |
159 |
162 |
163 |
166 |
169 |
173 |
174 |
175 |
178 |
179 |
182 |
185 |
189 |
190 |
193 |
197 |
198 |
199 |
202 |
203 |
206 |
207 |
210 |
211 |
214 |
215 |
218 |
219 |
222 |
223 |
226 |
227 |
230 |
231 |
234 |
235 |
238 |
239 |
242 |
243 |
246 |
247 |
250 |
251 |
254 |
255 |
258 |
259 |
262 |
263 |
266 |
267 |
270 |
271 |
274 |
275 |
278 |
279 |
282 |
283 |
286 |
287 |
288 |
293 |
296 |
297 |
300 |
301 |
304 |
305 |
308 |
309 |
312 |
313 |
316 |
317 |
320 |
321 |
324 |
325 |
328 |
329 |
332 |
333 |
336 |
337 |
340 |
341 |
344 |
345 |
348 |
349 |
352 |
353 |
356 |
357 |
360 |
361 |
364 |
365 |
368 |
369 |
372 |
373 |
376 |
377 |
380 |
381 |
384 |
385 |
388 |
389 |
392 |
393 |
396 |
397 |
400 |
401 |
404 |
405 |
408 |
409 |
412 |
413 |
416 |
417 |
418 |
423 |
424 |
427 |
428 |
429 |
430 |
431 |
432 |
--------------------------------------------------------------------------------
/skin/qyplayer/PlayerMain.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 |
--------------------------------------------------------------------------------
/skin/qyplayer/PlayerMain2.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 |
--------------------------------------------------------------------------------