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:
parent
5514672d42
commit
5e6d7d522d
@ -1094,7 +1094,7 @@ void RootLayer::MouseEventHandler(int32 code, BPortLink& msg)
|
||||
else
|
||||
{
|
||||
// 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
|
||||
BMessage upmsg(B_MOUSE_UP);
|
||||
|
@ -1237,11 +1237,7 @@ void ServerApp::DispatchMessage(int32 code, LinkMsgReader &msg)
|
||||
font.SetSize(size);
|
||||
font.SetSpacing(spacing);
|
||||
|
||||
DrawData drawdata;
|
||||
drawdata.SetFont(font);
|
||||
// TODO: make a DisplayDriver::StringWidth() function that takes
|
||||
// just a ServerFont
|
||||
width = desktop->GetDisplayDriver()->StringWidth(string, length, &drawdata);
|
||||
width = desktop->GetDisplayDriver()->StringWidth(string, length, font);
|
||||
|
||||
replylink.StartMessage(SERVER_TRUE);
|
||||
replylink.Attach<float>(width);
|
||||
|
@ -927,6 +927,23 @@ DisplayDriverPainter::StringWidth(const char *string, int32 length,
|
||||
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
|
||||
float
|
||||
DisplayDriverPainter::StringHeight(const char *string, int32 length,
|
||||
|
@ -189,6 +189,10 @@ class DisplayDriverPainter : public DisplayDriver {
|
||||
int32 length,
|
||||
const DrawData *d);
|
||||
|
||||
virtual float StringWidth( const char *string,
|
||||
int32 length,
|
||||
const ServerFont &font);
|
||||
|
||||
virtual float StringHeight( const char *string,
|
||||
int32 length,
|
||||
const DrawData *d);
|
||||
|
Loading…
Reference in New Issue
Block a user