mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-07-11 22:03:01 -06:00
.developing gtk backend
git-svn-id: svn://ultimatepp.org/upp/trunk@5637 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
275cc5d8de
commit
eb7fb61ce8
8 changed files with 49 additions and 9 deletions
|
|
@ -1,6 +1,10 @@
|
|||
uses
|
||||
Draw;
|
||||
Draw,
|
||||
Gtk;
|
||||
|
||||
file
|
||||
main.cpp;
|
||||
|
||||
mainconfig
|
||||
"" = "GUI GTK";
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
#ifndef _DevDraw_icpp_init_stub
|
||||
#define _DevDraw_icpp_init_stub
|
||||
#include "Draw/init"
|
||||
#include "Gtk/init"
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -92,7 +92,6 @@ GUI_APP_MAIN
|
|||
|
||||
gtk_widget_set_events(darea, 0xffffffff);
|
||||
g_signal_connect(darea, "expose-event", G_CALLBACK(on_expose_event), &myapp);
|
||||
g_signal_connect(darea, "event", G_CALLBACK(CtrlEvent), &myapp);
|
||||
// g_signal_connect(window, "expose-event", G_CALLBACK(on_expose_event), NULL);
|
||||
g_signal_connect(window, "destroy", G_CALLBACK(gtk_main_quit), NULL);
|
||||
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ void SystemDraw::SysDrawImageOp(int x, int y, const Image& img, Color color)
|
|||
GuiLock __;
|
||||
if(img.GetLength() == 0)
|
||||
return;
|
||||
LLOG("SysDrawImageOp " << img.GetSerialId() << ' ' << img.GetSize());
|
||||
DLOG("SysDrawImageOp " << img.GetSerialId() << ' ' << x << ", " << y << ", "<< img.GetSize());
|
||||
ImageSysDataMaker m;
|
||||
static LRUCache<ImageSysData, int64> cache;
|
||||
LLOG("SysImage cache pixels " << cache.GetSize() << ", count " << cache.GetCount());
|
||||
|
|
|
|||
|
|
@ -103,6 +103,8 @@ Rect SystemDraw::GetPaintRect() const
|
|||
|
||||
void SystemDraw::DrawRectOp(int x, int y, int cx, int cy, Color color)
|
||||
{
|
||||
if(IsNull(color))
|
||||
return;
|
||||
SetColor(color);
|
||||
cairo_rectangle(cr, x, y, cx, cy);
|
||||
cairo_fill(cr);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
description "Skeleton rainbow code\377";
|
||||
description "Gtk backend\377";
|
||||
|
||||
file
|
||||
Gtk.h,
|
||||
|
|
|
|||
|
|
@ -79,10 +79,20 @@ bool Ctrl::Proc(GdkEvent *event)
|
|||
if(kv >= 0 && kv < 65536)
|
||||
DispatchKey((pressed ? K_KEYUP : kv + K_DELTA), 1);
|
||||
break;
|
||||
|
||||
case GDK_CONFIGURE: {
|
||||
GdkEventConfigure *e = (GdkEventConfigure *)event;
|
||||
Rect rect = RectC(e->x, e->y, e->width, e->height);
|
||||
LLOG("CongigureNotify " << rect);
|
||||
if(GetRect() != rect)
|
||||
SetWndRect(rect);
|
||||
// TODO: Add DHCtrl support
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
END_UPP_NAMESPACE
|
||||
|
|
|
|||
|
|
@ -11,6 +11,32 @@ struct MyApp : TopWindow {
|
|||
{
|
||||
log.Add(s);
|
||||
log.Remove(0, max(log.GetCount() - 16, 0));
|
||||
Refresh();
|
||||
}
|
||||
|
||||
virtual void Activate()
|
||||
{
|
||||
Log("Activate");
|
||||
}
|
||||
|
||||
virtual void Deactivate()
|
||||
{
|
||||
Log("Deactivate");
|
||||
}
|
||||
|
||||
virtual void Layout()
|
||||
{
|
||||
Log("Layout");
|
||||
}
|
||||
|
||||
virtual void GotFocus()
|
||||
{
|
||||
Log("GotFocus");
|
||||
}
|
||||
|
||||
virtual void LostFocus()
|
||||
{
|
||||
Log("LostFocus");
|
||||
}
|
||||
|
||||
virtual Image MouseEvent(int event, Point p, int zdelta, dword keyflags)
|
||||
|
|
@ -33,14 +59,12 @@ struct MyApp : TopWindow {
|
|||
Tuple2<int, const char *> *b = FindTuple(map, __countof(map), event & ACTION);
|
||||
Log(String().Cat() << "MOUSE " << (a ? a->b : "") << '|' << (b ? b->b : "") << ' ' << p);
|
||||
|
||||
Refresh();
|
||||
return TopWindow::MouseEvent(event, p, zdelta, keyflags);
|
||||
}
|
||||
|
||||
virtual bool Key(dword key, int count)
|
||||
{
|
||||
Log(GetKeyDesc(key).Cat() << ' ' << count);
|
||||
Refresh();
|
||||
}
|
||||
|
||||
virtual void MouseMove(Point p, dword keyflags)
|
||||
|
|
@ -71,8 +95,8 @@ struct MyApp : TopWindow {
|
|||
|
||||
GUI_APP_MAIN
|
||||
{
|
||||
// MyApp().Run();
|
||||
// return;
|
||||
MyApp().Run();
|
||||
return;
|
||||
|
||||
PromptOK("Hello world!");
|
||||
return;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue