Fixed a TODO - added a method for calling StringWidth with a ServerFont instead of DrawData
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12568 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1094,7 +1094,7 @@ void RootLayer::MouseEventHandler(int32 code, BPortLink& msg)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// NOTE: focus may be NULL
|
// NOTE: focus may be NULL
|
||||||
if (fLastMouseMoved->fOwner && fLastMouseMoved->fOwner == FocusWinBorder())
|
if (fLastMouseMoved->Window() && fLastMouseMoved->fOwner == FocusWinBorder())
|
||||||
{
|
{
|
||||||
// send B_MOUSE_UP for regular Layers/BViews
|
// send B_MOUSE_UP for regular Layers/BViews
|
||||||
BMessage upmsg(B_MOUSE_UP);
|
BMessage upmsg(B_MOUSE_UP);
|
||||||
|
|||||||
@@ -1237,11 +1237,7 @@ void ServerApp::DispatchMessage(int32 code, LinkMsgReader &msg)
|
|||||||
font.SetSize(size);
|
font.SetSize(size);
|
||||||
font.SetSpacing(spacing);
|
font.SetSpacing(spacing);
|
||||||
|
|
||||||
DrawData drawdata;
|
width = desktop->GetDisplayDriver()->StringWidth(string, length, font);
|
||||||
drawdata.SetFont(font);
|
|
||||||
// TODO: make a DisplayDriver::StringWidth() function that takes
|
|
||||||
// just a ServerFont
|
|
||||||
width = desktop->GetDisplayDriver()->StringWidth(string, length, &drawdata);
|
|
||||||
|
|
||||||
replylink.StartMessage(SERVER_TRUE);
|
replylink.StartMessage(SERVER_TRUE);
|
||||||
replylink.Attach<float>(width);
|
replylink.Attach<float>(width);
|
||||||
|
|||||||
@@ -927,6 +927,23 @@ DisplayDriverPainter::StringWidth(const char *string, int32 length,
|
|||||||
return width;
|
return width;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// StringWidth
|
||||||
|
float
|
||||||
|
DisplayDriverPainter::StringWidth(const char *string, int32 length,
|
||||||
|
const ServerFont &font)
|
||||||
|
{
|
||||||
|
float width = 0.0;
|
||||||
|
if (Lock()) {
|
||||||
|
DrawData d;
|
||||||
|
d.SetFont(font);
|
||||||
|
fPainter->SetDrawData(&d);
|
||||||
|
BPoint dummy(0.0, 0.0);
|
||||||
|
width = fPainter->BoundingBox(string, length, dummy).Width();
|
||||||
|
Unlock();
|
||||||
|
}
|
||||||
|
return width;
|
||||||
|
}
|
||||||
|
|
||||||
// StringHeight
|
// StringHeight
|
||||||
float
|
float
|
||||||
DisplayDriverPainter::StringHeight(const char *string, int32 length,
|
DisplayDriverPainter::StringHeight(const char *string, int32 length,
|
||||||
|
|||||||
@@ -189,6 +189,10 @@ class DisplayDriverPainter : public DisplayDriver {
|
|||||||
int32 length,
|
int32 length,
|
||||||
const DrawData *d);
|
const DrawData *d);
|
||||||
|
|
||||||
|
virtual float StringWidth( const char *string,
|
||||||
|
int32 length,
|
||||||
|
const ServerFont &font);
|
||||||
|
|
||||||
virtual float StringHeight( const char *string,
|
virtual float StringHeight( const char *string,
|
||||||
int32 length,
|
int32 length,
|
||||||
const DrawData *d);
|
const DrawData *d);
|
||||||
|
|||||||
Reference in New Issue
Block a user