OSDN Git Service

サムネイル・ツールバーを実装してみた。
[wintimer/wintimer.git] / wintimer / sf_windows.h
index d563900..072c6c7 100644 (file)
@@ -4,6 +4,7 @@
 // Windows Header Files:
 #include "exception.h"
 #include "base_window.h"
+#include "dpi.h"
 #define XBYAK64
 #include "xbyak.h"
 // DLLのリンク
@@ -174,7 +175,7 @@ namespace sf{
     ~device_context() {}
     operator HDC(){return holder_->get();}
   private:
-    boost::scoped_ptr<Holder> holder_;
+    std::unique_ptr<Holder> holder_;
   };
 
   //struct handle_holder : boost::noncopyable
@@ -293,10 +294,30 @@ namespace sf{
     typedef boost::signals2::signal<LRESULT (HWND,uint32_t,WPARAM, LPARAM) > on_message_type;
     on_message_type on_message;
     
-    operator HWND() {return hwnd_;};
+    operator HWND() const {return hwnd_;};
     
-    virtual void * raw_handle(){return hwnd_;};
-    virtual void show(uint32_t show_flag);
+    virtual void * raw_handle() const {return hwnd_;};
+//    virtual void show(uint32_t show_flag);
+
+    virtual void show() {
+      ::ShowWindow(hwnd_,SW_SHOW);
+      ::GetWindowPlacement(hwnd_,&wp_);
+    }
+
+    // Window を画面から隠す
+    virtual bool is_show() {
+      return ( wp_.showCmd == SW_SHOWMAXIMIZED 
+        || wp_.showCmd == SW_SHOWMINIMIZED
+        || wp_.showCmd == SW_SHOWNORMAL );
+    };
+
+    //
+    virtual void hide()
+    {
+      ::ShowWindow(hwnd_,SW_HIDE);
+      ::GetWindowPlacement(hwnd_,&wp_);
+    };
+
     virtual void text(std::wstring& text)
     {
       ::SetWindowTextW(*this,text.c_str());
@@ -377,9 +398,11 @@ namespace sf{
     std::wstring name_;
     float width_,height_;
     bool fit_to_display_;
-    boost::shared_ptr<sf::window_class_ex> wnd_class_;
+    std::shared_ptr<sf::window_class_ex> wnd_class_;
     WNDPROC thunk_proc_;
-  };
+    dpi dpi_;
+    WINDOWPLACEMENT wp_;
+   };
   
   struct av_mm_thread_characteristics
   {
@@ -403,7 +426,7 @@ namespace sf{
     std::wstring name_;
     float width_,height_;
     bool fit_to_display_;
-
+    WINDOWPLACEMENT wp_;//
   };
 
   struct widget