1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-09 23:34:20 +00:00
This commit is contained in:
jules 2007-06-14 15:25:12 +00:00
parent 46c2f0d252
commit 3a8d51e224
5 changed files with 49 additions and 5 deletions

View file

@ -1087,6 +1087,18 @@ public:
repainter->performAnyPendingRepaintsNow();
}
void setIcon (const Image& newIcon)
{
/*XWMHints* wmHints = XAllocWMHints();
wmHints->flags = IconPixmapHint | IconMaskHint;
wmHints->icon_pixmap =
wmHints->icon_mask =
XSetWMHints (display, windowH, wmHints);
XFree (wmHints);
*/
}
//==============================================================================
void handleWindowMessage (XEvent* event)
{
@ -2557,8 +2569,8 @@ void* juce_createMouseCursorFromImage (const Image& image, int hotspotX, int hot
}
const int stride = (cursorW + 7) >> 3;
unsigned char* const maskPlane = (unsigned char*) juce_calloc (stride * cursorH);
unsigned char* const sourcePlane = (unsigned char*) juce_calloc (stride * cursorH);
uint8* const maskPlane = (uint8*) juce_calloc (stride * cursorH);
uint8* const sourcePlane = (uint8*) juce_calloc (stride * cursorH);
bool msbfirst = (BitmapBitOrder (display) == MSBFirst);
@ -2566,7 +2578,7 @@ void* juce_createMouseCursorFromImage (const Image& image, int hotspotX, int hot
{
for (int x = cursorW; --x >= 0;)
{
const unsigned char mask = (unsigned char) (1 << (msbfirst ? (7 - (x & 7)) : (x & 7)));
const uint8 mask = (uint8) (1 << (msbfirst ? (7 - (x & 7)) : (x & 7)));
const int offset = y * stride + (x >> 3);
const Colour c (im.getPixelAt (x, y));
@ -2903,7 +2915,7 @@ void SystemClipboard::copyTextToClipboard (const String& clipText)
XRotateWindowProperties (display, root, cutBuffers, 8, 1);
XChangeProperty (display, root, cutBuffers[0],
XA_STRING, 8, PropModeReplace, (const unsigned char*)((const char*)clipText),
XA_STRING, 8, PropModeReplace, (const unsigned char*) (const char*) clipText,
clipText.length());
}

View file

@ -684,6 +684,11 @@ public:
}
}
void setIcon (const Image& /*newIcon*/)
{
// to do..
}
//==============================================================================
void viewFocusGain()
{

View file

@ -517,7 +517,8 @@ public:
fullScreen (false),
isDragging (false),
isMouseOver (false),
taskBarIcon (0)
taskBarIcon (0),
currentWindowIcon (0)
{
juce_initialiseUnicodeWindowFunctions();
@ -551,6 +552,9 @@ public:
MessageManager::getInstance()
->callFunctionOnMessageThread (&destroyWindowCallback, (void*) hwnd);
if (currentWindowIcon != 0)
DestroyIcon (currentWindowIcon);
}
//==============================================================================
@ -928,6 +932,7 @@ private:
DropShadower* shadower;
bool fullScreen, isDragging, isMouseOver;
BorderSize windowBorder;
HICON currentWindowIcon;
NOTIFYICONDATA* taskBarIcon;
friend class WindowClassHolder;
@ -1179,6 +1184,23 @@ private:
inline bool hasTitleBar() const throw() { return (styleFlags & windowHasTitleBar) != 0; }
void setIcon (const Image& newIcon)
{
HICON hicon = createHICONFromImage (newIcon, TRUE, 0, 0);
if (hicon != 0)
{
SendMessage (hwnd, WM_SETICON, ICON_BIG, (LPARAM) hicon);
SendMessage (hwnd, WM_SETICON, ICON_SMALL, (LPARAM) hicon);
if (currentWindowIcon != 0)
DestroyIcon (currentWindowIcon);
currentWindowIcon = hicon;
}
}
//==============================================================================
void handlePaintMessage()
{

View file

@ -68,6 +68,7 @@ public:
bool setAlwaysOnTop (bool) { return true; }
void toFront (bool) {}
void toBehind (ComponentPeer*) {}
void setIcon (const Image&) {}
bool isFocused() const
{

View file

@ -174,6 +174,10 @@ public:
/** True if the window is currently full-screen. */
virtual bool isFullScreen() const = 0;
/** Attempts to change the icon associated with this window.
*/
virtual void setIcon (const Image& newIcon) = 0;
/** Sets a constrainer to use if the peer can resize itself.
The constrainer won't be deleted by this object, so the caller must manage its lifetime.