Default text for application tree view.

svn path=/trunk/; revision=25188
This commit is contained in:
Maarten Bosma 2006-12-17 22:38:35 +00:00
parent 51f203737a
commit 564debb90d
3 changed files with 65 additions and 54 deletions

View file

@ -26,6 +26,15 @@ BOOL ProcessXML (const char* filename, struct Category* Root);
VOID FreeTree (struct Category* Node);
WCHAR Strings [STRING_COUNT][MAX_STRING_LENGHT];
void ShowMessage (WCHAR* title, WCHAR* message)
{
DescriptionHeadline = title;
DescriptionText = message;
HWND hwnd = GetParent(hCategories);
InvalidateRect(hwnd,NULL,TRUE);
UpdateWindow(hwnd);
}
void AddItems (HWND hwnd, struct Category* Category, struct Category* Parent)
{
@ -49,9 +58,19 @@ void AddItems (HWND hwnd, struct Category* Category, struct Category* Parent)
AddItems (hwnd,Category->Children,Category);
}
void DisplayApps (HWND hwnd, struct Category* Category)
void CategoryChoosen (HWND hwnd, struct Category* Category)
{
struct Application* CurrentApplication = Category->Apps;
struct Application* CurrentApplication;
SelectedApplication = NULL;
if(Category->Children && !Category->Apps)
ShowMessage(Category->Name, Strings[IDS_CHOOSE_SUB]);
else if(!Category->Children && Category->Apps)
ShowMessage(Category->Name, Strings[IDS_CHOOSE_APP]);
else if(Category->Children && Category->Apps)
ShowMessage(Category->Name, Strings[IDS_CHOOSE_BOTH]);
else
ShowMessage(Category->Name, Strings[IDS_NO_APPS]);
TreeView_DeleteItem(hwnd, TVI_ROOT);
@ -60,6 +79,8 @@ void DisplayApps (HWND hwnd, struct Category* Category)
Insert.hInsertAfter = TVI_LAST;
Insert.hParent = TVI_ROOT;
CurrentApplication = Category->Apps;
while(CurrentApplication)
{
Insert.item.lParam = (UINT)CurrentApplication;
@ -68,7 +89,7 @@ void DisplayApps (HWND hwnd, struct Category* Category)
SendMessage(hwnd, TVM_INSERTITEM, 0, (LPARAM)&Insert);
CurrentApplication = CurrentApplication->Next;
}
}
}
BOOL SetupControls (HWND hwnd)
{
@ -96,6 +117,13 @@ BOOL SetupControls (HWND hwnd)
SendMessageW(hUpdateButton, BM_SETIMAGE, (WPARAM)IMAGE_BITMAP,(LPARAM)(HANDLE)LoadBitmap(hInstance, MAKEINTRESOURCE(IDB_UPDATE)));
SendMessageW(hDownloadButton, BM_SETIMAGE, (WPARAM)IMAGE_BITMAP,(LPARAM)(HANDLE)LoadBitmap(hInstance, MAKEINTRESOURCE(IDB_DOWNLOAD)));
// Set deflaut entry for hApps
TV_INSERTSTRUCT Insert = {0};
Insert.item.mask = TVIF_TEXT;
Insert.item.pszText = Strings[IDS_CHOOSE_CATEGORY];
Insert.item.cchTextMax = lstrlen(Strings[IDS_CHOOSE_CATEGORY]);
SendMessage(hApps, TVM_INSERTITEM, 0, (LPARAM)&Insert);
// Create Tree Icons
HIMAGELIST hImageList = ImageList_Create(16, 16, ILC_COLORDDB, 1, 1);
SendMessageW(hCategories, TVM_SETIMAGELIST, TVSIL_NORMAL, (LPARAM)(HIMAGELIST)hImageList);
@ -134,15 +162,6 @@ static void DrawBitmap (HDC hdc, int x, int y, HBITMAP hBmp)
DeleteDC(hdcMem);
}
void ShowMessage (WCHAR* title, WCHAR* message)
{
DescriptionHeadline = title;
DescriptionText = message;
HWND hwnd = GetParent(hCategories);
InvalidateRect(hwnd,NULL,TRUE);
UpdateWindow(hwnd);
}
HFONT GetFont (BOOL Title)
{
@ -239,18 +258,8 @@ LRESULT CALLBACK WndProc (HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
{
if(data->hwndFrom == hCategories)
{
SelectedApplication = NULL;
struct Category* Category = (struct Category*) ((LPNMTREEVIEW)lParam)->itemNew.lParam;
DisplayApps (hApps, Category);
if(Category->Children && !Category->Apps)
ShowMessage(Category->Name, Strings[IDS_SUBS]);
else if(!Category->Children && Category->Apps)
ShowMessage(Category->Name, Strings[IDS_APPS]);
else if(Category->Children && Category->Apps)
ShowMessage(Category->Name, Strings[IDS_BOTH]);
else
ShowMessage(Category->Name, Strings[IDS_NO_APPS]);
CategoryChoosen (hApps, Category);
}
else if(data->hwndFrom == hApps)
{

View file

@ -19,21 +19,22 @@
#define IDC_STATUS 0x1001
#define IDC_REMOVE 0x1002
#define IDS_WINDOW_TITLE 0x0
#define IDS_WELCOME_TITLE 0x1
#define IDS_WELCOME 0x2
#define IDS_NO_APP_TITLE 0x3
#define IDS_NO_APP 0x4
#define IDS_UPDATE_TITLE 0x5
#define IDS_UPDATE 0x6
#define IDS_HELP_TITLE 0x7
#define IDS_HELP 0x8
#define IDS_NO_APPS 0x9
#define IDS_APPS 0xA
#define IDS_SUBS 0xB
#define IDS_BOTH 0xC
#define IDS_XMLERROR_1 0xD
#define IDS_XMLERROR_2 0xE
#define IDS_WINDOW_TITLE 0
#define IDS_WELCOME_TITLE 1
#define IDS_WELCOME 2
#define IDS_NO_APP_TITLE 3
#define IDS_NO_APP 4
#define IDS_UPDATE_TITLE 5
#define IDS_UPDATE 6
#define IDS_HELP_TITLE 7
#define IDS_HELP 8
#define IDS_NO_APPS 9
#define IDS_CHOOSE_APP 10
#define IDS_CHOOSE_SUB 11
#define IDS_CHOOSE_CATEGORY 12
#define IDS_CHOOSE_BOTH 13
#define IDS_XMLERROR_1 14
#define IDS_XMLERROR_2 15
#define STRING_COUNT 0xE
#define STRING_COUNT 15
#define MAX_STRING_LENGHT 0x100

View file

@ -12,19 +12,20 @@ FONT 8, "MS Shell Dlg"
STRINGTABLE DISCARDABLE
BEGIN
IDS_WINDOW_TITLE "Download ! - ReactOS Downloader"
IDS_WELCOME_TITLE "Welcome to the ReactOS Downloader"
IDS_WELCOME "Please choose a category on the right. This is version 1.0."
IDS_NO_APP_TITLE "No application selected"
IDS_NO_APP "Please select a Application before you click the download button, if you need assistance please click on the question mark button on the top right corner."
IDS_UPDATE_TITLE "Update"
IDS_UPDATE "Sorry this future is not implemented yet."
IDS_HELP_TITLE "Help"
IDS_HELP "Choose a category on the right, then choose a application and click the download button. To update the application information click the button next to the help button."
IDS_NO_APPS "Sorry, there no applications in this category yet. You can help and add more applications."
IDS_APPS "Please choose an application."
IDS_SUBS "Please choose a subcategory."
IDS_BOTH "Please choose a subcategory or an application."
IDS_XMLERROR_1 "Could not find the xml file !"
IDS_XMLERROR_2 "Could not parse the xml file !"
IDS_WINDOW_TITLE "Download ! - ReactOS Downloader"
IDS_WELCOME_TITLE "Welcome to the ReactOS Downloader"
IDS_WELCOME "Please choose a category on the right. This is version 1.0."
IDS_NO_APP_TITLE "No application selected"
IDS_NO_APP "Please select a Application before you click the download button, if you need assistance please click on the question mark button on the top right corner."
IDS_UPDATE_TITLE "Update"
IDS_UPDATE "Sorry this future is not implemented yet."
IDS_HELP_TITLE "Help"
IDS_HELP "Choose a category on the right, then choose a application and click the download button. To update the application information click the button next to the help button."
IDS_NO_APPS "Sorry, there no applications in this category yet. You can help and add more applications."
IDS_CHOOSE_APP "Please choose an application."
IDS_CHOOSE_SUB "Please choose a subcategory."
IDS_CHOOSE_CATEGORY "Please choose a category."
IDS_CHOOSE_BOTH "Please choose a subcategory or an application."
IDS_XMLERROR_1 "Could not find the xml file !"
IDS_XMLERROR_2 "Could not parse the xml file !"
END