Mercurial > dwindows
comparison win/dw.c @ 566:f6de197ecbe9
Add dw_color_choose()
author | mhessling@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Thu, 17 Jun 2004 11:22:14 +0000 |
parents | c0a708e2cba3 |
children | 828e6a66c5c5 |
comparison
equal
deleted
inserted
replaced
565:355a6d46adb1 | 566:f6de197ecbe9 |
---|---|
3634 lf.lfCharSet = DEFAULT_CHARSET; | 3634 lf.lfCharSet = DEFAULT_CHARSET; |
3635 lf.lfOutPrecision = 0; | 3635 lf.lfOutPrecision = 0; |
3636 lf.lfClipPrecision = 0; | 3636 lf.lfClipPrecision = 0; |
3637 lf.lfQuality = DEFAULT_QUALITY; | 3637 lf.lfQuality = DEFAULT_QUALITY; |
3638 lf.lfPitchAndFamily = DEFAULT_PITCH | FW_DONTCARE; | 3638 lf.lfPitchAndFamily = DEFAULT_PITCH | FW_DONTCARE; |
3639 /* | 3639 /* |
3640 * remove any font modifiers | 3640 * remove any font modifiers |
3641 */ | 3641 */ |
3642 myFontName = strdup(&fontname[z+1]); | 3642 myFontName = strdup(&fontname[z+1]); |
3643 if(Italic) | 3643 if(Italic) |
3644 myFontName[Italic] = 0; | 3644 myFontName[Italic] = 0; |
3819 /* Hmm, the "correct" way doesn't seem to be | 3819 /* Hmm, the "correct" way doesn't seem to be |
3820 * working, but the old hackish SetParent() | 3820 * working, but the old hackish SetParent() |
3821 * at the bottom seems to work, so I'll leave | 3821 * at the bottom seems to work, so I'll leave |
3822 * it like this for now. | 3822 * it like this for now. |
3823 */ | 3823 */ |
3824 #if 0 | 3824 #if 0 |
3825 if(hwndOwner) | 3825 if(hwndOwner) |
3826 flStyleEx |= WS_EX_MDICHILD; | 3826 flStyleEx |= WS_EX_MDICHILD; |
3827 #endif | 3827 #endif |
3828 | 3828 |
3829 if(!(flStyle & WS_CAPTION)) | 3829 if(!(flStyle & WS_CAPTION)) |
4323 * Parameters: | 4323 * Parameters: |
4324 * id: An ID to be used with dw_window_from_id() or 0L. | 4324 * id: An ID to be used with dw_window_from_id() or 0L. |
4325 */ | 4325 */ |
4326 HWND API dw_mle_new(ULONG id) | 4326 HWND API dw_mle_new(ULONG id) |
4327 { | 4327 { |
4328 | 4328 |
4329 HWND tmp = CreateWindowEx(WS_EX_CLIENTEDGE, | 4329 HWND tmp = CreateWindowEx(WS_EX_CLIENTEDGE, |
4330 EDITCLASSNAME, | 4330 EDITCLASSNAME, |
4331 "", | 4331 "", |
4332 WS_VISIBLE | WS_BORDER | | 4332 WS_VISIBLE | WS_BORDER | |
4333 WS_VSCROLL | ES_MULTILINE | | 4333 WS_VSCROLL | ES_MULTILINE | |
5130 /* This should return the current color depth */ | 5130 /* This should return the current color depth */ |
5131 unsigned long API dw_color_depth_get(void) | 5131 unsigned long API dw_color_depth_get(void) |
5132 { | 5132 { |
5133 int bpp; | 5133 int bpp; |
5134 HDC hdc = GetDC(HWND_DESKTOP); | 5134 HDC hdc = GetDC(HWND_DESKTOP); |
5135 | 5135 |
5136 bpp = GetDeviceCaps(hdc, BITSPIXEL); | 5136 bpp = GetDeviceCaps(hdc, BITSPIXEL); |
5137 | 5137 |
5138 ReleaseDC(HWND_DESKTOP, hdc); | 5138 ReleaseDC(HWND_DESKTOP, hdc); |
5139 | 5139 |
5140 return bpp; | 5140 return bpp; |
7172 * bubbletext: Text to show when the mouse is above the icon. | 7172 * bubbletext: Text to show when the mouse is above the icon. |
7173 */ | 7173 */ |
7174 void API dw_taskbar_insert(HWND handle, unsigned long icon, char *bubbletext) | 7174 void API dw_taskbar_insert(HWND handle, unsigned long icon, char *bubbletext) |
7175 { | 7175 { |
7176 NOTIFYICONDATA tnid; | 7176 NOTIFYICONDATA tnid; |
7177 | 7177 |
7178 tnid.cbSize = sizeof(NOTIFYICONDATA); | 7178 tnid.cbSize = sizeof(NOTIFYICONDATA); |
7179 tnid.hWnd = handle; | 7179 tnid.hWnd = handle; |
7180 tnid.uID = icon; | 7180 tnid.uID = icon; |
7181 tnid.uFlags = NIF_MESSAGE | NIF_ICON | NIF_TIP; | 7181 tnid.uFlags = NIF_MESSAGE | NIF_ICON | NIF_TIP; |
7182 tnid.uCallbackMessage = WM_USER+2; | 7182 tnid.uCallbackMessage = WM_USER+2; |
7276 _background[threadid] = DW_RGB_TRANSPARENT; | 7276 _background[threadid] = DW_RGB_TRANSPARENT; |
7277 else | 7277 else |
7278 _background[threadid] = RGB(DW_RED_VALUE(value), DW_GREEN_VALUE(value), DW_BLUE_VALUE(value)); | 7278 _background[threadid] = RGB(DW_RED_VALUE(value), DW_GREEN_VALUE(value), DW_BLUE_VALUE(value)); |
7279 } | 7279 } |
7280 | 7280 |
7281 /* Allows the user to choose a color using the system's color chooser dialog. | |
7282 * Parameters: | |
7283 * value: current color | |
7284 * Returns: | |
7285 * The selected color or the current color if cancelled. | |
7286 */ | |
7287 unsigned long API dw_color_choose(unsigned long value) | |
7288 { | |
7289 CHOOSECOLOR cc; | |
7290 unsigned long newcolor; | |
7291 COLORREF acrCustClr[16] = {0}; | |
7292 | |
7293 value = _internal_color(value); | |
7294 if(value == DW_RGB_TRANSPARENT) | |
7295 newcolor = DW_RGB_TRANSPARENT; | |
7296 else | |
7297 newcolor = RGB(DW_RED_VALUE(value), DW_GREEN_VALUE(value), DW_BLUE_VALUE(value)); | |
7298 ZeroMemory(&cc, sizeof(CHOOSECOLOR)); | |
7299 cc.lStructSize = sizeof(CHOOSECOLOR); | |
7300 cc.rgbResult = newcolor; | |
7301 cc.hwndOwner = HWND_DESKTOP; | |
7302 cc.lpCustColors = (LPDWORD)acrCustClr; | |
7303 cc.Flags = CC_FULLOPEN | CC_RGBINIT; | |
7304 if (ChooseColor(&cc) == TRUE) | |
7305 newcolor = DW_RGB(DW_RED_VALUE(cc.rgbResult), DW_GREEN_VALUE(cc.rgbResult), DW_BLUE_VALUE(cc.rgbResult)); | |
7306 return newcolor; | |
7307 } | |
7308 | |
7281 /* Draw a point on a window (preferably a render window). | 7309 /* Draw a point on a window (preferably a render window). |
7282 * Parameters: | 7310 * Parameters: |
7283 * handle: Handle to the window. | 7311 * handle: Handle to the window. |
7284 * pixmap: Handle to the pixmap. (choose only one of these) | 7312 * pixmap: Handle to the pixmap. (choose only one of these) |
7285 * x: X coordinate. | 7313 * x: X coordinate. |
8343 * ext: Default file extention. | 8371 * ext: Default file extention. |
8344 * flags: DW_FILE_OPEN or DW_FILE_SAVE or DW_DIRECTORY_OPEN. | 8372 * flags: DW_FILE_OPEN or DW_FILE_SAVE or DW_DIRECTORY_OPEN. |
8345 * Returns: | 8373 * Returns: |
8346 * NULL on error. A malloced buffer containing | 8374 * NULL on error. A malloced buffer containing |
8347 * the file path on success. | 8375 * the file path on success. |
8348 * | 8376 * |
8349 */ | 8377 */ |
8350 char * API dw_file_browse(char *title, char *defpath, char *ext, int flags) | 8378 char * API dw_file_browse(char *title, char *defpath, char *ext, int flags) |
8351 { | 8379 { |
8352 OPENFILENAME of; | 8380 OPENFILENAME of; |
8353 char filenamebuf[1001] = ""; | 8381 char filenamebuf[1001] = ""; |