如何做一个插件,调整它的窗口 [英] How does a plugin resize it's window
问题描述
当我加载具有以下HTML的PDF插件似乎重新调整它的窗口,以适应PDF文件的完整长度的PDF文件。我想知道这个插件怎么做呢?
When I load a pdf with the following html the pdf plugin seems to resize it's windows to accommodate the complete length of the pdf file. I'm wondering how the plugin does that?
<!DOCTYPE html>
<html>
<head>
<title>Test html object tag</title>
<style type = "text/css">
html
{
height: 100%;
}
body
{
margin: 0;
padding: 0;
height: 100%;
}
.my_style
{
width: 100%;
min-height: 100%;
}
</style>
</head>
<body>
<div class="my_style">
<object class = "my_style" data="data/test.pdf" type="application/pdf"></object>
</div>
</body>
</html>
据我的理解是提供给插件中的HTML对象标记定义窗口的大小。
As far as I understand it the size of a window that is provided to a plugin is defined in the html object tag.
谢谢,
基督教
Thanks, Christian
推荐答案
这是纯属猜测,因为我没有源头上说的插件,但是如果我试图解决这个问题,我只会得到一个参考我的插件的对象标记并设置宽度和高度。
This is pure speculation, since I don't have the source to said plugin, but if I were trying to solve this issue I would simply get a reference to the object tag of my plugin and set the width and height.
没有测试code,但这些方针的东西或许应该工作:
Haven't tested this code, but something along these lines should probably work:
FB::DOM::ElementPtr elem(m_host->getDOMElement());
elem->setWidth(640);
elem->setHeight(480);
显然,无论你做,你需要访问BrowerHostPtr(m_host)。
Obviously wherever you do that you need access to the BrowerHostPtr (m_host).
这篇关于如何做一个插件,调整它的窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!