mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-07-11 22:03:01 -06:00
CtrlCore: Cocoa support
git-svn-id: svn://ultimatepp.org/upp/trunk@12105 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
86f6259dd4
commit
7325866c3a
6 changed files with 14 additions and 39 deletions
|
|
@ -44,6 +44,7 @@ Upp::Ctrl *Upp::Ctrl::GetActiveCtrl()
|
|||
bool Upp::Ctrl::SetWndFocus()
|
||||
{
|
||||
GuiLock __;
|
||||
DLOG("SetWndFocus " << Name());
|
||||
if(top && top->coco) {
|
||||
[top->coco->window orderFront:top->coco->window];
|
||||
[top->coco->window makeKeyWindow];
|
||||
|
|
@ -107,7 +108,7 @@ void Upp::Ctrl::Create(Ctrl *owner, dword style, bool active)
|
|||
|
||||
void Upp::Ctrl::WndDestroy()
|
||||
{
|
||||
DLOG("WndDestroy " << this);
|
||||
DLOG("WndDestroy " << Name());
|
||||
if(!top)
|
||||
return;
|
||||
Ptr<Ctrl> owner = GetOwner();
|
||||
|
|
@ -146,7 +147,7 @@ bool Upp::Ctrl::IsWndOpen() const {
|
|||
|
||||
void Upp::Ctrl::PopUp(Ctrl *owner, bool savebits, bool activate, bool dropshadow, bool topmost)
|
||||
{
|
||||
Create(owner, NSWindowStyleMaskBorderless, activate);
|
||||
Create(owner, NSWindowStyleMaskBorderless, false);
|
||||
}
|
||||
|
||||
Upp::dword Upp::TopWindow::GetMMStyle() const
|
||||
|
|
|
|||
|
|
@ -74,21 +74,6 @@ void SystemDraw::OffsetOp(Point p)
|
|||
offset.Top() += p;
|
||||
}
|
||||
|
||||
#if 0
|
||||
CGRect SystemDraw::AsCG(const Rect& r)
|
||||
{
|
||||
Point p = r.TopLeft();
|
||||
Size sz = r.GetSize();
|
||||
Convert(p.x, p.y);
|
||||
CGRect cgr;
|
||||
cgr.origin.x = p.x;
|
||||
cgr.origin.y = p.y;
|
||||
cgr.size.width = sz.cx;
|
||||
cgr.size.height = sz.cy;
|
||||
return cgr;
|
||||
}
|
||||
#endif
|
||||
|
||||
PointCG SystemDraw::Convert(int x, int y)
|
||||
{
|
||||
Point p = GetOffset(); // TODO: Optimize
|
||||
|
|
@ -118,7 +103,6 @@ RectCG SystemDraw::MakeRectCG(const Rect& r)
|
|||
|
||||
void SystemDraw::ClipCG(const Rect& r)
|
||||
{
|
||||
DLOG("ClipCG " << r);
|
||||
CGContextClipToRect(cgHandle, MakeRectCG(r));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -77,7 +77,6 @@ struct MMImp {
|
|||
|
||||
static void Paint(Upp::Ctrl *ctrl, Upp::SystemDraw& w, const Rect& r)
|
||||
{
|
||||
DLOG("MMPaint " << r);
|
||||
ctrl->fullrefresh = false;
|
||||
ctrl->UpdateArea(w, r);
|
||||
}
|
||||
|
|
@ -121,10 +120,8 @@ struct MMImp {
|
|||
|
||||
static void DoClose(Upp::Ctrl *ctrl)
|
||||
{
|
||||
DLOG("DoClose");
|
||||
ctrl->MMClose();
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
};
|
||||
|
|
@ -192,12 +189,12 @@ struct MMImp {
|
|||
//TODO: more layout changes
|
||||
|
||||
- (void)windowDidBecomeKey:(NSNotification *)notification {
|
||||
DLOG("DidBecomeKey");
|
||||
DLOG("DidBecomeKey" << ctrl->Name());
|
||||
Upp::MMImp::BecomeKey(ctrl);
|
||||
}
|
||||
|
||||
- (void)windowDidResignKey:(NSNotification *)notification {
|
||||
DLOG("DidResignKey");
|
||||
DLOG("DidResignKey " << ctrl->Name());
|
||||
Upp::MMImp::ResignKey(ctrl);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace Upp {
|
||||
|
||||
#define LLOG(x) DLOG(x)
|
||||
#define LLOG(x) // DLOG(x)
|
||||
#define LTIMING(x) // TIMING(x)
|
||||
|
||||
bool Ctrl::globalbackpaint;
|
||||
|
|
@ -351,12 +351,8 @@ void Ctrl::CtrlPaint(SystemDraw& w, const Rect& clip) {
|
|||
LTIMING("CtrlPaint");
|
||||
Rect rect = GetRect().GetSize();
|
||||
Rect orect = rect.Inflated(overpaint);
|
||||
DDUMP(Name());
|
||||
DDUMP(orect);
|
||||
DDUMP(clip);
|
||||
if(!IsShown() || orect.IsEmpty() || clip.IsEmpty() || !clip.Intersects(orect))
|
||||
return;
|
||||
DLOG("2");
|
||||
Ctrl *q;
|
||||
Rect view = rect;
|
||||
for(int i = 0; i < frame.GetCount(); i++) {
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace Upp {
|
||||
|
||||
#define LLOG(x) // DLOG(x)
|
||||
#define LLOG(x) DLOG(x)
|
||||
|
||||
Ptr<Ctrl> Ctrl::focusCtrl;
|
||||
Ptr<Ctrl> Ctrl::focusCtrlWnd;
|
||||
|
|
@ -238,7 +238,11 @@ bool Ctrl::SetFocus0(bool activate)
|
|||
Ptr<Ctrl> topwindow = GetTopWindow();
|
||||
Ptr<Ctrl> topctrl = GetTopCtrl();
|
||||
Ptr<Ctrl> _this = this;
|
||||
#ifdef PLATFORM_COCOA
|
||||
topwindow = topctrl;
|
||||
#else
|
||||
if(!topwindow) topwindow = topctrl;
|
||||
#endif
|
||||
LLOG("SetFocus -> SetWndFocus: topwindow = " << UPP::Name(topwindow) << ", focusCtrlWnd = " << UPP::Name(focusCtrlWnd));
|
||||
if(!topwindow->HasWndFocus() && !topwindow->SetWndFocus()) return false;// cxl 31.1.2004
|
||||
#ifdef PLATFORM_OSX11 // ugly temporary hack - popups not behaving right in MacOS
|
||||
|
|
@ -372,9 +376,6 @@ String GetKeyDesc(dword key)
|
|||
if(key == 0)
|
||||
return desc;
|
||||
|
||||
DDUMPHEX(key);
|
||||
DDUMPHEX(K_DELETE);
|
||||
|
||||
if(key & K_KEYUP) desc << t_("key\vUP ");
|
||||
if(key & K_CTRL) desc << t_("key\vCtrl+");
|
||||
if(key & K_ALT) desc << t_("key\vAlt+");
|
||||
|
|
@ -383,8 +384,7 @@ String GetKeyDesc(dword key)
|
|||
if(key & K_OPTION) desc << t_("key\vOption+");
|
||||
#endif
|
||||
|
||||
|
||||
key &= ~(K_CTRL | K_ALT | K_SHIFT | K_KEYUP);
|
||||
key &= ~(K_CTRL | K_ALT | K_SHIFT | K_OPTION | K_KEYUP);
|
||||
#ifdef PLATFORM_COCOA
|
||||
key &= ~(K_OPTION);
|
||||
#endif
|
||||
|
|
@ -460,14 +460,11 @@ String GetKeyDesc(dword key)
|
|||
{ K_BACKSLASH, tt_("key\v[\\]") }, { K_RBRACKET, tt_("key\v[]]") }, { K_QUOTEDBL, tt_("key\v[']") },
|
||||
{ 0, NULL }
|
||||
};
|
||||
for(int i = 0; nkey[i].key; i++) {
|
||||
DDUMPHEX(nkey[i].key);
|
||||
DDUMP(nkey[i].name);
|
||||
for(int i = 0; nkey[i].key; i++)
|
||||
if(nkey[i].key == key) {
|
||||
desc << GetLngString(nkey[i].name);
|
||||
return desc;
|
||||
}
|
||||
}
|
||||
desc << Format("%04x", (int)key);
|
||||
}
|
||||
return desc;
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ void PopUpTable::DoClose() {
|
|||
}
|
||||
|
||||
void PopUpTable::PopupDeactivate() {
|
||||
if(open) {
|
||||
if(open) {DLOG("Deactivate");
|
||||
DoClose();
|
||||
IgnoreMouseClick();
|
||||
WhenCancel();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue