我对GtkScale形状有疑问。
确实,我希望我的Gtkscale看起来像Gimp的关卡窗口。 我的意思是:
我可以使用GtkLabel和CSS文件构建阴影栏:
<form method="post" name="lootNumber">
Choose your 2 lucky numbers!
<input type="number" name="quantity1" min="1" max="5" /><br>
<input type="number" name="quantity2" min="1" max="5" /><br>
<input type="button" value="show" id="but"/>
</form>
</div>
<div id="loot_dice" style="<?PHP if (!isset($_POST["quantity1"]) || empty($_POST["quantity1"])) echo "display:none" ?>">
<?php $first = $_POST['quantity1'];
$second= $_POST['quantity2'];
echo $first;
echo $second;
?>
<div id="die2" class="dice">0</div>
<button id="roll" onclick="rollLoot();">Roll Dice</button>
</div>
window.onload=function() {
document.getElementById("but").onclick=function() {
var form = document.forms[this.form.name];
var div = document.getElementById("loot_dice");
div.style.display = div.style.display == 'none'?'':'none';
setTimout(function() { form.submit(); }, 3000);
}
}
但我不知道如何构建三角形滑块。
答案 0 :(得分:1)
对于快速和肮脏的实现,您可以利用3个嵌套的GtkPaned
来模拟该行为:
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.20.0 -->
<interface>
<requires lib="gtk+" version="3.20"/>
<object class="GtkWindow">
<property name="can_focus">False</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkPaned">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="wide_handle">True</property>
<child>
<object class="GtkPaned">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="position">10</property>
<property name="wide_handle">True</property>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
<packing>
<property name="resize">True</property>
<property name="shrink">True</property>
</packing>
</child>
<child>
<object class="GtkOverlay" id="Overlay1">
<property name="width_request">48</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkImage">
<property name="width_request">24</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">end</property>
<property name="stock">gtk-go-forward</property>
</object>
<packing>
<property name="index">-1</property>
</packing>
</child>
<child type="overlay">
<object class="GtkImage">
<property name="width_request">24</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="stock">gtk-goto-first</property>
</object>
</child>
</object>
<packing>
<property name="resize">True</property>
<property name="shrink">False</property>
</packing>
</child>
</object>
<packing>
<property name="resize">True</property>
<property name="shrink">False</property>
</packing>
</child>
<child>
<object class="GtkPaned">
<property name="width_request">48</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="wide_handle">True</property>
<child>
<object class="GtkOverlay" id="Overlay2">
<property name="width_request">48</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkImage">
<property name="width_request">24</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">end</property>
<property name="stock">gtk-goto-last</property>
</object>
<packing>
<property name="index">-1</property>
</packing>
</child>
<child type="overlay">
<object class="GtkImage">
<property name="width_request">24</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="stock">gtk-go-back</property>
</object>
</child>
</object>
<packing>
<property name="resize">True</property>
<property name="shrink">False</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
<packing>
<property name="resize">True</property>
<property name="shrink">True</property>
</packing>
</child>
</object>
<packing>
<property name="resize">True</property>
<property name="shrink">False</property>
</packing>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
</object>
</interface>