Fixed focus issue with TreeCtrl

git-svn-id: svn://ultimatepp.org/upp/trunk@6404 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2013-10-07 18:18:06 +00:00
parent 5378818b48
commit e025587bb5
4 changed files with 39 additions and 8 deletions

View file

@ -293,9 +293,12 @@ bool TreeCtrl::IsValid(int id) const
void TreeCtrl::SetNode(int id, const TreeCtrl::Node& n)
{
(TreeCtrl::Node&)item[id] = n;
TreeCtrl::Node& m = item[id];
m = n;
Dirty(id);
SetOption(id);
if(m.ctrl)
AddChildBefore(m.ctrl, GetLastChild());
}
void TreeCtrl::RemoveChildren(int id)

View file

@ -1,6 +1,6 @@
#include "GLDraw.h"
#define LLOG(x) LOG(x)
#define LLOG(x) // LOG(x)
#ifndef GL_BGRA // Win32 missing these
#define GL_BGRA 0x80E1
@ -66,13 +66,12 @@ struct ImageGLDataMaker : LRUCache<ImageGLData, Tuple2<uint64, uint64> >::Maker
virtual int Make(ImageGLData& object) const { object.Init(img); return img.GetLength(); }
};
void GLDraw::PutImage(Point p, const Image& img, const Rect& src)
{
if(img.GetLength() == 0)
return;
LLOG("PutImage " << img.GetSerialId() << ' ' << p.x << ", " << p.y << ", "<< img.GetSize());
DLOG("PutImage " << img.GetSerialId() << ' ' << p.x << ", " << p.y << ", "<< img.GetSize());
LLOG("SysImage cache pixels " << sTextureCache.GetSize() << ", count " << sTextureCache.GetCount());
ImageGLDataMaker m;
m.img = img;
@ -132,7 +131,7 @@ void GLDraw::SetColor(Color c)
void GLDraw::PutRect(const Rect& r, Color color)
{
LLOG("PutRect " << r << " " << color);
DLOG("PutRect " << r << " " << color);
bool inv = color == InvertColor();
if(inv)
glBlendFunc(GL_ONE_MINUS_DST_COLOR, GL_ONE_MINUS_SRC_COLOR);
@ -170,6 +169,25 @@ void GLDraw::Init(Size sz, uint64 context_)
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
LOG("==============================================================================");
/*
glGenBuffers(1, &vbo);
glBindBuffer(GL_ARRAY_BUFFER, triangleVBO);
glGenBuffers(1, &tbo);
glBindBuffer(GL_
*/
}
};
GLDraw::~GLDraw()
{
#ifdef USE_VBO
if(context) {
glDeleteBuffers(1, &vbo);
glDeleteBuffers(1, &tbo);
}
#endif
}
}

View file

@ -5,12 +5,19 @@
#include <GL/gl.h>
namespace Upp {
// #define USE_VBO 1
class GLDraw : public SDraw {
void SetColor(Color c);
uint64 context;
#ifdef USE_VBO
GLuint vbo, tbo;
#endif
public:
virtual void PutImage(Point p, const Image& m, const Rect& src);
virtual void PutRect(const Rect& r, Color color);
@ -20,7 +27,9 @@ public:
static void ClearCache();
static void ResetCache();
GLDraw() { context = 0; }
GLDraw() { context = 0; /* vbo = 0; tbo = 0; */ }
~GLDraw();
};
};

View file

@ -4,5 +4,6 @@ uses
file
GLDraw.h,
GLDraw.cpp;
GLDraw.cpp,
src.tpp;