… | |
… | |
237 | sub size_allocate { |
237 | sub size_allocate { |
238 | # nothing to be done |
238 | # nothing to be done |
239 | } |
239 | } |
240 | |
240 | |
241 | sub children { |
241 | sub children { |
|
|
242 | } |
|
|
243 | |
|
|
244 | # call when resoltuion changes etc. |
|
|
245 | sub reconfigure { |
|
|
246 | my ($self) = @_; |
|
|
247 | |
|
|
248 | $_->reconfigure |
|
|
249 | for $self->children; |
|
|
250 | |
|
|
251 | $_->check_size; |
242 | } |
252 | } |
243 | |
253 | |
244 | sub set_max_size { |
254 | sub set_max_size { |
245 | my ($self, $w, $h) = @_; |
255 | my ($self, $w, $h) = @_; |
246 | |
256 | |
… | |
… | |
1204 | s/</</g; |
1214 | s/</</g; |
1205 | |
1215 | |
1206 | $_[1] |
1216 | $_[1] |
1207 | } |
1217 | } |
1208 | |
1218 | |
|
|
1219 | sub update { |
|
|
1220 | my ($self) = @_; |
|
|
1221 | |
|
|
1222 | delete $self->{texture}; |
|
|
1223 | $self->SUPER::update; |
|
|
1224 | } |
|
|
1225 | |
|
|
1226 | sub reconfigure { |
|
|
1227 | my ($self) = @_; |
|
|
1228 | |
|
|
1229 | delete $self->{texture}; |
|
|
1230 | } |
|
|
1231 | |
1209 | sub set_text { |
1232 | sub set_text { |
1210 | my ($self, $text) = @_; |
1233 | my ($self, $text) = @_; |
1211 | |
1234 | |
|
|
1235 | return if $self->{text} eq "T$text"; |
|
|
1236 | $self->{text} = "T$text"; |
|
|
1237 | |
1212 | $self->{layout}->set_text ($text); |
1238 | $self->{layout}->set_text ($text); |
1213 | |
1239 | |
1214 | delete $self->{texture}; |
1240 | delete $self->{texture}; |
|
|
1241 | $self->update; |
1215 | $self->check_size; |
1242 | $self->check_size; |
1216 | $self->update; |
|
|
1217 | } |
1243 | } |
1218 | |
1244 | |
1219 | sub set_markup { |
1245 | sub set_markup { |
1220 | my ($self, $markup) = @_; |
1246 | my ($self, $markup) = @_; |
1221 | |
1247 | |
|
|
1248 | return if $self->{text} eq "M$markup"; |
|
|
1249 | $self->{text} = "M$markup"; |
|
|
1250 | |
1222 | $self->{layout}->set_markup ($markup); |
1251 | $self->{layout}->set_markup ($markup); |
1223 | |
1252 | |
1224 | delete $self->{texture}; |
1253 | delete $self->{texture}; |
|
|
1254 | $self->update; |
1225 | $self->check_size; |
1255 | $self->check_size; |
1226 | $self->update; |
|
|
1227 | } |
1256 | } |
1228 | |
1257 | |
1229 | sub size_request { |
1258 | sub size_request { |
1230 | my ($self) = @_; |
1259 | my ($self) = @_; |
1231 | |
1260 | |
… | |
… | |
1755 | } |
1784 | } |
1756 | |
1785 | |
1757 | sub set_max { |
1786 | sub set_max { |
1758 | my ($self, $max) = @_; |
1787 | my ($self, $max) = @_; |
1759 | |
1788 | |
|
|
1789 | return if $self->{max_val} == $max; |
|
|
1790 | |
1760 | $self->{max_val} = $max; |
1791 | $self->{max_val} = $max; |
|
|
1792 | $self->update; |
1761 | } |
1793 | } |
1762 | |
1794 | |
1763 | sub set_value { |
1795 | sub set_value { |
1764 | my ($self, $val, $max) = @_; |
1796 | my ($self, $val, $max) = @_; |
1765 | |
1797 | |
1766 | $self->set_max ($max) |
1798 | $self->set_max ($max) |
1767 | if defined $max; |
1799 | if defined $max; |
1768 | |
1800 | |
1769 | $max = $self->{max_val}; |
1801 | return if $self->{val} == $val; |
|
|
1802 | |
1770 | $self->{val} = $val; |
1803 | $self->{val} = $val; |
1771 | |
|
|
1772 | $self->update; |
1804 | $self->update; |
1773 | } |
1805 | } |
1774 | |
1806 | |
1775 | sub _draw { |
1807 | sub _draw { |
1776 | my ($self) = @_; |
1808 | my ($self) = @_; |
… | |
… | |
1859 | |
1891 | |
1860 | $self->{value}->set_fontsize ($fsize); |
1892 | $self->{value}->set_fontsize ($fsize); |
1861 | $self->{max} ->set_fontsize ($fsize); |
1893 | $self->{max} ->set_fontsize ($fsize); |
1862 | } |
1894 | } |
1863 | |
1895 | |
|
|
1896 | sub set_max { |
|
|
1897 | my ($self, $max) = @_; |
|
|
1898 | |
|
|
1899 | $self->{gauge}->set_max ($max); |
|
|
1900 | $self->{max}->set_text ($max); |
|
|
1901 | } |
|
|
1902 | |
1864 | sub set_value { |
1903 | sub set_value { |
1865 | my ($self, $val, $max) = @_; |
1904 | my ($self, $val, $max) = @_; |
1866 | |
1905 | |
1867 | $self->set_max ($max) |
1906 | $self->set_max ($max) |
1868 | if defined $max; |
1907 | if defined $max; |
1869 | |
1908 | |
1870 | $self->{gauge}->set_value ($val, $max); |
1909 | $self->{gauge}->set_value ($val, $max); |
1871 | $self->{value}->set_text ($val); |
1910 | $self->{value}->set_text ($val); |
1872 | } |
|
|
1873 | |
|
|
1874 | sub set_max { |
|
|
1875 | my ($self, $max) = @_; |
|
|
1876 | |
|
|
1877 | $self->{gauge}->set_max ($max); |
|
|
1878 | $self->{max}->set_text ($max); |
|
|
1879 | } |
1911 | } |
1880 | |
1912 | |
1881 | ############################################################################# |
1913 | ############################################################################# |
1882 | |
1914 | |
1883 | package CFClient::UI::Slider; |
1915 | package CFClient::UI::Slider; |