* AUTHORS: David Quintana <gigaherz@gmail.com>
* Alexander Shaposhnikov <chaez.san@gmail.com>
*/
+#include "defines.h"
#include "rapps.h"
+#include "rosui.h"
+#include "crichedit.h"
#include <shlobj_undoc.h>
#include <shlguid_undoc.h>
#include <atlwin.h>
#include <wininet.h>
#include <shellutils.h>
-
#include <rosctrls.h>
-#include "rosui.h"
-#include "crichedit.h"
-
#define SEARCH_TIMER_ID 'SR'
+#define LISTVIEW_ICON_SIZE 24
+#define TREEVIEW_ICON_SIZE 24
HWND hListView = NULL;
+INT
+GetSystemColorDepth()
+{
+ DEVMODEW pDevMode;
+ INT ColorDepth;
+
+ pDevMode.dmSize = sizeof(pDevMode);
+ pDevMode.dmDriverExtra = 0;
+
+ if (!EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &pDevMode))
+ {
+ /* TODO: Error message */
+ return ILC_COLOR;
+ }
+
+ switch (pDevMode.dmBitsPerPel)
+ {
+ case 32: ColorDepth = ILC_COLOR32; break;
+ case 24: ColorDepth = ILC_COLOR24; break;
+ case 16: ColorDepth = ILC_COLOR16; break;
+ case 8: ColorDepth = ILC_COLOR8; break;
+ case 4: ColorDepth = ILC_COLOR4; break;
+ default: ColorDepth = ILC_COLOR; break;
+ }
+
+ return ColorDepth;
+}
+
class CAvailableAppView
{
static inline VOID InsertTextAfterLoaded_RichEdit(UINT uStringID,
hImageList = ImageList_Create(TOOLBAR_HEIGHT,//GetSystemMetrics(SM_CXSMICON),
TOOLBAR_HEIGHT,//GetSystemMetrics(SM_CYSMICON),
ILC_MASK | GetSystemColorDepth(),
- 1,
- 1);
+ 1, 1);
if (!hImageList)
{
/* TODO: Error message */
struct SortContext
{
CAppsListView * lvw;
- int iSubItem;
+ INT iSubItem;
};
BOOL bHasAllChecked;
RECT r = {0, 0, LOWORD(lParam), HIWORD(lParam)};
HDWP hdwp = NULL;
- int count = m_ClientPanel->CountSizableChildren();
+ INT count = m_ClientPanel->CountSizableChildren();
hdwp = BeginDeferWindowPos(count);
if (hdwp)
{
if (IS_INSTALLED_ENUM(SelectedEnumType))
ShowInstalledAppInfo(ItemIndex);
- if (IS_AVAILABLE_ENUM(SelectedEnumType))
+ if (isAvailableEnum(SelectedEnumType))
CAvailableAppView::ShowAvailableAppInfo(ItemIndex);
}
/* Check if the item is checked */
{
if (IS_INSTALLED_ENUM(SelectedEnumType))
ShowInstalledAppInfo(-1);
- if (IS_AVAILABLE_ENUM(SelectedEnumType))
+ if (isAvailableEnum(SelectedEnumType))
CAvailableAppView::ShowAvailableAppInfo(-1);
}
}
nSelectedApps = 0;
if (EnumType < 0) EnumType = SelectedEnumType;
- if (IS_INSTALLED_ENUM(SelectedEnumType))
+ if (IS_INSTALLED_ENUM(EnumType))
+ {
FreeInstalledAppList();
+ }
m_ListView->DeleteAllItems();
ImageList_Destroy(hImageListBuf);
}
- if (IS_AVAILABLE_ENUM(EnumType))
+ if (isAvailableEnum(EnumType))
{
/* Enum available applications */
- m_AvailableApps.EnumAvailableApplications(EnumType, s_EnumAvailableAppProc);
+ if (!m_AvailableApps.EnumAvailableApplications(EnumType, s_EnumAvailableAppProc))
+ {
+ return;
+ }
}
SelectedEnumType = EnumType;
-
UpdateStatusBarText();
-
SetWelcomeText();
- /* set automatic column width for program names if the list is not empty */
+ /* Set automatic column width for program names if the list is not empty */
if (m_ListView->GetItemCount() > 0)
+ {
ListView_SetColumnWidth(m_ListView->GetWindow(), 0, LVSCW_AUTOSIZE);
+ }
bUpdating = FALSE;
m_ListView->SetRedraw(TRUE);