LRESULT CALLBACK WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { if(uMsg == WM_SHELLHOOKMESSAGE) { int i; for(i = 0; shell_list[i].pMsg; i++) { if(shell_list[i].uMsg == wParam) { AddEditText(shell_list[i].pMsg, (HWND)lParam); return 0; } } return 0; } switch(uMsg) { case WM_SIZE: { RECT rect; GetClientRect(hwnd, &rect); MoveWindow(hwndEdit, 0, 0, rect.right - rect.left, rect.bottom - rect.top, TRUE); return 0; } case WM_CREATE: { RECT rect; hwndMain = hwnd; GetClientRect(hwnd, &rect); hwndEdit = CreateWindowEx(0, WC_EDIT, NULL, WS_CHILD | WS_VISIBLE | ES_AUTOHSCROLL | ES_AUTOVSCROLL | ES_MULTILINE | WS_HSCROLL | WS_VSCROLL, 0, 0, rect.right - rect.left, rect.bottom - rect.top, hwnd, (HMENU)IDC_EDIT, ((CREATESTRUCT*)lParam)->hInstance, NULL); if(!SetShellHook(hwnd)) { MessageBox(hwnd, "SetShellHook, failed.", NULL, MB_OK); } return 0; } case WM_DESTROY: PostQuitMessage(0); return 0; case WM_CLOSE: UnSetShellHook(hwnd); DestroyWindow(hwnd); return 0; } return DefWindowProc(hwnd, uMsg, wParam, lParam); }
/*********************************************************************\ Function name : CCustomSubDialog::CreateLayout Description : Created at : 27.03.02, @ 12:04:28 Created by : Thomas Kunert Modified by : \*********************************************************************/ Bool CCustomSubDialog::CreateLayout(void) { Int32 i; GroupBegin(100, BFH_SCALEFIT | BFV_SCALEFIT, 2, 0, "", 0); Int32 lID = FIRST_CUSTOM_ELEMENT_ID; if (!m_pProp || m_pProp[0].type == CUSTOMTYPE_END) { GroupBegin(100, BFH_SCALEFIT, 1, 0, "", 0); } AddCheckbox(IDC_CUSTOM_OPEN_CLOSE, BFH_LEFT, 0, 0, "Open"); Bool b = false; if (m_pElement) { CCustomElements* pElement = g_pCustomElements->GetItem(m_pElement->m_lElement); if (pElement) { BasePlugin *bs = (BasePlugin*)FindPlugin(pElement->m_lID, PLUGINTYPE_CUSTOMGUI); if (bs) { b = true; if (!(bs->GetInfo() & CUSTOMGUI_SUPPORT_LAYOUTSWITCH)) Enable(IDC_CUSTOM_OPEN_CLOSE, false); else Enable(IDC_CUSTOM_OPEN_CLOSE, true); } } } if (!b) Enable(IDC_CUSTOM_OPEN_CLOSE, true); if (!m_pProp || m_pProp[0].type == CUSTOMTYPE_END) { AddStaticText(100, BFH_LEFT | BFV_CENTER, 0, 0, GeLoadString(IDS_CUSTOM_NO_PROPS), 0); GroupEnd(); } AddStaticText(100, 0, 0, 0, "", 0); for (i = 0; m_pProp && m_pProp[i].type != CUSTOMTYPE_END; i++, lID++) { AddStaticText(100, BFH_LEFT | BFV_CENTER, 0, 0, m_pProp[i].ident, 0); switch (m_pProp[i].type) { case CUSTOMTYPE_FLAG: AddCheckbox(lID, BFH_LEFT | BFV_CENTER, 0, 0, ""); break; case CUSTOMTYPE_LONG: AddEditNumber(lID, BFH_LEFT | BFV_CENTER); break; case CUSTOMTYPE_REAL: AddEditNumber(lID, BFH_LEFT | BFV_CENTER); break; case CUSTOMTYPE_STRING: AddEditText(lID, BFH_SCALEFIT | BFV_CENTER); break; case CUSTOMTYPE_VECTOR: AddEditNumber(lID++, BFH_LEFT | BFV_CENTER); AddEditNumber(lID++, BFH_LEFT | BFV_CENTER); AddEditNumber(lID, BFH_LEFT | BFV_CENTER); break; default: AddStaticText(lID, BFH_LEFT | BFV_CENTER, 0, 0, "wird auch noch ;-)", 0); break; } } /*if (!m_pProp || i == 0) AddStaticText(100, BFH_LEFT | BFV_CENTER, 0, 0, GeLoadString(IDS_CUSTOM_NO_PROPS), 0);*/ return true; }
void PaletteSubDialog::PaletteLayout() { if(m_rowArea != NULL){ GetInt32(m_rowArea, m_rows); } if(m_layoutArea != NULL){ GetInt32(m_layoutArea, m_layout); } if(m_labelCheckArea != NULL){ GetBool(m_labelCheckArea,m_showLabel); } if(m_searchText != NULL){ GetString(m_searchText, m_searchString); } if(m_showControls && !m_controlsShown){ LayoutFlushGroup(1); GroupBegin(51, BFV_SCALEFIT, 1, 0, String(), 0); m_nameArea = AddEditText(IDC_NAME, BFH_SCALEFIT); SetString(IDC_NAME, m_palette.m_name); GroupBegin(123,BFH_SCALEFIT,0,1,String(),0); String rowText("Rows"); if(m_layout == 1){ rowText = String("Columns"); } AddStaticText(9, BFH_LEFT, 0, 0, rowText, 0); m_rowArea = AddEditNumberArrows(IDC_ROWS, BFH_RIGHT); GroupEnd(); SetInt32(m_rowArea, m_rows,1,99); m_layoutArea = AddComboBox(IDC_LAYOUT_DIRECTION,BFH_LEFT); AddChild(m_layoutArea, 0, String("Horizontal")); AddChild(m_layoutArea, 1, String("Vertical")); SetInt32(m_layoutArea, m_layout); m_labelCheckArea = AddCheckbox(IDC_LABELCHECKBOX,BFH_LEFT,0,0,String("Show Labels")); SetBool(m_labelCheckArea, m_showLabel); AddStaticText(IDC_FILTERLABEL, BFH_CENTER, 0, 0, String("Filter:"), 0); m_searchText = AddEditText(IDC_SEARCHTEXT, BFH_SCALEFIT); SetString(m_searchText, m_searchString); m_controlsShown = TRUE; GroupBegin(142,BFV_SCALEFIT,1,0,String(),0); GroupBorderNoTitle(BORDER_THIN_IN); AddButton(IDC_CREATEMATERIAL, BFH_CENTER, 0, 0, String("Create Materials")); m_linkColor = AddCheckbox(IDC_LINKMATERIALS,BFH_LEFT,0,0,String("Link colors")); GroupEnd(); AddButton(IDC_HIDE, BFH_CENTER, 0, 0, String("Hide Controls")); GroupEnd(); GroupBegin(3,BFV_SCALEFIT,1,0,String(),0); m_actionPopup = AddPopupButton(3,BFH_LEFT); m_trashArea = AddUserArea(4, BFH_CENTER); AttachUserArea(m_trash, m_trashArea); GroupEnd(); LayoutChanged(1); } if(!m_showControls && m_controlsShown){ LayoutFlushGroup(1); GroupBegin(3,BFV_SCALEFIT,1,0,String(),0); m_actionPopup = AddPopupButton(3,BFH_LEFT); m_trashArea = AddUserArea(4, BFH_CENTER); AttachUserArea(m_trash, m_trashArea); GroupEnd(); LayoutChanged(1); m_rowArea = NULL; m_layoutArea = NULL; m_labelCheckArea = NULL; m_searchText = NULL; m_controlsShown = FALSE; } LayoutFlushGroup(6); LayoutPalette(); LayoutChanged(6); }