mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-15 14:16:07 -06:00
CtrlCore: Cocoa always use bundled icon (#339)
* CtrlCore: Cocoa always use bundled icon. * Reworked * .cosmetics * .simplified
This commit is contained in:
parent
1596195267
commit
d4bae3cd09
7 changed files with 38 additions and 9 deletions
|
|
@ -2,8 +2,10 @@ private:
|
|||
friend struct MMCtrl;
|
||||
friend struct MMImp;
|
||||
|
||||
static bool local_dnd_copy;
|
||||
static Ptr<Ctrl> lastActive;
|
||||
static bool local_dnd_copy;
|
||||
static Ptr<Ctrl> lastActive;
|
||||
|
||||
static bool always_use_bundled_icon;
|
||||
|
||||
friend void CocoInit(int argc, const char **argv, const char **envptr);
|
||||
|
||||
|
|
@ -15,11 +17,14 @@ protected:
|
|||
static void SyncAppIcon();
|
||||
static void ResetCocoaMouse();
|
||||
static void DoCancelPreedit();
|
||||
static int GetCaretBlinkTime() { return 500; }
|
||||
static int GetCaretBlinkTime() { return 500; }
|
||||
|
||||
public:
|
||||
static void EndSession() {}
|
||||
static bool IsEndSession() { return false; }
|
||||
static void EndSession() {}
|
||||
static bool IsEndSession() { return false; }
|
||||
|
||||
static void SetAlwaysUseBundledIcon(bool enable = true) { always_use_bundled_icon = enable; }
|
||||
static bool IsAlwaysUseBundledIcon() { return always_use_bundled_icon; }
|
||||
|
||||
void *GetNSWindow() const;
|
||||
void *GetNSView() const;
|
||||
|
|
|
|||
|
|
@ -21,3 +21,5 @@ public:
|
|||
Event<Bar&> WhenDockMenu;
|
||||
|
||||
void SetMainMenu(Event<Bar&> menu);
|
||||
void SetBadgeLabel(const String& label = String());
|
||||
|
||||
|
|
@ -2,7 +2,9 @@
|
|||
|
||||
#ifdef GUI_COCOA
|
||||
|
||||
NAMESPACE_UPP
|
||||
#include <CtrlCore/CocoMM.h>
|
||||
|
||||
namespace Upp {
|
||||
|
||||
#define LLOG(x) // LOG(x)
|
||||
|
||||
|
|
@ -25,7 +27,13 @@ bool TopWindow::IsTopMost() const
|
|||
void TopWindow::GuiPlatformConstruct()
|
||||
{
|
||||
}
|
||||
|
||||
END_UPP_NAMESPACE
|
||||
|
||||
void TopWindow::SetBadgeLabel(const String& label)
|
||||
{
|
||||
NSString* nlabel = [NSString stringWithUTF8String:~label];
|
||||
[[NSApp dockTile] setBadgeLabel:nlabel];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
@ -35,6 +35,8 @@ namespace Upp {
|
|||
|
||||
static Vector<Ptr<Ctrl>> mmtopctrl; // should work without Ptr, but let us be defensive....
|
||||
|
||||
bool Ctrl::always_use_bundled_icon = false;
|
||||
|
||||
Ctrl *Ctrl::GetOwner()
|
||||
{
|
||||
GuiLock __;
|
||||
|
|
@ -276,6 +278,9 @@ void TopWindow::SyncTitle()
|
|||
|
||||
void Ctrl::SyncAppIcon()
|
||||
{
|
||||
if(always_use_bundled_icon)
|
||||
return;
|
||||
|
||||
Ctrl *q = GetFocusCtrl();
|
||||
if(!q)
|
||||
q = lastActive;
|
||||
|
|
|
|||
|
|
@ -124,7 +124,7 @@ file
|
|||
CocoClip.mm,
|
||||
CocoCtrl.cpp,
|
||||
CocoWnd.cpp,
|
||||
CocoTop.cpp,
|
||||
CocoTop.mm,
|
||||
CocoChSysInit.cpp,
|
||||
"RTF support" readonly separator,
|
||||
ParseRTF.cpp,
|
||||
|
|
|
|||
|
|
@ -570,6 +570,12 @@ void Ide::SetIdeState(int newstate)
|
|||
}
|
||||
|
||||
void Ide::MakeIcon() {
|
||||
#ifdef PLATFORM_COCOA
|
||||
String badge = IsOpen() ? main : "";
|
||||
SetBadgeLabel(badge);
|
||||
return;
|
||||
#endif
|
||||
|
||||
Image li = IdeImg::Icon256();
|
||||
#ifndef PLATFORM_POSIX // Kubuntu is using this icon for window while ignoring it in taskbar...
|
||||
WString mp = main.ToWString();
|
||||
|
|
|
|||
|
|
@ -217,6 +217,9 @@ void AppMain___()
|
|||
Ctrl::SetDarkThemeEnabled();
|
||||
Ctrl::SkinChangeSensitive();
|
||||
Ctrl::SetAppName("TheIDE");
|
||||
#ifdef PLATFORM_COCOA
|
||||
Ctrl::SetAlwaysUseBundledIcon();
|
||||
#endif
|
||||
|
||||
SetLanguage(LNG_ENGLISH);
|
||||
SetDefaultCharset(CHARSET_UTF8);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue