static void bincdown(Flicmenu *m) { hilight(m); repeat_on_pdn(bincd); draw_sel(m); }
static void go_rootdir(Button *b) { Dsel_group *dg = b->group; char *drawer = dg->drawer; hilight(b); if (drawer[1] == DEV_DELIM) drawer += 2; strcpy(drawer, DIR_DELIM_STR); (*dg->on_newdrawer)(dg->on_newd_data); draw_buttontop(b); }
static void go_updir(Button *b) /* move up one directory */ { Dsel_group *dg = b->group; FilePath *filepath; hilight(b); filepath = filepath_create_from_string(dg->drawer); if (filepath != NULL) { filepath_drop_tail(filepath); filepath_to_cstr(filepath, DIR_DELIM, dg->drawer, PATH_SIZE); filepath_destroy(filepath); } (*dg->on_newdrawer)(dg->on_newd_data); draw_buttontop(b); }
void DeviceWidget::paintEvent(QPaintEvent *) { QPainter painter(this); QColor hilight(style()->standardPalette().window().color().lighter(104)); QColor dark(style()->standardPalette().window().color().darker(100)); if (isDefaultDevice()) { QPen pen(dark.darker(170)); painter.setPen(pen); QLinearGradient grad(width(), 0, width(), height()); grad.setColorAt(0.48, hilight); grad.setColorAt(0.5, dark); hilight.setAlpha(100); dark.setAlpha(100); QLinearGradient grad2(width(), 0, width(), height()); grad2.setColorAt(0.3, hilight); grad2.setColorAt(0.5, dark.darker(105)); grad2.setColorAt(1, dark.darker(115)); QBrush brush(grad); painter.setBrush(brush); painter.drawRoundedRect(0, 0, width()-1, height()-1, 2, 2); QBrush brush2(grad2); painter.setBrush(brush2); painter.drawRoundedRect(0, 0, width()-1, height()-1, 2, 2); } else { QPen pen(dark.darker(110)); painter.setPen(pen); painter.drawRoundedRect(0, 0, width()-1, height()-1, 2, 2); } }
static int CoolBarCtrlProc (HWND hWnd, int message, WPARAM wParam, LPARAM lParam) { HDC hdc; PCOOLBARCTRL TbarData; PCOOLBARITEMDATA pTbid; switch (message) { case MSG_CREATE: { DWORD data; DWORD dwStyle; const char* caption; if ((TbarData = (COOLBARCTRL*) calloc (1, sizeof (COOLBARCTRL))) == NULL) return 1; TbarData->nCount = 0; TbarData->head = TbarData->tail = NULL; TbarData->BackBmp = NULL; TbarData->iSel = -1; TbarData->iMvOver = -1; TbarData->ShowHint = TRUE; TbarData->hToolTip = 0; ExcludeWindowStyle (hWnd, WS_BORDER); dwStyle = GetWindowStyle (hWnd); if (dwStyle & CBS_BMP_32X32) { TbarData->ItemWidth = 32; TbarData->ItemHeight = 32; } else if (dwStyle & CBS_BMP_CUSTOM) { data = GetWindowAdditionalData (hWnd); TbarData->ItemWidth = LOWORD (data); TbarData->ItemHeight = HIWORD (data); } else { TbarData->ItemWidth = 16; TbarData->ItemHeight = 16; } caption = GetWindowCaption (hWnd); if ((dwStyle & CBS_USEBKBMP) && caption [0]) { TbarData->BackBmp = (BITMAP*)calloc (1, sizeof (BITMAP)); if (LoadBitmap (HDC_SCREEN, TbarData->BackBmp, caption) < 0) { free (TbarData->BackBmp); TbarData->BackBmp = NULL; break; } } SetWindowAdditionalData2 (hWnd, (DWORD)TbarData); } break; case MSG_DESTROY: { COOLBARITEMDATA* unloaddata, *tmp; TbarData = (PCOOLBARCTRL) GetWindowAdditionalData2(hWnd); if (TbarData->hToolTip != 0) { DestroyToolTipWin (TbarData->hToolTip); TbarData->hToolTip = 0; } if (TbarData->BackBmp) { UnloadBitmap (TbarData->BackBmp); free (TbarData->BackBmp); } unloaddata = TbarData->head; while (unloaddata) { tmp = unloaddata->next; free (unloaddata); unloaddata = tmp; } free (TbarData); } break; case MSG_SIZECHANGING: { const RECT* rcExpect = (const RECT*)wParam; RECT* rcResult = (RECT*)lParam; TbarData = (PCOOLBARCTRL) GetWindowAdditionalData2(hWnd); rcResult->left = rcExpect->left; rcResult->top = rcExpect->top; rcResult->right = rcExpect->right; rcResult->bottom = rcExpect->top + TbarData->ItemHeight + 8; return 0; } case MSG_SIZECHANGED: { RECT* rcWin = (RECT*)wParam; RECT* rcClient = (RECT*)lParam; *rcClient = *rcWin; return 1; } case MSG_NCPAINT: return 0; case MSG_PAINT: { TbarData = (PCOOLBARCTRL) GetWindowAdditionalData2(hWnd); hdc = BeginPaint (hWnd); DrawCoolBox (hWnd, hdc, TbarData); EndPaint (hWnd, hdc); return 0; } case CBM_ADDITEM: { COOLBARITEMINFO* TbarInfo = NULL; COOLBARITEMDATA* ptemp; RECT rc; TbarData = (PCOOLBARCTRL) GetWindowAdditionalData2 (hWnd); TbarInfo = (COOLBARITEMINFO*) lParam; if (!(ptemp = (COOLBARITEMDATA*)calloc (1, sizeof (COOLBARITEMDATA)))) { return -1; } GetClientRect (hWnd, &rc); ptemp->id = TbarInfo->id; ptemp->Disable = 0; ptemp->ItemType = TbarInfo->ItemType; if (TbarInfo->ItemHint) { strncpy (ptemp->Hint, TbarInfo->ItemHint, LEN_HINT); ptemp->Hint [LEN_HINT] = '\0'; } else ptemp->Hint [0] = '\0'; if (TbarInfo->Caption) { strncpy (ptemp->Caption, TbarInfo->Caption, LEN_TITLE); ptemp->Caption [LEN_TITLE] = '\0'; } else ptemp->Caption [0] = '\0'; ptemp->Bmp = TbarInfo->Bmp; set_item_rect (hWnd, TbarData, ptemp); ptemp->next = NULL; if (TbarData->nCount == 0) { TbarData->head = TbarData->tail = ptemp; } else if (TbarData->nCount > 0) { TbarData->tail->next = ptemp; TbarData->tail = ptemp; } ptemp->insPos = TbarData->nCount; TbarData->nCount++; InvalidateRect (hWnd, NULL, TRUE); return 0; } case CBM_ENABLE: TbarData = (PCOOLBARCTRL)GetWindowAdditionalData2 (hWnd); if (enable_item (TbarData, wParam, lParam)) return -1; InvalidateRect (hWnd, NULL, TRUE); return 0; case MSG_LBUTTONDOWN: { int posx, posy; TbarData=(PCOOLBARCTRL) GetWindowAdditionalData2(hWnd); posx = LOSWORD (lParam); posy = HISWORD (lParam); if (GetCapture () == hWnd) break; SetCapture (hWnd); if ((pTbid = GetCurTag (posx, posy, TbarData)) == NULL) break; TbarData->iSel = pTbid->insPos; break; } case MSG_LBUTTONUP: { int x, y; TbarData = (PCOOLBARCTRL)GetWindowAdditionalData2(hWnd); x = LOSWORD(lParam); y = HISWORD(lParam); if (GetCapture() != hWnd) break; ReleaseCapture (); ScreenToClient (hWnd, &x, &y); if ((pTbid = GetCurTag(x, y, TbarData)) == NULL) { break; } if (TbarData->iSel == pTbid->insPos && !pTbid->Disable) NotifyParent (hWnd, GetDlgCtrlID(hWnd), pTbid->id); TbarData->iSel = -1; break; } case MSG_MOUSEMOVE: { int x, y; TbarData = (PCOOLBARCTRL) GetWindowAdditionalData2(hWnd); x = LOSWORD(lParam); y = HISWORD(lParam); if (GetCapture() == hWnd) ScreenToClient (hWnd, &x, &y); if ((pTbid = GetCurTag (x, y, TbarData)) == NULL) { unhilight (hWnd); break; } if (TbarData->iMvOver == pTbid->insPos) break; unhilight (hWnd); TbarData->iMvOver = pTbid->insPos; hilight (hWnd, TbarData, pTbid); break; } case MSG_MOUSEMOVEIN: if (!wParam) unhilight (hWnd); break; case MSG_NCLBUTTONDOWN: case MSG_KILLFOCUS: unhilight (hWnd); break; } return DefaultControlProc (hWnd, message, wParam, lParam); }