return FALSE;
}
- ImageList_Destroy((HIMAGELIST) SetImageList(hImageList));
+ ImageList_Destroy(SetImageList(hImageList));
AddButtons(_countof(Buttons), Buttons);
};
BOOL bHasAllChecked;
- BOOL bAscending;
+ BOOL bIsAscending;
BOOL bHasCheckboxes;
+ INT nLastHeaderID;
+
public:
CAppsListView() :
bHasAllChecked(FALSE),
- bAscending(TRUE),
- bHasCheckboxes(FALSE)
+ bIsAscending(TRUE),
+ bHasCheckboxes(FALSE),
+ nLastHeaderID(-1)
{
}
VOID ColumnClick(LPNMLISTVIEW pnmv)
{
- SortContext ctx = {this, pnmv->iSubItem};
+ HWND hHeader;
+ HDITEMW hColumn;
+ INT nHeaderID = pnmv->iSubItem;
+
+ if ((GetWindowLongPtr(GWL_STYLE) & ~LVS_NOSORTHEADER) == 0)
+ return;
+
+ hHeader = (HWND) SendMessage(LVM_GETHEADER, 0, 0);
+ ZeroMemory(&hColumn, sizeof(hColumn));
+
+ /* If the sorting column changed, remove the sorting style from the old column */
+ if ((nLastHeaderID != -1) && (nLastHeaderID != nHeaderID))
+ {
+ hColumn.mask = HDI_FORMAT;
+ Header_GetItem(hHeader, nLastHeaderID, &hColumn);
+ hColumn.fmt &= ~(HDF_SORTUP | HDF_SORTDOWN);
+ Header_SetItem(hHeader, nLastHeaderID, &hColumn);
+ }
+ /* Set the sorting style to the new column */
+ hColumn.mask = HDI_FORMAT;
+ Header_GetItem(hHeader, nHeaderID, &hColumn);
+
+ hColumn.fmt &= (bIsAscending ? ~HDF_SORTDOWN : ~HDF_SORTUP);
+ hColumn.fmt |= (bIsAscending ? HDF_SORTUP : HDF_SORTDOWN);
+ Header_SetItem(hHeader, nHeaderID, &hColumn);
+
+ /* Sort the list, using the current values of nHeaderID and bIsAscending */
+ SortContext ctx = {this, nHeaderID};
SortItems(s_CompareFunc, &ctx);
- bAscending = !bAscending;
+ /* Save new values */
+ nLastHeaderID = nHeaderID;
+ bIsAscending = !bIsAscending;
}
PVOID GetLParam(INT Index)
GetItemText(Index, iSubItem, Item2.GetBuffer(MAX_STR_LEN), MAX_STR_LEN);
Item2.ReleaseBuffer();
- if (bAscending)
- return Item2 == Item1;
- else
- return Item1 == Item2;
-
- return 0;
+ return bIsAscending ? Item1.Compare(Item2) : Item2.Compare(Item1);
}
HWND Create(HWND hwndParent)
const INT m_Width;
const INT m_Height;
- CSearchBar() : m_Width(200), m_Height(22)
+ CSearchBar() : m_Width(200), m_Height(22)
{
}
AddCategory(hRootItemAvailable, IDS_CAT_TOOLS, IDI_CAT_TOOLS);
AddCategory(hRootItemAvailable, IDS_CAT_DRIVERS, IDI_CAT_DRIVERS);
AddCategory(hRootItemAvailable, IDS_CAT_LIBS, IDI_CAT_LIBS);
+ AddCategory(hRootItemAvailable, IDS_CAT_THEMES, IDI_CAT_THEMES);
AddCategory(hRootItemAvailable, IDS_CAT_OTHER, IDI_CAT_OTHER);
m_TreeView->SetImageList();
VOID OnSize(HWND hwnd, WPARAM wParam, LPARAM lParam)
{
+ if (wParam == SIZE_MINIMIZED)
+ return;
/* Size status bar */
m_StatusBar->SendMessage(WM_SIZE, 0, 0);
UpdateApplicationsList(ENUM_CAT_VIDEO);
break;
+ case IDS_CAT_THEMES:
+ UpdateApplicationsList(ENUM_CAT_THEMES);
+ break;
+
case IDS_SELECTEDFORINST:
UpdateApplicationsList(ENUM_CAT_SELECTED);
break;
PostMessageW(WM_CLOSE, 0, 0);
break;
+ case ID_SEARCH:
+ ::SetFocus(m_SearchBar->m_hWnd);
+ break;
+
case ID_INSTALL:
if (IsAvailableEnum(SelectedEnumType))
{
{
CDownloadManager::DownloadListOfApplications(m_AvailableApps.GetSelected());
UpdateApplicationsList(-1);
+ m_ListView->SetSelected(-1, FALSE);
}
else if (CDownloadManager::DownloadApplication(m_ListView->GetSelectedData()))
{
m_ListView->DeleteAllItems();
- // Create new ImageList
+ // Create new ImageList
hImageListView = ImageList_Create(LISTVIEW_ICON_SIZE,
LISTVIEW_ICON_SIZE,
GetSystemColorDepth() | ILC_MASK,
{
InsertRichEditText(szText.GetString(), flags);
}
+
+VOID ShowMainWindow(INT nShowCmd)
+{
+ HACCEL KeyBrd;
+ MSG Msg;
+
+ hMainWnd = CreateMainWindow();
+
+ if (hMainWnd)
+ {
+ /* Maximize it if we must */
+ ShowWindow(hMainWnd, ((SettingsInfo.bSaveWndPos && SettingsInfo.Maximized) ? SW_MAXIMIZE : nShowCmd));
+ UpdateWindow(hMainWnd);
+
+ /* Load the menu hotkeys */
+ KeyBrd = LoadAcceleratorsW(NULL, MAKEINTRESOURCEW(HOTKEYS));
+
+ /* Message Loop */
+ while (GetMessageW(&Msg, NULL, 0, 0))
+ {
+ if (!TranslateAcceleratorW(hMainWnd, KeyBrd, &Msg))
+ {
+ TranslateMessage(&Msg);
+ DispatchMessageW(&Msg);
+ }
+ }
+ }
+}