mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-10 20:05:49 +00:00
CheckListBox incorporated
This commit is contained in:
parent
f07e3a1f57
commit
2f5b18d98d
@ -1501,6 +1501,11 @@ void CWizardMachineApp::GenerateList(CString action, WIDGET* targetWidget, CStri
|
||||
CFileFind fileList;
|
||||
BOOL dirFound = fileList.FindFile(parentDirPath);
|
||||
|
||||
if(curWidget->type == "CheckListBox")
|
||||
{
|
||||
((CCheckListBox*)curWidget->control)->ResetContent();
|
||||
}
|
||||
|
||||
if(curWidget->type == "ListBox")
|
||||
{
|
||||
((CListBox*)curWidget->control)->ResetContent();
|
||||
@ -1521,6 +1526,11 @@ void CWizardMachineApp::GenerateList(CString action, WIDGET* targetWidget, CStri
|
||||
if (!fileList.IsDirectory()) // skip if this is a dir
|
||||
{
|
||||
CString tmpFile = fileList.GetFileName();
|
||||
if(curWidget->type == "CheckListBox")
|
||||
{
|
||||
((CCheckListBox*)curWidget->control)->AddString(tmpFile);
|
||||
}
|
||||
|
||||
if(curWidget->type == "ListBox")
|
||||
{
|
||||
((CListBox*)curWidget->control)->AddString(tmpFile);
|
||||
@ -1539,6 +1549,11 @@ void CWizardMachineApp::GenerateList(CString action, WIDGET* targetWidget, CStri
|
||||
{
|
||||
CString tmpFile = fileList.GetFileName();
|
||||
if (!(tmpFile == "." || tmpFile == "..")) {
|
||||
if(curWidget->type == "CheckListBox")
|
||||
{
|
||||
((CCheckListBox*)curWidget->control)->AddString(tmpFile);
|
||||
}
|
||||
|
||||
if(curWidget->type == "ListBox")
|
||||
{
|
||||
((CListBox*)curWidget->control)->AddString(tmpFile);
|
||||
@ -1556,6 +1571,20 @@ void CWizardMachineApp::GenerateList(CString action, WIDGET* targetWidget, CStri
|
||||
|
||||
fileList.Close();
|
||||
|
||||
if(curWidget->type == "CheckListBox")
|
||||
{
|
||||
if (curWidget->value && curWidget->value != "")
|
||||
{
|
||||
char indices[MAX_SIZE];
|
||||
|
||||
strcpy(indices, curWidget->value);
|
||||
char *s = strtok(indices, ",");
|
||||
for (; s; s=strtok(NULL, ","))
|
||||
((CCheckListBox*)curWidget->control)->SelectString(0, s);
|
||||
}
|
||||
else
|
||||
((CCheckListBox*)curWidget->control)->SetCurSel(0);
|
||||
}
|
||||
if(curWidget->type == "ListBox")
|
||||
{
|
||||
if (curWidget->value && curWidget->value != "")
|
||||
|
@ -861,7 +861,7 @@ void CWizardUI::CreateControls()
|
||||
}
|
||||
else if (widgetType == "EditBox") {
|
||||
curWidget->control = new CEdit;//Added new style parameter ES_AUTOHSCROLL- to allow *GASP* SCROLLING!!
|
||||
((CEdit*)curWidget->control)->CreateEx(WS_EX_CLIENTEDGE,
|
||||
if (((CEdit*)curWidget->control)->CreateEx(WS_EX_CLIENTEDGE,
|
||||
_T("EDIT"),
|
||||
NULL,
|
||||
WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_BORDER |ES_AUTOHSCROLL ,
|
||||
@ -869,10 +869,12 @@ void CWizardUI::CreateControls()
|
||||
curWidget->location.y,
|
||||
curWidget->size.width,
|
||||
curWidget->size.height,
|
||||
m_hWnd, 0, 0 );
|
||||
//Set maximum number of characters allowed per line - limit set to 200
|
||||
((CEdit*)curWidget->control)->SetLimitText(int(curWidget->fieldlen.length));
|
||||
((CEdit*)curWidget->control)->SetWindowText(curWidget->value);
|
||||
m_hWnd, 0, 0 ))
|
||||
{
|
||||
//Set maximum number of characters allowed per line - limit set to 200
|
||||
((CEdit*)curWidget->control)->SetLimitText(int(curWidget->fieldlen.length));
|
||||
((CEdit*)curWidget->control)->SetWindowText(curWidget->value);
|
||||
}
|
||||
}
|
||||
else if (widgetType == "Button") {
|
||||
curWidget->control = new CButton;
|
||||
@ -988,6 +990,46 @@ void CWizardUI::CreateControls()
|
||||
s = strtok( NULL, "," );
|
||||
}
|
||||
}
|
||||
else if (widgetType == "CheckListBox")
|
||||
{
|
||||
curWidget->control = new CCheckListBox;
|
||||
((CCheckListBox*)curWidget->control)->Create(
|
||||
LBS_STANDARD | LBS_HASSTRINGS | BS_CHECKBOX |
|
||||
LBS_OWNERDRAWFIXED | WS_HSCROLL | WS_VSCROLL |
|
||||
WS_TABSTOP, tmpRect, this, ID);
|
||||
((CCheckListBox*)curWidget->control)->ModifyStyleEx(NULL, WS_EX_CLIENTEDGE, 0);
|
||||
|
||||
if (curWidget->action.function == "GenerateFileList" ||
|
||||
curWidget->action.function == "GenerateDirList")
|
||||
{
|
||||
CString ext = theInterpreter->replaceVars(curWidget->action.parameters, NULL);
|
||||
theApp.GenerateList(curWidget->action.function, curWidget, ext);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < curWidget->numOfOptions; i++)
|
||||
{
|
||||
if (curWidget->options.value[i])
|
||||
{
|
||||
((CCheckListBox*)curWidget->control)->AddString(curWidget->options.value[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
char* selectedItems;
|
||||
selectedItems = (char *) GlobalAlloc(0, 20 * sizeof(char));
|
||||
strcpy(selectedItems, (char *) (LPCTSTR) curWidget->value);
|
||||
|
||||
int i;
|
||||
char *s = strtok(selectedItems, ",");
|
||||
while (s)
|
||||
{
|
||||
i = ((CCheckListBox*)curWidget->control)->FindString(0, s);
|
||||
if (i != -1)
|
||||
((CCheckListBox*)curWidget->control)->SetCheck(i, 1);
|
||||
s = strtok( NULL, "," );
|
||||
}
|
||||
}
|
||||
else if (widgetType == "ComboBox") {
|
||||
curWidget->control = new CComboBox;
|
||||
((CComboBox*)curWidget->control)->Create(CBS_DROPDOWNLIST | WS_TABSTOP, tmpRect, this, ID);
|
||||
@ -1063,11 +1105,16 @@ void CWizardUI::DisplayControls()
|
||||
void CWizardUI::DestroyCurrentScreenWidgets()
|
||||
{
|
||||
WIDGET* curWidget;
|
||||
for (int i = 0; i < m_pControlCount; i++) {
|
||||
for (int i = 0; i < m_pControlCount; i++)
|
||||
{
|
||||
curWidget = CurrentNode->pageWidgets[i];
|
||||
|
||||
if (curWidget->control)
|
||||
BOOL retFalg = curWidget->control->DestroyWindow();
|
||||
if (curWidget->control)
|
||||
{
|
||||
BOOL retFalg = curWidget->control->DestroyWindow();
|
||||
delete curWidget->control;
|
||||
curWidget->control = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1171,6 +1218,23 @@ CString CWizardUI::GetScreenValue(WIDGET *curWidget)
|
||||
rv += ",";
|
||||
}
|
||||
}
|
||||
else if (widgetType == "CheckListBox")
|
||||
{
|
||||
int count = (((CCheckListBox *)curWidget->control))->GetCount();
|
||||
|
||||
rv = "";
|
||||
CString temp;
|
||||
for (int i=0; i < count; i++)
|
||||
{
|
||||
if (((CCheckListBox *)curWidget->control)->GetCheck(i))
|
||||
{
|
||||
((CCheckListBox *)curWidget->control)->GetText(i, temp);
|
||||
if ( i > 0)
|
||||
rv += ",";
|
||||
rv += temp;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (widgetType == "ComboBox")
|
||||
{
|
||||
int selectedIndex = ((CComboBox*)curWidget->control)->GetCurSel();
|
||||
|
@ -131,7 +131,7 @@ BOOL CInterpret::IterateListBox(char *parms)
|
||||
char indices[MAX_SIZE];
|
||||
int showflag;
|
||||
|
||||
if (!w || w->type != "ListBox")
|
||||
if (!w || !(w->type == "ListBox" || w->type == "CheckListBox"))
|
||||
return FALSE;
|
||||
|
||||
if (w->control && w->control->m_hWnd)
|
||||
@ -499,6 +499,16 @@ BOOL CInterpret::interpret(CString cmds, WIDGET *curWidget)
|
||||
theApp.SetGlobal(name, value);
|
||||
}
|
||||
}
|
||||
else if (strcmp(pcmd, "ShowDescription") == 0)
|
||||
{
|
||||
if (curWidget)
|
||||
{
|
||||
int i = ((CCheckListBox*)curWidget->control)->GetCurSel();
|
||||
WIDGET *t = theApp.findWidget((char *)(LPCSTR) curWidget->target);
|
||||
CString msg(i);
|
||||
((CEdit*)t->control)->SetWindowText(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
// This is an extra free...
|
||||
//free(pcmd);
|
||||
|
Loading…
Reference in New Issue
Block a user