ReactOS 0.4.16-dev-297-gc569aee
appview.cpp File Reference
#include "rapps.h"
#include "appview.h"
#include "gui.h"
#include <windowsx.h>
Include dependency graph for appview.cpp:

Go to the source code of this file.

Classes

struct  CAsyncLoadIcon
 

Functions

BOOL DeleteMenuEx (_In_ HMENU hMenu, _In_ UINT uPosition, _In_ UINT uFlags)
 
int ScrnshotDownloadCallback (pASYNCINET AsyncInet, ASYNC_EVENT Event, WPARAM wParam, LPARAM lParam, VOID *Extension)
 
static DWORD CALLBACK AsyncLoadIconProc (LPVOID Param)
 

Variables

HICON g_hDefaultPackageIcon = NULL
 
static int g_DefaultPackageIconILIdx = I_IMAGENONE
 
struct CAsyncLoadIcong_AsyncIconTasks = NULL
 
static UINT g_AsyncIconTaskId = 0
 

Function Documentation

◆ AsyncLoadIconProc()

static DWORD CALLBACK AsyncLoadIconProc ( LPVOID  Param)
static

Definition at line 1056 of file appview.cpp.

1057{
1058 for (CAsyncLoadIcon *task = (CAsyncLoadIcon*)Param, *old; task; old->Free())
1059 {
1060 if (task->TaskId == g_AsyncIconTaskId)
1061 {
1062 HICON hIcon;
1063 if (!task->Parse)
1064 hIcon = (HICON)LoadImageW(NULL, task->Location, IMAGE_ICON, 0, 0, LR_LOADFROMFILE | LR_DEFAULTSIZE);
1065 else if (!ExtractIconExW(task->Location, PathParseIconLocationW(task->Location), &hIcon, NULL, 1))
1066 hIcon = NULL;
1067
1068 if (hIcon)
1069 {
1070 SendMessageW(task->hAppsList, WM_RAPPSLIST_ASYNCICON, (WPARAM)hIcon, (LPARAM)task);
1072 }
1073 }
1074 old = task;
1075 task = task->pNext;
1076 }
1077 return 0;
1078}
static UINT g_AsyncIconTaskId
Definition: appview.cpp:1053
#define WM_RAPPSLIST_ASYNCICON
Definition: appview.h:42
#define NULL
Definition: types.h:112
int WINAPI PathParseIconLocationW(LPWSTR lpszPath)
Definition: path.c:1092
UINT WINAPI ExtractIconExW(LPCWSTR lpszFile, INT nIconIndex, HICON *phiconLarge, HICON *phiconSmall, UINT nIcons)
Definition: iconcache.cpp:849
static HICON
Definition: imagelist.c:80
HICON hIcon
Definition: msconfig.c:44
LONG_PTR LPARAM
Definition: windef.h:208
UINT_PTR WPARAM
Definition: windef.h:207
#define LR_LOADFROMFILE
Definition: winuser.h:1095
#define IMAGE_ICON
Definition: winuser.h:212
HANDLE WINAPI LoadImageW(_In_opt_ HINSTANCE hInst, _In_ LPCWSTR name, _In_ UINT type, _In_ int cx, _In_ int cy, _In_ UINT fuLoad)
Definition: cursoricon.c:2255
#define LR_DEFAULTSIZE
Definition: winuser.h:1097
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
BOOL WINAPI DestroyIcon(_In_ HICON)
Definition: cursoricon.c:2105

Referenced by CAsyncLoadIcon::StartTasks().

◆ DeleteMenuEx()

BOOL DeleteMenuEx ( _In_ HMENU  hMenu,
_In_ UINT  uPosition,
_In_ UINT  uFlags 
)

Definition at line 22 of file appview.cpp.

26{
27 INT pos;
28 MENUITEMINFOW mii = { sizeof(mii), MIIM_FTYPE, 0 };
29 bool bIsValidItem1, bIsValidItem2;
30 bool bIsSep1, bIsSep2;
31
33 pos = (INT)uPosition;
34 else
35 pos = ::GetMenuPosFromID(hMenu, uPosition);
36 if (pos < 0)
37 return FALSE;
38
39 bIsValidItem1 = ((pos > 0) && ::GetMenuItemInfoW(hMenu, pos - 1, TRUE, &mii));
40 bIsSep1 = bIsValidItem1 && !!(mii.fType & MFT_SEPARATOR);
41
42 bIsValidItem2 = ::GetMenuItemInfoW(hMenu, pos + 1, TRUE, &mii);
43 bIsSep2 = bIsValidItem2 && !!(mii.fType & MFT_SEPARATOR);
44
45 if (bIsSep1 && !bIsSep2 && !bIsValidItem2)
46 pos = pos - 1; // Delete separator only if pos+1 has no item
47 else if (!bIsSep1 && bIsSep2 && !bIsValidItem1)
48 pos = pos + 1; // Delete separator only if pos-1 has no item
49 else if (bIsSep1 && bIsSep2)
50 pos = pos + 1;
51 else
52 pos = -1;
53
54 // Delete one of the separators if necessary
55 if (pos != -1)
57
58 // Finally, delete the menu item itself.
59 return ::DeleteMenu(hMenu, uPosition, uFlags);
60}
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
UINT uFlags
Definition: api.c:59
INT WINAPI GetMenuPosFromID(HMENU hMenu, UINT wID)
Definition: ordinal.c:4493
#define INT
Definition: polytest.cpp:20
int32_t INT
Definition: typedefs.h:58
#define MIIM_FTYPE
Definition: winuser.h:732
BOOL WINAPI DeleteMenu(_In_ HMENU, _In_ UINT, _In_ UINT)
#define MFT_SEPARATOR
Definition: winuser.h:747
#define MF_BYPOSITION
Definition: winuser.h:203
BOOL WINAPI GetMenuItemInfoW(_In_ HMENU, _In_ UINT, _In_ BOOL, _Inout_ LPMENUITEMINFOW)

Referenced by CApplicationView::ProcessWindowMessage().

◆ ScrnshotDownloadCallback()

int ScrnshotDownloadCallback ( pASYNCINET  AsyncInet,
ASYNC_EVENT  Event,
WPARAM  wParam,
LPARAM  lParam,
VOID Extension 
)

Definition at line 319 of file appview.cpp.

320{
322 switch (Event)
323 {
324 case ASYNCINET_DATA:
327 break;
332 break;
337 break;
338 case ASYNCINET_ERROR:
341 break;
342 default:
344 break;
345 }
346 return 0;
347}
#define ATLASSERT(x)
Definition: CComVariant.cpp:10
#define WM_RAPPS_DOWNLOAD_COMPLETE
Definition: appview.h:39
@ ASYNCINET_ERROR
Definition: asyncinet.h:15
@ ASYNCINET_COMPLETE
Definition: asyncinet.h:9
@ ASYNCINET_CANCELLED
Definition: asyncinet.h:12
@ ASYNCINET_DATA
Definition: asyncinet.h:7
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
#define ERROR_SUCCESS
Definition: deptool.c:10
#define CloseHandle
Definition: compat.h:739
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: rw.c:24
unsigned long DWORD
Definition: ntddk_ex.h:95
_Inout_opt_ PUNICODE_STRING Extension
Definition: fltkernel.h:1092
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_opt_ PWDF_MEMORY_DESCRIPTOR _In_opt_ PLONGLONG _In_opt_ PWDF_REQUEST_SEND_OPTIONS _Out_opt_ PULONG_PTR BytesWritten
Definition: wdfiotarget.h:960
CONST void * LPCVOID
Definition: windef.h:191
#define ERROR_CANCELLED
Definition: winerror.h:726
#define SendMessage
Definition: winuser.h:5855

Referenced by CAppScrnshotPreview::DisplayImage().

Variable Documentation

◆ g_AsyncIconTaskId

UINT g_AsyncIconTaskId = 0
static

◆ g_AsyncIconTasks

◆ g_DefaultPackageIconILIdx

int g_DefaultPackageIconILIdx = I_IMAGENONE
static

Definition at line 17 of file appview.cpp.

Referenced by CAppsListView::AddApplication(), and CAppsListView::SetDisplayAppType().

◆ g_hDefaultPackageIcon